al_draw_glyph(3alleg5)

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

✨ 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