/cache/fontconfig sporadically grows to 13 GB (3091259 files!?)

Apparently my fontconfig cache on Ubuntu 16.04.6 LTS seems to sporadically grow to like 13 GB.

I tried running sudo fc-cache -f -v which outputs

/var/cache/fontconfig: cleaning cache directory

but afterwards it still has 13 GB. Counting the files results into 3091259 files inside the cache folder!

I only do have a pretty much default set of fonts installed, nothing fancy.

I assume I could simply delete the contents of the cache folder and rebuild it, but I’m wondering what is causing this sporadic spikes in the cache size and how to prevent 3 million cache files for a few fonts.

Here’s the full output of fc-cache -f -v

/usr/share/fonts: caching, new cache contents: 0 fonts, 5 dirs /usr/share/fonts/X11: caching, new cache contents: 0 fonts, 4 dirs /usr/share/fonts/X11/Type1: caching, new cache contents: 8 fonts, 0 dirs /usr/share/fonts/X11/encodings: caching, new cache contents: 0 fonts, 1 dirs /usr/share/fonts/X11/encodings/large: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/X11/misc: caching, new cache contents: 59 fonts, 0 dirs /usr/share/fonts/X11/util: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap: caching, new cache contents: 0 fonts, 5 dirs /usr/share/fonts/cmap/adobe-cns1: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap/adobe-gb1: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap/adobe-japan1: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap/adobe-japan2: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/cmap/adobe-korea1: caching, new cache contents: 0 fonts, 0 dirs /usr/share/fonts/opentype: caching, new cache contents: 0 fonts, 2 dirs /usr/share/fonts/opentype/stix: caching, new cache contents: 29 fonts, 0 dirs /usr/share/fonts/opentype/stix-word: caching, new cache contents: 5 fonts, 0 dirs /usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 4 dirs /usr/share/fonts/truetype/dejavu: caching, new cache contents: 21 fonts, 0 dirs /usr/share/fonts/truetype/lato: caching, new cache contents: 18 fonts, 0 dirs /usr/share/fonts/truetype/liberation: caching, new cache contents: 16 fonts, 0 dirs /usr/share/fonts/truetype/openoffice: caching, new cache contents: 1 fonts, 0 dirs /usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs /usr/share/fonts/type1/gsfonts: caching, new cache contents: 35 fonts, 0 dirs /usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs /root/.local/share/fonts: skipping, no such directory /root/.fonts: skipping, no such directory Re-scanning /usr/share/fonts: caching, new cache contents: 0 fonts, 5 dirs Re-scanning /usr/share/fonts/X11: caching, new cache contents: 0 fonts, 4 dirs Re-scanning /usr/share/fonts/X11/encodings: caching, new cache contents: 0 fonts, 1 dirs Re-scanning /usr/share/fonts/cmap: caching, new cache contents: 0 fonts, 5 dirs Re-scanning /usr/share/fonts/opentype: caching, new cache contents: 0 fonts, 2 dirs Re-scanning /usr/share/fonts/truetype: caching, new cache contents: 0 fonts, 4 dirs Re-scanning /usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs /var/cache/fontconfig: cleaning cache directory /root/.cache/fontconfig: not cleaning non-existent cache directory /root/.fontconfig: not cleaning non-existent cache directory fc-cache: succeeded