textprintf_justify_ex(3)

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

πŸ’– textprintf_justify_ex β€” Allegro manual, bestie edition πŸ’–

okay so welcome to the textprintf_justify_ex(3) page, part of the Allegro game programming library manual. she's a little niche, she's a little extra, and she's about to make your text look so good. let's get into it 🫢


✨ NAME ✨

textprintf_justify_ex β€” formatted justified output of a string. yep, justified like a fancy magazine, but for your Allegro game. πŸ‘‘


✨ SYNOPSIS ✨

#include <allegro.h>

void textprintf_justify_ex(BITMAP *bmp, const FONT *f, int x1, x2, y,
diff, color, bg, const char *fmt, ...);

✨ DESCRIPTION ✨

so basically it's giving textout_justify_ex() energy, but with a printf()-style format string instead. same girl, different outfit. πŸ’…

heads up bestie: this function shares the text length limitation of textprintf_ex(). no cap, keep that in mind.

Example time, because a vibe check is always better with receipts:

char *lines[] = {"Line %02d: Draws justified text",
                 "Line %02d: within the specified",
                 "Line %02d: x2-x1 area. But not",
                 "Line %02d: T H I S !", NULL};
/* Show the justification marker. */
vline(screen, 300, 0, SCREEN_H-1, makecol(0, 0, 0));
/* Draw all the lines until we reach a NULL entry. */
for (num = 0, y = 0; lines[num]; num++, y += text_height(font))
   textprintf_justify_ex(screen, font, 0, 300, y, 180,
                         makecol(0, 0, 0), makecol(255, 255, 255),
                         lines[num], num);

like… look at her go. lines getting drawn, justification getting justified, NULL entry shutting the whole loop down. iconic behavior honestly 🌸


✨ SEE ALSO ✨


and that's the whole page, bestie β€” no crumbs left πŸ“ this little slice of documentation came to you from Allegro, version 4.4.3, and the page itself goes by textprintf_justify_ex(3). go make something pretty with it πŸ’œβœ¨

πŸ“¦ where this page comes from