extract_font_range(3)

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

✨ extract_font_range(3) ✨

okay bestie, welcome to the Allegro manual πŸ’– this one's a lil page about extract_font_range, a function from the Allegro game programming library, and it is genuinely so useful it's giving main character energy πŸ‘‘


πŸŽ€ NAME πŸŽ€

extract_font_range β€” bestie, this one extracts a range of characters from a font. part of the Allegro game programming library, iykyk πŸ¦‹


🌸 SYNOPSIS 🌸

#include <allegro.h>

FONT *extract_font_range(FONT *f, int begin, int end)

like, that's the whole vibe check. three args, one font back πŸ’…


πŸ’– DESCRIPTION πŸ’–

so here's the tea β˜• β€” this function grabs a character range out of a font and hands you back a brand new font that contains only the range of characters you picked. not a copy of everything, just the lil slice you asked for. obsessed ✨

and here's the cute part: you can pass -1 for either the lower or the upper bound if you want to select all characters from the start of the font or to the end of it. so flexible, so iconic 🫢

Example, because seeing it is believing:

FONT *myfont;
FONT *capitals;
FONT *fontcopy;
...
/* Create a font of only capital letters */
capitals = extract_font_range(myfont, 'A', 'Z');

/* Create a copy of the font */
fontcopy = extract_font_range(myfont, -1, -1);
...
destroy_font(capitals);
destroy_font(fontcopy);

not me using -1, -1 to just clone the whole font 😭 iconic behaviour honestly.


⭐ RETURN VALUE ⭐

Returns a pointer to the new font, or NULL on error πŸ’€

and now the part where I hold your hand: remember that you are responsible for destroying the font when you are finished with it to avoid memory leaks πŸ™ˆ like, destroy_font it, bestie. don't leave it hanging. no cap. leaking memory is not the vibe 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

go read those too, they're all part of the same little font friend group πŸŽ€


Allegro version 4.4.3 β€” that's the source and version tag, and this page is dated extract_font_range(3), so that's the whole lore 🫢 thanks for reading bestie, go make some fonts, slay, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from