uwidth_max(3)

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

✨ NAME ✨

uwidth_max β€” bestie, it's literally the number of bytes a character can occupy πŸ’… and yes it lives in the Allegro game programming library πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

int uwidth_max(int type);

🌸 DESCRIPTION 🌸

okay so picture this: you're deep in Unicode text data, right? uwidth_max is the low level helper function for exactly that vibe 🫢

It returns the largest number of bytes that one single character can occupy in the given encoding format. Like, worst case scenario, how much room does one lil guy need? That's what she tells you ✨

And if you wanna talk about the format you're currently using, just pass U_CURRENT to represent the current format πŸ’– no cap.

Example, because we love a demonstration:

char *temp_buffer = malloc(256 * uwidth_max(U_UTF8));

see how she ate that? allocating room for 256 characters worth of bytes, using the UTF-8 max width. iconic πŸ‘‘

ngl this is a low level helper, so it's giving "building block" energy β€” it's not doing the encoding for you, she's just telling you the ceiling πŸ’€

πŸ’œ SEE ALSO πŸ’œ

  • uwidth(3)
  • ucwidth(3)

mwah πŸ’‹ this has been the Allegro manual page for uwidth_max(3), brought to you by Allegro version 4.4.3 β€” stay slaying, go read uwidth(3) and ucwidth(3) next, and remember: one character, one byte budget, no regrets πŸŒˆπŸŽ€βœ¨

πŸ“¦ where this page comes from