al_draw_glyph(3alleg5)
β¨ NAME β¨
al_draw_glyph β bestie, this is part of the Allegro 5 API π
πΈ SYNOPSIS πΈ
#include <allegro5/allegro_font.h>
void al_draw_glyph(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, float x, float y,
int codepoint)
π¦ DESCRIPTION π¦
Okay so here's the tea β: al_draw_glyph draws the one single glyph that corresponds with codepoint, in the color you hand it, using the font f you picked. One glyph. That's the whole job. Iconic behavior, honestly.
And if your font simply doesn't have that glyph? Nothing gets drawn. No drama, no error, no glyph β just vibes and empty space π.
Now, if what you actually want is a string drawn as normal left-to-right horizontal text, you're gonna need al_get_glyph_advance(3alleg5) to figure out where each glyph goes. Literally cannot skip that step, bestie β it's how you know the position of every glyph π«Ά.
And for strings going in other directions β say, top to down (iykyk, vertical text era) β use al_get_glyph_dimensions(3alleg5) to determine the size and the position of each glyph. Two-for-one, we love that π
.
Oh and if you've gotta draw a ton of glyphs all at once? Not me letting you raw-dog the draw calls π. Call al_hold_bitmap_drawing(3alleg5) with true as the parameter before you start drawing the glyphs, then call al_hold_bitmap_drawing(3alleg5) again with false as the parameter when you're done drawing them. That's the performance glow-up, no cap β¨π₯.
β SINCE β
5.1.12 β yeah, she's been around a minute π
π SEE ALSO π
Allegro reference manual π al_draw_glyph(3alleg5) β that's the page name and the source, bestie, so go forth and draw exactly one glyph at a time π§ππΈ
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms