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
- fedora 43: fontconfig-devel 2.17.0-3.fc43 Β· HPND AND LicenseRef-Fedora-Public-Domain AND Unicode-DFS-2016
- fedora 43: fontconfig-devel 2.17.0-3.fc43 Β· HPND AND LicenseRef-Fedora-Public-Domain AND Unicode-DFS-2016
- fedora 44: fontconfig-devel 2.17.0-4.fc44 Β· HPND AND LicenseRef-Fedora-Public-Domain AND Unicode-DFS-2016
- fedora 44: fontconfig-devel 2.17.0-4.fc44 Β· HPND AND LicenseRef-Fedora-Public-Domain AND Unicode-DFS-2016
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms