al_get_font_ranges(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_get_font_ranges β€” the Allegro 5 API glow-up πŸ’–

okay bestie, so this one lives in the Allegro 5 manual, and it's literally the way you find out which glyphs a font is actually packing. no cap.


✨ SYNOPSIS ✨

#include <allegro5/allegro_font.h>

int al_get_font_ranges(ALLEGRO_FONT *f, int ranges_count, int *ranges)

🌸 DESCRIPTION 🌸

so basically al_get_font_ranges hands you the tea on every single glyph that's chillin' inside a font, and it serves it up as a list of ranges. and the ranges? they use the exact same format as al_grab_font_from_bitmap(3alleg5), so if you already know that one you're already slaying.

here's the breakdown, bestie:

  • ranges_count is the maximum number of ranges that will be returned. it's the cap, the limit, the "that's enough" of it all.
  • ranges needs to be an array with room for ranges_count * 2 elements. and the way the numbers work is giving pattern energy: the even integers are the first unicode point in a range, and the odd integers are the last unicode point in a range. even = start, odd = end. iykyk. πŸŽ€

and the return value? it gives you back the number of ranges contained in the font β€” and yes, even if that number is bigger than ranges_count. so it'll tell you the truth even when your array can't hold the whole truth. iconic honesty fr fr. πŸ’…


⭐ SINCE ⭐

5.1.4


πŸ¦‹ SEE ALSO πŸ¦‹


heads up bestie: if the font has more ranges than ranges_count, you're only getting the first chunk back in your array β€” but the return value still spills the real total. so like, vibe check your buffer sizes. 🫢

that's the whole page, and yes it ate. this was the Allegro reference manual talking about al_get_font_ranges(3alleg5) β€” go forth and range responsibly, main character. πŸ’–βœ¨πŸŒˆ

πŸ“¦ where this page comes from