FcPatternBuild(3)

✨ FcPatternBuild(3) ✨

okay so bestie, we're in the FcPatternBuild(3) part of the fontconfig manual today β€” three functions that literally just assemble patterns out of arguments for you. it's giving factory-line energy, no cap πŸ’…


🌸 NAME 🌸

FcPatternBuild, FcPatternVaBuild, FcPatternVapBuild β€” create patterns from arguments πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <fontconfig/fontconfig.h>

FcPattern * FcPatternBuild (FcPattern *pattern, ...);

FcPattern * FcPatternVaBuild (FcPattern *pattern, va_list va);

void FcPatternVapBuild (FcPattern *result, FcPattern *pattern, va_list va);

πŸ’– DESCRIPTION πŸ’–

So what these icons actually do is build a pattern out of a whole little guest list of objects, types and values. And when I say "each value gets specified with three arguments", I mean it fr fr β€” three, every single time, like a trio of besties who refuse to be separated 🫢

  1. Object name β€” a string that literally describes the property you're adding.
  2. Object type β€” one of the FcType enumerated values, periodt.
  3. Value β€” and heads up, this one is not an FcValue. It's the raw type, exactly as you'd pass it to any of the FcPatternAdd<type> functions. and it must match the type of that second argument, or it's gonna be a whole situation 😭

The argument list is terminated by a null object name β€” and no, you don't need to pass an object type or a value along with it, she just ends there, iconic queen behavior πŸ‘‘. The values get added to pattern, and if pattern is null, a brand new pattern gets created instead. Either way? The pattern gets returned to you. slay ✨

Example, because we love a visual:

pattern = FcPatternBuild (0, FC_FAMILY, FcTypeString, "Times", (char *) 0);

FcPatternVaBuild is your girl when the arguments are already sitting there in the form of a va_list varargs value β€” no unpacking required. And FcPatternVapBuild? That's a macro version of FcPatternVaBuild that returns its result directly in the result variable. lowkey convenient, highkey underrated 🧚


ngl if you get the type mismatch in step 3 wrong, that's on you β€” the manpage warned you, bestie πŸ’€

and that's the page!! brought to you by Fontconfig 2.17.0, dated 27 June 2025 β€” go forth and build those patterns, main character πŸ”₯πŸ’œ

πŸ“¦ where this page comes from