al_utf16_width(3)
β¨ al_utf16_width(3) β¨
okay so bestie, this is a page from the Library Functions Manual and honestly? it's a lil baby page but it's iconic and you're gonna get it immediately, i promise π«Ά
π NAME π
al_utf16_width β the Allegro 5 API function that tells you how wide a code point gets when it's living its UTF-16 truth π
π¦ SYNOPSIS π¦
#include <allegro5/allegro.h>
size_t al_utf16_width(int c)
like, that's the whole vibe. one include, one function, no drama β¨
πΈ DESCRIPTION πΈ
so what this does is: you hand it a code point c, and it tells you the number of bytes that code point would occupy once it's been encoded in UTF-16 π₯
and the tea is, for legal code point values that number is either 2 or 4 bytes. that's it. those are the only two options, queen π
but if it's not a legal code point value? then it returns 0. zero. nothing. the void. π
fr fr, don't forget the 0 case β not every input is gonna be a legal code point, and this function is not about to pretend otherwise. π
π SEE ALSO π
al_utf16_encode(3)β the actual encoding bestie, go say hial_utf8_width(3)β same energy but for UTF-8, slay π
that's the whole page, no cap π§π and it comes to you straight from the Allegro reference manual β mwah, kisses, go write some correct byte-width code and tag me in the group chat when it works π β¨π
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms