transpose_font(3alleg4)

πŸ’– transpose_font πŸ’–

ok so real talk β€” this is transpose_font from the Allegro manual, aka the Allegro game programming library. and bestie, it's giving font-glow-up energy ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

int transpose_font(FONT *f, int drange)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” transpose_font takes every single character in a font and transposes them all, which basically remaps the whole font. like a whole personality transplant for your glyphs, no cap πŸ’…

example time, because iykyk:

FONT *myfont;
FONT *capitals;
...
/* Create a font of only capital letters */
capitals = extract_font_range(myfont, 'A', 'Z');

/* Now transpose the characters in the font so that they will be used */
/*  for the lower case letters a-z */
transpose_font(capitals, 'a'-'A');
textout_ex(screen, capitals, "allcaps",
           100, 100, makecol(255,255,255), 0);

see how that works? you pull out just the capitals with extract_font_range(myfont, 'A', 'Z'), then transpose_font(capitals, 'a'-'A') shifts everything over so those capital glyphs get used for the lowercase letters a-z instead. iconic behaviour honestly πŸ‘‘


⭐ RETURN VALUE ⭐

  • returns 0 when it ate πŸ’… (success)
  • returns -1 when it did not eat 😭 (failure)

🌈 SEE ALSO 🌈


k bye bestie, go transpose some fonts πŸ’œ this was transpose_font(3alleg4) from the Allegro manual, version 4.4.3 β€” mwah, drink water, and remember that even fonts deserve a fresh start 🫢✨