al_load_ttf_font_stretch(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_load_ttf_font_stretch πŸ’–

okay bestie, so this one lives in the Allegro 5 reference manual (that's the 3alleg5 situation, iykyk) and it's literally the glow-up version of loading a TTF font β€” except you get to pick your width AND your height separately instead of squishing everything into one single size. main character energy fr fr πŸŽ€


✨ SYNOPSIS ✨

#include <allegro5/allegro_ttf.h>

ALLEGRO_FONT *al_load_ttf_font_stretch(char const *filename, int w, int h,
   int flags)

🌸 DESCRIPTION 🌸

So basically it's giving al_load_ttf_font(3alleg5), but make it custom. The only difference? Instead of handing over one lil size parameter, you pass separate width and height parameters. That's the whole vibe. πŸ’…

Now here's the tea on how the stretching actually works:

  • If the height is a positive value, and the width is zero or positive, then the font gets stretched according to those parameters. slay. πŸ”₯
  • > ⚠️ but bestie, listen β€” the width must NOT be negative if the height is positive. that combo is not it.

And just like its sibling al_load_ttf_font(3alleg5), the height can be a negative value, which means "hey, this is the total height in pixels." Iconic. But the catch:

  • If the height is negative, then the width must also be negative, or zero. no exceptions, no cap. πŸ™ˆ

And when do you just get nothing back? When it returns NULL:

  • if the height is positive while the width is negative 😭
  • or if the height is negative while the width is positive πŸ’€

Those two combos are the vibe check you fail. Don't do them.


⭐ SINCE ⭐

5.0.6, 5.1.0 β€” she's been around a minute, lowkey a legend πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹


k bye bestie, go stretch some fonts and eat πŸ“ β€” this was the Allegro reference manual, al_load_ttf_font_stretch(3alleg5), and yes the whole thing is officially that girl πŸ’–βœ¨

πŸ“¦ where this page comes from