ucs_get_width(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 a 3. There is no 3. 🧚

πŸ‘‘ SEE ALSO πŸ‘‘

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