r/linuxquestions • • 4h ago

Advice Dealing with huge font libraries?

I run my system with 3 SSDs. One is for the OS, one for my home directory and a bigger one for assets like fonts, caches, etc.

Hence folders like ~/.local/share/fonts/BigLib are symlinks to a font library on my bigger drive thst consists of nearly 20k font-files, GoogleFonts, NerdFonts, etc.

I first noticed this as an issue with the zed editor, where it used to take a huge amount of time to startup due to the large font library.

Now I came to realize that other apps can't deal with such huge font libraries. i.e. when running Steam, it scans that huge amount of fonts, and each game it starts via Proton the proton-service again rescans the entire library.

So, what's the best way to manage fonts in a way, where certain apps get a minimal set of fonts, while other apps like Inkscape get the entire library?

9 Upvotes

6 comments sorted by

9

u/valgrid 3h ago

If you only need the font catalogue in creative apps then check if they can load fonts from custom paths. Inkscape, Gimp etc support it.

If you need them in more apps which aren't configurable you could do the following:

  • by default use a small font catalogue
  • for apps that need the large catalogue create a new fontconfig file
  • change the launch options for applications and point them to your large fontconfig config file which includes a seperate path for your huge library and a fontconfig cache

Then start your app like this:

FONTCONFIG_FILE=$HOME/.config/fontconfig-huge/fonts.conf your-app

https://fontconfig.pages.freedesktop.org/fontconfig/fontconfig-user.html

3

u/gnufan 3h ago

The specific Zed issue is discussed in comments to

https://github.com/zed-industries/zed/issues/14222

Maybe cosmic_text 

https://github.com/pop-os/cosmic-text/issues/505

I would expect the first font using program to potentially take some time, and I seem to remember the LibreOffice font picker rendered a bit of text in every font at one point which was painful on spinning rust. 

1

u/GiggleSamurai 1h ago

To make the separate-config idea concrete: take the BigLib symlink out of ~/.local/share/fonts so every app only sees your small set, then create ~/.config/fontconfig/big.conf containing <fontconfig><include>/etc/fonts/fonts.conf</include><dir>/path/to/BigLib</dir></fontconfig> and start Inkscape with FONTCONFIG_FILE=$HOME/.config/fontconfig/big.conf inkscape (in a .desktop file, use env and the full path in the Exec line).

1

u/DavidJohnMcCann 23m ago

I'm irritated when I go to choose a font in Writer and have to scroll through dozens of things I'll never use. I just remove everything that I'll never want.

1

u/maceion 3h ago

Grandfather was printer and compositor. He said: Never use more than 4 fonts. One bold, one normal, one italic, and one for 'foreign characters'. Or you display a 'disordered mind' and can be deemed 'irresponsible'.

1

u/mrkrag 4h ago

🍿 guess I'm to early for an answer yet, commenting to keep track of this for later