get_font_ranges(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

✨ get_font_ranges ✨

okay bestie, gather round, it's a get_font_ranges(3) moment πŸ’– this one lives in the Allegro manual, and it's literally the Allegro game programming library, so you know it's iconic πŸ’…


🌸 NAME 🌸

get_font_ranges β€” returns the number of character ranges in a font. Allegro game programming library. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

int get_font_ranges(FONT *f)

no cap, that's the whole signature, it's giving short and sweet ✨


πŸ’œ DESCRIPTION πŸ’œ

so like, you call this function when you wanna know how many character ranges are in a font. that's it, that's the job 🫢

but listen β€” knowing the count is only the appetizer, bestie. you then gotta go query each one of those ranges with get_font_range_begin() and get_font_range_end() to actually find out what characters are available in the font. like, the count tells you how many lil boxes to open, and those two functions tell you what's inside each box πŸ“¦βœ¨

here's the example, verbatim, because I would never mess with your code:

FONT *f;
int range;
int n;
...

range = get_font_ranges(f);
printf("The font has %d character ranges:\n", range);
for (n = 0; n < range; n++)
   printf("Range %d from 0x%03x - 0x%03x\n",
          get_font_range_begin(f, n),
          get_font_range_end(f, n));

look at that loop go, it's literally the main character πŸ‘‘


πŸŽ€ RETURN VALUE πŸŽ€

it hands you back the number of continuous character ranges in a font πŸ’š

OR β€” and this is the plot twist β€” it returns -1 if that information is not available 😭 so fr fr, check for the -1, don't just assume you got a real number, that's the vibe check you cannot skip πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, they're the whole friend group:


and that's the page, babe πŸ¦‹ this was Allegro version 4.4.3, documented on the get_font_ranges(3) page β€” mwah, go forth and count your ranges πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from