merge_fonts(3alleg4)
π merge_fonts β the Allegro manual, but make it cute π
okay bestie, so we're in the Allegro manual (3alleg4) and today's main character is merge_fonts. it's a function. it's in the Allegro game programming library. let's get into it π«Ά
β¨ NAME β¨
merge_fonts β Merges two fonts into one font. Allegro game programming library. two fonts walk in, one font walks out π
πΈ SYNOPSIS πΈ
#include <allegro.h>
FONT *merge_fonts(FONT *f1, FONT *f2)
yes the include is literally just #include <allegro.h>, that's the whole vibe π
π¦ DESCRIPTION π¦
so what this function does is merge the character ranges from two fonts and hand you back a brand new font that's got all the characters from both of the old ones. like combining two playlists into one ultimate playlist, no cap π
now here's the tea: in general you cannot merge fonts of different types (eg, TrueType fonts and bitmapped fonts) β they don't mix, it's giving oil and water π. BUT. as a special case, this function can promote a monochrome bitmapped font to a color font and merge those. so that one specific glow-up is allowed β¨
example time:
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);
look at that β capitals from the fancy font, everything else from myfont, all stitched together. iconic behaviour, honestly π
π RETURN VALUE π
Returns a pointer to the new font, or NULL on error. and bestie, listen: you are responsible for destroying the font when you're done with it, so you don't leak memory. the cleanup is not optional, it's a lifestyle π§Ήπ
not you forgetting to destroy_font and leaking memory all over the place... couldn't be you, right? π
π SEE ALSO π
extract_font_range(3alleg4)is_trans_font(3alleg4)is_color_font(3alleg4)is_mono_font(3alleg4)exfont(3alleg4)
and that's the whole page, bestie π
this was Allegro, version 4.4.3, and the page you just read is merge_fonts(3alleg4). go forth and merge those fonts, you absolute font-merging legend πβ¨π¦
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms