FcFileScan(3)

πŸ’… FcFileScan(3) β€” the fontconfig manual, bestie edition πŸŽ€

okay so before we even start: this is a page from the fontconfig manual, section 3, and the star of the show is FcFileScan. she scans a font file. that's the whole gig. let's get into it ✨


🌸 NAME 🌸

FcFileScan β€” scan a font file πŸ”

like, literally. one file. scanning it. iconic behavior honestly.


✨ SYNOPSIS ✨

#include <fontconfig/fontconfig.h>

FcBool FcFileScan (FcFontSet *set, FcStrSet *dirs, FcFileCache *cache, FcBlanks *blanks, const FcChar8 *file, FcBool force);

six arguments, no cap. don't panic, we're going through every single one 🫢


πŸ’– DESCRIPTION πŸ’–

so what she does is: she scans a single file and adds all the fonts she finds to set. that's it, that's the vibe. one file in, fonts out, slay πŸ’…

if force is FcTrue, then the file gets scanned even if associated information is found in cache. like, no ma'am, we are not trusting the cache today, we're doing the work ourselves. main character energy fr fr πŸ”₯

if file is a directory, it gets added to dirs instead. not scanned, just noted. subtle. mysterious. she contains multitudes πŸ¦‹

now, whether fonts are actually found depends on fontconfig policy as well as the current configuration β€” so it's giving "it depends," which is annoying but that's the truth ngl.

and here's a fun little internal detail πŸ‘€ β€” fontconfig will ignore BDF and PCF fonts which are not in Unicode (or the effectively equivalent ISO Latin-1) encoding, because those are simply not usable by Unicode-based applications. like, sorry babe, wrong encoding, we can't use you 😭

the configuration can also ignore fonts based on filename or on the contents of the font file itself. so yeah, there are multiple vibe checks a font has to pass before she makes the cut 🧚

return value time πŸŽ€ β€” returns FcFalse if any of the fonts cannot be added (due to allocation failure). otherwise returns FcTrue. that's the whole contract, no notes.

⚠️ real talk: that FcFalse is specifically an allocation-failure situation, so if you see it, it's a memory thing, not a "your font is ugly" thing πŸ’€

okay that's the page!! go scan something iconic, bestie πŸ’œ

🌈 cute sign-off: this was Fontconfig 2.17.0, dated 27 June 2025 β€” the FcFileScan(3) era. mwah πŸ’‹ πŸŽ€

πŸ“¦ where this page comes from