FcPatternGet-Type(3)

πŸ’… FcPatternGet-Type(3) β€” bestie edition

ok so real talk: we're deep in fontconfig land today (yes, the whole FcPatternGet-Type(3) manual page, no crumbs left behind) and this one is genuinely one of my faves because it's all about getting typed values out of a pattern and not having your whole afternoon ruined by a type mismatch. slay. πŸ’–


✨ NAME ✨

FcPatternGetInteger, FcPatternGetDouble, FcPatternGetString, FcPatternGetMatrix, FcPatternGetCharSet, FcPatternGetBool, FcPatternGetFTFace, FcPatternGetLangSet, FcPatternGetRange β€” literally just return a typed value from a pattern, that's the whole vibe 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

first things first, you gotta include the header, no cap:

#include <fontconfig/fontconfig.h>

and here's the whole squad, one by one, each in its own lil code block so nothing gets squished 😌

FcResult FcPatternGetInteger (FcPattern *p, const char *object, int n, int *i);
FcResult FcPatternGetDouble (FcPattern *p, const char *object, int n, double *d);
FcResult FcPatternGetString (FcPattern *p, const char *object, int n, FcChar8 **s);
FcResult FcPatternGetMatrix (FcPattern *p, const char *object, int n, FcMatrix **s);
FcResult FcPatternGetCharSet (FcPattern *p, const char *object, int n, FcCharSet **c);
FcResult FcPatternGetBool (FcPattern *p, const char *object, int n, FcBool *b);
FcResult FcPatternGetFTFace (FcPattern *p, const char *object, int n, FT_Face *f);
FcResult FcPatternGetLangSet (FcPattern *p, const char *object, int n, FcLangSet **l);
FcResult FcPatternGetRange (FcPattern *p, const char *object, int n, FcRange **r);

🌸 DESCRIPTION 🌸

okok so here's the tea β˜• β€” these are convenience functions. what do they do? they call FcPatternGet and then they check that the data that came back is actually the type you asked for. like a vibe check, but for data. πŸ”₯

if the type isn't what you expected, they return FcResultTypeMismatch. not dramatic, just honest. πŸ’€

important, bestie, do not skip this: these functions (exactly like FcPatternGet) do not make a copy of any data structure referenced by the return value. so the pointer you get back is pointing at the real thing β€” no duplicates, no safety net. handle with care πŸ™ˆ

you should use these in preference to FcPatternGet so you get compile-time typechecking. that's the whole point, it's giving safety goggles but make it cute πŸ₯½βœ¨

also, heads up so you're not confused later: FcPatternGetRange is available since 2.11.91. iykyk. πŸŽ€


πŸ’œ sign-off πŸ’œ

that's the page, bestie! this whole thing ships with Fontconfig 2.17.0, dated 27 June 2025. go forth and typecheck your patterns, you absolute icon πŸ‘‘πŸŒˆβ­

πŸ“¦ where this page comes from