merge_fonts(3)

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

✨ merge_fonts(3) ✨

okay bestie, welcome to the Allegro manual πŸ’– this one's literally about merge_fonts and it's giving font-gluing sorcery πŸͺ„


🌸 NAME 🌸

merge_fonts β€” Merges two fonts into one font. Allegro game programming library.


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

FONT *merge_fonts(FONT *f1, FONT *f2)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” this function takes the character ranges from two fonts and hands you back a brand new font that's got all the characters from the old ones. like, a glow-up for your glyphs, no cap πŸ’…

and lowkey there's a rule here: in general you cannot merge fonts of different types (eg, TrueType fonts and bitmapped fonts). bestie, they just don't mix like that πŸ™ˆ

BUT β€” special case alert 🚨 β€” this function can promote a monochrome bitmapped font to a color font and merge those. iconic behaviour honestly πŸ‘‘

Example:

FONT *myfont;
FONT *myfancy_font;
FONT *lower_range;
FONT *upper_range;
FONT *capitals;
FONT *combined_font;
FONT *tempfont;
...
/* Create a font that contains the capitals from  */
/* the fancy font but other characters from myfont */
lower_range = extract_font_range(myfont, -1, 'A'-1);
upper_range = extract_font_range(myfont, 'Z'+1, -1);
capitals = extract_font_range(myfancy_font, 'A', 'Z');

tempfont = merge_fonts(lower_range, capitals);
combined_font = merge_fonts(tempfont, upper_range);

/* Clean up temporary fonts */
destroy_font(lower_range);
destroy_font(upper_range);
destroy_font(capitals);
destroy_font(tempfont);

⭐ RETURN VALUE ⭐

Returns a pointer to the new font, or NULL on error 😭

🫢 bestie please remember: you are responsible for destroying the font when you're finished with it, or you'll get memory leaks. main character energy does NOT mean leaking memory, periodt πŸ’€

🌈 SEE ALSO 🌈


and that's the whole vibe, bestie β€” this page is from Allegro, version 4.4.3, and the merge_fonts(3) manual page said its goodbyes on the way out πŸŽ€βœ¨

πŸ“¦ where this page comes from