ucs_get_width(9)
π ucs_get_width(9) β from the Kernel API Manual, bestie β¨
Okay so real talk, this is a page straight out of the Kernel API Manual and it's genuinely one of the cutest lowkey-useful little functions in the tty/vt corner of the kernel. Like, it just tells you how wide a character is gonna be on your screen. That's it. That's the whole vibe check. And honestly? Iconic. π
πΈ NAME πΈ
ucs_get_width β get the display width of a Unicode code point.
Like, you hand it a code point and it hands you back a number telling you how many columns that thing eats up on a terminal. Fr fr, that's the whole job. π
β¨ SYNOPSIS β¨
unsigned int ucs_get_width (u32 cp );
That's the vibe. One function, one argument, one unsigned int coming back at you. No notes. π
π¦ ARGUMENTS π¦
cpβ the Unicode code point you're asking about, in UCS-4. That's the actual character code, the real deal, the main character of the question you're asking. π«Ά
π₯ RETURN π₯
So the return value is giving "three possible answers and they all mean something":
2β for double-width characters. East Asian Wide/Fullwidth, emoji, that whole squad. The ones that take up two columns and make your terminal go π.0β for zero-width characters. Combining marks, format characters, the invisible girlies who are technically there but take up literally no space. π1β for everything else. That's the common case, bestie. The default. The "yeah this is just a normal character" answer. π
No cap, those are the only three values. Don't go looking for a3. There is no3. π§
π SEE ALSO π
- Kernel file
./drivers/tty/vt/ucs.cβ go read the source, it's right there in the tree π ucs_recompose(9)ucs_get_fallback(9)
Those two are its little friends, they hang out in the same file, they're a package deal. π
okay that's the whole page and honestly it ate π
This one lives in ./drivers/tty/vt and the version/date stamp is October 2026 β so basically remember where you got it and when, mwah π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms