Very bad performance when too many fonts are installed (v7)

So on my system, for a variety of reasons, I just so happen to have a lot of fonts installed. This normally doesn’t cause any problems, as most apps with font selection UI elements are prepared to deal with it.

However, that’s not the case in KiCad v7.

First, every single dialog box that contains a font-selection drop-down (adding net labels, editing text elements, opening parts of preferences, etc) literally takes 2-3 whole seconds to open. This starts to get extremely annoying, as some of the affected areas are quite regularly used.

Second, the font-selection drop-down itself is very difficult to navigate. There’s no scroll bar or search capability, so I’m just endlessly spinning my mouse wheel if I want anything besides the default.

Now I know fixing the second issue could be considered a minor feature enhancement (but seriously, every other app I use with font selection options does better here). However, the first issue feels like a downright performance bug.

Wondering if anyone else has noticed this yet, or is getting irritated by it.

FYI, here’s my version info:
Application: KiCad x86_64 on x86_64

Version: 7.0.0-da2b9df05c~163~ubuntu22.04.1, release build

Libraries:
wxWidgets 3.2.1
FreeType 2.11.1
HarfBuzz 6.0.0
FontConfig 2.13.1
libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.13

Platform: Pop!_OS 22.04 LTS, 64 bit, Little endian, wxGTK, pop, x11

Build Info:
Date: Feb 21 2023 12:56:33
wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.74.0
OCC: 7.5.2
Curl: 7.87.0
ngspice: 38
Compiler: GCC 11.3.0 with C++ ABI 1016

Build settings:
KICAD_SPICE=ON

1 Like

We use a platform native dropdown menu…the scrollbar is probably being autohidden or something by your system.

No problems here.
Application: KiCad Schematic Editor x86_64 on x86_64

Version: 7.0.0-da2b9df05c~163~ubuntu22.04.1, release build

Libraries:
wxWidgets 3.2.1
FreeType 2.11.1
HarfBuzz 6.0.0
FontConfig 2.13.1
libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.13

Platform: Linux Mint 21, 64 bit, Little endian, wxGTK, cinnamon, x11

Build Info:
Date: Feb 14 2023 10:38:53
wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.74.0
OCC: 7.5.2
Curl: 7.87.0
ngspice: 38
Compiler: GCC 11.3.0 with C++ ABI 1016

Build settings:
KICAD_SPICE=ON

There are arrows top and bottom of the list.
Hold left mouse button down in arrow box close to list of fonts, scroll is slow, move mouse in arrow box to far from list, scroll is fast.
Every click has an instant response.

Seems the only difference is the linux OS

How many fonts do you have installed?

I’m starting to trace through the code to see if I can pinpoint the bottleneck, and it looks like my system is returning a list of almost 2000 font names.

Okay, I’ve been digging through the code, and at this point I’m convinced the real problem is that trying to dump 1000+ items into a wxChoice control is the cause of all of this. That control is not really designed to hold so many elements, from both a usability and a performance perspective.

(Inside font_choice.cpp, the actual system font list query is rather quick. All of the time lags seem to be once the data is handed off to wxWidgets.)

I don’t know. It is a longish list. However many came with Mint.
Here are 15

ksnip_20230222-153149

Just for clarity:

Is this 2s delay upon opening the dialog itself, or only when you open the font selection box?

I don’t have any performance problems on my Linux box, myself, but My Linux Mint box also only has the default fonts installed (Around 400, but only 120 or so visible in KiCad. It does not list variants such as bold and italic separately).
I do find the scrolling though the list quite laborious though. The GUI widget used is not intended for something that does not fit on your monitor, and the scroll arrows are (in my opinion) only for “emergency” situations and lists that are too long.

I have very little interest in fonts, I’m just fine with the “default” in KiCad. Having to change the font for each label separately seems a bit ridiculous though. There is clearly room for improvement here. A bit of searching found: Preferences / Preferences / Schematic Editor / Display Options / Appearance / Default Font, and when changing that, all texts in the schematic change with it.

I guess making a short list of fonts in the preferences could be a nice solution. The rest of KiCad could then just ignore all other fonts. But overall. KiCad V7 is the first stable version with selectable fonts. This usually means the basic functionality is implemented, but not much more yet, and refinements will get introduced over time.

Application: KiCad Schematic Editor x86_64 on x86_64

Version: 7.0.0-da2b9df05c~163~ubuntu20.04.1, release build

Libraries:
	wxWidgets 3.2.1
	FreeType 2.10.1
	HarfBuzz 6.0.0
	FontConfig 2.13.1
	libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3

Platform: Linux Mint 20.3, 64 bit, Little endian, wxGTK, xfce, x11

Build Info:
	Date: Feb 21 2023 12:56:05
	wxWidgets: 3.2.1 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.71.0
	OCC: 7.5.2
	Curl: 7.87.0
	ngspice: 38
	Compiler: GCC 9.4.0 with C++ ABI 1013

Build settings:
	KICAD_SPICE=ON

I run the same as @paulvdh CORRECTION: a little newer than Paul.

count was about 150 default in Mint, but some seem duplicates and some seem to not work.

Is this 2s delay upon opening the dialog itself, or only when you open the font selection box?

Both, actually. Well, the first delay is ~2-3s, and the second delay is ~1-2s.
However, because I almost never actually want to change the font, I rarely have to suffer the second delay.

I do find the scrolling though the list quite laborious though. The GUI widget used is not intended for something that does not fit on your monitor, and the scroll arrows are (in my opinion) only for “emergency” situations and lists that are too long.
Yeah, the control absolutely is not designed for this purpose. wxWidgets actually does have its own wxFontPickerCtrl control that shows the system font selection dialog, but I can understand not wanting to use it.

I suspect the only real fix for this will be to do one of two things:

  1. Write some sort of semi-custom long-list selection control, like every other major desktop application with a font picker drop-down uses. (Inkscape and LibreOffice being possible examples)
  2. Write a font picker popup that’s similar to the system picker dialog, but modified based on the needs of KiCad.

I guess making a short list of fonts in the preferences could be a nice solution. The rest of KiCad could then just ignore all other fonts.

This would be a kludge, but one that would probably get the job done the quickest. It could even be enhanced by simply having the wxChoice drop-down show a short default list, with an option at the end to launch some sort of picker with more choices.

But overall. KiCad V7 is the first stable version with selectable fonts. This usually means the basic functionality is implemented, but not much more yet, and refinements will get introduced over time.

Yeah, that’s why I give a pass to the font selection usability issues. But what I can’t give a pass to, is the constant and annoying delay on every single dialog in the whole application with a font picker somewhere in it.

Just tried everything I could find in the Symbol, Schematic, Footprint, PCB and overall preferences that had editable text… no delays of any kind anywhere. Screen had changed by the time I had raised my mouse finger.

I noticed interface braking on nvidia drivers in ubunte but it was before the update… And it’s not related to the kicad… Maybe it is worth updating the system until 22.04 and putting a new driver package under the video card?

I really don’t know about wxWidgets and the underlying UI libraries, but I remember that in Qt the similar list was created in a dummy way by creating a UI cell widget for each item one by one. Probably wxChoice just isn’t meant for large amounts of items, and as has been noted, UX can’t be good with the default widget anyway because choosing what you want or browsing through the options is clumsy. One way to cope with this is to use some kind of model/view system and lazy population on demand. But that requires (unnecessarily complicated) programming and doesn’t solve the UX problem. Would it really be worth it for a use case which maybe 0.1% of users hit into? I would rather do what Paul suggested, so that the user could pre-select a list of fonts available to KiCad. Most probably any user will ever need a couple of different fonts for KiCad, unlike for a random office application.

Instead of my first idea:

I like this idea a bit better:

Or, it pre populates a list with all fonts used in the project, and adds a “more” selection for a font picker.

But I don’t presume my input is valuable here. The KiCad developers are plenty smart to solve it to their own taste. They probably just have to be notified that this is a thing that needs some attention. I also like giving them freedom to do things to their own insights.

I also have this problem and it looks like a fix is planned for version 7.0.2:

The delay you’re experiencing when opening dialog boxes with font-selection drop-downs could be due to the large number of fonts installed on your system. KiCad might be scanning through all the available fonts, causing the delay. One possible workaround is to temporarily remove or disable some fonts that you don’t regularly use. This could potentially improve the performance of font-related operations in KiCad. Alternatively, you could try optimizing your system’s font cache or consider using a font management tool to organize and optimize your font collection.

I probably mentioned it earlier in the thread, but the issue is not KiCad scanning through a large list of fonts. That part is actually rather quick. The issue is shoving all of those font items into the wxChoice drop-down control, which is the step that actually takes a long time.

TL;DR:

Our man @imcinerney sent a patch up to wxWidgets team, where Vadim merged it and back-ported it to 3.2.

Our man @jmaibaum picked up the patch.

But I don’t know diddly about our Linux packaging, so my breadcrumb trail ends there.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.