text_height(3)

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

✨ text_height β€” like, the height of a font, bestie ✨

okay so real quick, this one lives in the Allegro manual (section 3, the library-call girlies πŸ’…), and it's genuinely one of the most useful little functions you'll ever meet. no cap.


πŸŽ€ NAME πŸŽ€

text_height β€” returns the height of a font in pixels. part of the Allegro game programming library, and yes she's iconic for it.


🌸 SYNOPSIS 🌸

#include <allegro.h>

int text_height(const FONT *f)

πŸ’– DESCRIPTION πŸ’–

so basically: she hands you back the height (in pixels, obviously πŸ’…) of whatever font you point her at. that's it. that's the whole vibe. one number, zero drama.

like, say you've got a font and you need to know how tall it's gonna render so you can size a bitmap around it β€” this is literally the function for that. example time, watch:

int height = text_height(font);
...
bmp = create_bitmap(width, height);

see how she slotted height straight into create_bitmap? that's the whole point. main character energy fr fr. 🫢


πŸ¦‹ SEE ALSO πŸ¦‹


ngl if you're measuring text and you don't check both text_height and text_length, that's a vibe check you're failing. 😭

okay bye ily, this page came to you from Allegro, version 4.4.3 β€” and text_height(3) says mwah, go build something cute πŸ’œπŸŒΈπŸ§š

πŸ“¦ where this page comes from