text_height(3alleg4)
π text_height π
okay bestie so this is text_height from the Allegro game programming library β it's a 3alleg4 manual page and it's literally the simplest little glow-up of a function. it tells you how tall a font is, in pixels. that's it. that's the whole vibe. and yet?? you need it. every single time. π
β¨ NAME β¨
text_height β returns the height of a font in pixels. Allegro game programming library. no cap, that's the entire job description π
πΈ SYNOPSIS πΈ
#include <allegro.h>
int text_height(const FONT *f)
she's short, she's sweet, she takes one (1) argument and gives you a number. main character energy fr fr π¦
π«Ά DESCRIPTION π«Ά
so like. you hand her a font β the specified font, f β and she hands you back the height in pixels. that's the whole deal. it's giving "trust me bestie, you're gonna need this number in like five seconds."
and here's why you need it: fonts are not all the same size, and if you're about to make a bitmap to draw text into, you can't just guess. you ask. like this:
int height = text_height(font);
...
bmp = create_bitmap(width, height);
see?? she's feeding height straight into create_bitmap. iconic behaviour honestly. π
ngl this is the kind of function that seems boring until you hardcode a font height and everything is visibly wrong on someone else's machine. ask the font. she knows her own height. periodt.
π₯ SEE ALSO π₯
go read these next bestie, they're all in the same friend group:
text_length(3alleg4)β the horizontal bestie to this vertical one πex12bit(3alleg4)exmidi(3alleg4)expackf(3alleg4)expat(3alleg4)exsprite(3alleg4)exsyscur(3alleg4)exunicod(3alleg4)
and that's the page!! mwah π this one's from Allegro, version 4.4.3, and the page itself is text_height(3alleg4). stay tall, stay pixel-accurate, and go measure a font. i'm obsessed with you. bye!! πβ¨π¦π
π¦ 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