Skip to content

fontconfig: re-read the configuration when the font cache is refreshed - #252

Merged
fredkiefer merged 1 commit into
gnustep:masterfrom
probonopd:fix-fontconfig-refresh-reread
Oct 19, 2026
Merged

fredkiefer merged 1 commit into
gnustep:masterfrom
probonopd:fix-fontconfig-refresh-reread

Conversation

@probonopd

Copy link
Copy Markdown
Contributor

-[NSFontManager refreshAvailableFonts] rebuilds the font lists from fontconfig, but a running process still holds the configuration it read at start-up, so a font installed after launch is never found, however often the lists are refreshed.

Reproducer (a font is copied into a fontconfig directory, fc-cache -f is run on it, then the font manager is refreshed):

$ FONTCONFIG_FILE=test.conf ./ft fonts -GSBackend backold
before=0 after=0
$ FONTCONFIG_FILE=test.conf ./ft fonts -GSBackend backnew
before=0 after=1

FCFontEnumerator now overrides -refreshFontCache and calls FcInitReinitialize() before the lists are rebuilt. FcInitBringUptoDate() does not help here: it only looks at the disk once per rescan interval, 30 seconds by default.

cc @pkgdemon

-[NSFontManager refreshAvailableFonts] rebuilds the font lists from
fontconfig, but a running process keeps the configuration it read at
start-up, so a font installed after launch was never found, however often
the lists were refreshed.  FCFontEnumerator now overrides -refreshFontCache
and calls FcInitReinitialize() first.  FcInitBringUptoDate() is not enough:
it only looks at the disk once per rescan interval, 30 seconds by default.
@probonopd
probonopd requested a review from fredkiefer as a code owner October 18, 2026 18:48

@fredkiefer fredkiefer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable

@fredkiefer
fredkiefer merged commit d378734 into gnustep:master Oct 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants