al_get_text_dimensions(3alleg5)
β¨ al_get_text_dimensions β Allegro 5 API β¨
okay bestie, so you know how we're out here in the Allegro 5 API trying to place text exactly where we want it? yeah. this is the girl for that job. π
π SYNOPSIS π
#include <allegro5/allegro_font.h>
void al_get_text_dimensions(const ALLEGRO_FONT *f,
char const *text,
int *bbx, int *bby, int *bbw, int *bbh)
π DESCRIPTION π
so like, sometimes al_get_text_width(3alleg5) and al_get_font_line_height(3alleg5) are justβ¦ not giving enough?? they're iconic, we love them, but if you need exact text placement they lowkey leave you hanging. that's where this function comes in β it returns some additional information so you can actually do the thing. π«Ά
the returned variables (all in pixels, no cap):
- x, y β offset to the upper left corner of the bounding box.
- w, h β dimensions of the bounding box.
β οΈ heads up bestie: glyphs can go to the left and upwards of the X, and when that happens,xandywill be negative values. not a bug, just the vibe. π
π SEE ALSO π
k that's the whole page, you ate it, go place some text perfectly fr fr π
signing off from the Allegro reference manual β this was al_get_text_dimensions(3alleg5), and yes the manual name is right there in the title because we keep it cute and consistent β¨π¦πΈ
π¦ 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