FcFontSetSort(3)

πŸ’… NAME πŸ’…

FcFontSetSort β€” gimme the list of fonts that actually match, bestie ✨

okay so real talk, this is the "which fonts match" girly. she returns a list of matching fonts, sorted and everything. no cap. 🫢


🌸 SYNOPSIS 🌸

#include <fontconfig/fontconfig.h>

FcFontSet * FcFontSetSort (FcConfig *config, FcFontSet **sets, int nsets, FcPattern *pattern, FcBool trim, FcCharSet **csp, FcResult *result);

like… look at her. seven arguments. main character energy fr fr πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so what she does is: she takes fonts from sets and returns them sorted by how close they are to pattern. closeness ranking, iconic behaviour, we love to see it πŸ’–

if trim is FcTrue, then any elements in the list that don't include Unicode coverage that earlier elements in the list didn't already have get elided. yeah β€” redundant coverage gets yeeted. πŸ—‘οΈβœ¨ the union of the Unicode coverage of all of the fonts gets returned in csp, but only if csp is not NULL. if it's NULL, nothing happens there, iykyk.

⚠️ bestie pls read this one: this function should be called only after FcConfigSubstitute and FcDefaultSubstitute have been called for p β€” otherwise your results will not be correct. like, not "kinda off", straight up WRONG. 😭 don't skip the prep steps, that's the whole vibe check.

the FcFontSet you get back references FcPattern structures which may be shared by the return value from multiple FcFontSort calls. so applications cannot modify these patterns. πŸ™ˆ do not touch. hands off. instead, they should be passed β€” along with pattern β€” to FcFontRenderPrepare, which combines them into a complete pattern. that's the move. that's the slay. πŸ’…

and when you're done with the FcFontSet returned by FcFontSetSort? you destroy it by calling FcFontSetDestroy. clean up after yourself, queen πŸŽ€


✨ and that's the whole page, bestie ✨ this one's from Fontconfig 2.17.0, dated 27 June 2025 πŸŒˆπŸ’œ go sort some fonts and be iconic about it πŸ¦‹πŸ“

πŸ“¦ where this page comes from