get_font_ranges(3alleg4)

✨ NAME ✨

get_font_ranges β€” bestie, this one tells you how many character ranges are chillin' in a font πŸ’–

(also hi, this is part of the Allegro game programming library, so you know it's giving main character energy in your graphics code πŸŽ€)


🌸 SYNOPSIS 🌸

#include <allegro.h>

int get_font_ranges(FONT *f)

πŸ’… DESCRIPTION πŸ’…

okay so, use this function when you need to find out the number of character ranges in a font. that's it, that's the whole vibe ✨

but listen, because this part matters: you should query each of these ranges with get_font_range_begin() and get_font_range_end() to find out what characters are actually available in the font. like, don't just get the count and ghost it, go find out what's inside πŸ¦‹

example time, no cap:

   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 ate πŸ’…


πŸ”₯ RETURN VALUE πŸ”₯

returns the number of continuous character ranges in a font. that's the slay. πŸ”₯

but if that information is not available, you get -1. so if you're staring at a -1 like πŸ‘οΈπŸ‘„πŸ‘οΈ, yeah, the font said "i don't know her" and you gotta handle that case yourself, bestie.


🫢 SEE ALSO 🫢

go read those too, they're lowkey the whole support system for this one 🧚


Allegro πŸ’œ version 4.4.3 πŸ’œ and yes this page is literally called get_font_ranges(3alleg4) β€” mwah, that's the whole thing, periodt. go make something iconic with your fonts πŸ’–βœ¨πŸŽ€