uwidth(3alleg4)

✨ NAME ✨

okay so bestie, this is uwidth from the Allegro manual (that's the 3alleg4 section, iykyk) β€” it's a low level helper function for testing Unicode text data. it also lives in the Allegro game programming library, so yeah, it's giving gamedev Unicode energy πŸ’–


🌸 SYNOPSIS 🌸

#include <allegro.h>

int uwidth(const char *s);

πŸ¦‹ DESCRIPTION πŸ¦‹

low level helper function for testing Unicode text data. that's literally the whole vibe β€” it's a lil baby utility that hangs out down in the weeds so the higher-level Unicode stuff can do its thing 🫢


πŸ’… RETURN VALUE πŸ’…

it returns the number of bytes occupied by the first character of the string you passed in, measured in the current encoding format. so like, not the whole string, bestie β€” just the first character, and in bytes, not characters. slay ✨

heads up: "current encoding format" is doing a lot of heavy lifting in that sentence, so if the numbers look weird to you, check what encoding you're actually in before you spiral 😭

πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group, fr fr:

  • uwidth_max (3alleg4)
  • ugetc (3alleg4)
  • ugetx (3alleg4)
  • usetc (3alleg4)
  • ucwidth (3alleg4)
  • uisok (3alleg4)

and that's the whole page, periodt πŸ’– this was brought to you by Allegro, version 4.4.3 β€” go forth and measure your first Unicode character's byte width, main character energy only πŸŒˆβ­πŸŽ€