textout_justify_ex(3)

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

πŸ’– textout_justify_ex πŸ’–

okay bestie, so this one lives in the Allegro manual, it's a section 3 page, and it's literally called textout_justify_ex β€” say that three times fast, I dare you. it's from the Allegro game programming library, and it's giving justified text energy ✨


✨ SYNOPSIS ✨

#include <allegro.h>

void textout_justify_ex(BITMAP *bmp, const FONT *f, const char *s, int
x1, int x2, int y, int diff, int color, int bg);

🌸 DESCRIPTION 🌸

so what it does is: it draws justified text inside the region x1-x2. periodt. πŸ’…

but here's the tea πŸ«– β€” if the amount of spare space is greater than the diff value, it does NOT fight it. it just gives up and draws regular left justified text instead. like, it knows when to fold, and honestly? respect. 😌

check the example, it's iconic:

char *lines[] = {"Draws justified text",
                 "within the specified",
                 "x2-x1 area. But not",
                 "T H I S !", NULL};
/* Show the justification marker. */
vline(screen, 200, 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))
   textout_justify_ex(screen, font, lines[num], 0, 200,
                      y, 80, makecol(0, 0, 0),
                      makecol(255, 255, 255));

see how "T H I S !" never gets stretched? that's the diff doing its little job. no cap. πŸ”₯


πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie!! πŸŽ€ this was pulled straight from Allegro, version 4.4.3, and the page itself goes by textout_justify_ex(3). go justify some text, you absolute main character πŸ‘‘πŸ’–

πŸ“¦ where this page comes from