Which different widths of code points regarding the print column do exist, supposed an `a` has width of print column `1`?

StackOverflow https://stackoverflow.com/questions/11598364

Question

Which different widths of code points regarding the print column do exist, supposed an a (\N{LATIN SMALL LETTER A}) has width of print column 1?

Edit:

"print column width" refers to the output to a terminal

Was it helpful?

Solution

In Unicode, characters can be nonspacing (0 columns), narrow (1 column) or wide (2 columns). You can get the number of columns a string would take using the method columns from GCString, or mbswidth from Text::CharWidth.

Of course, this only works for monospaced output, e.g: output to a terminal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top