c++unicodeprintfutf-16le

UTF-16LE Halfwidth vs Fullwidth? The meaning?


I have custom print functions I use to print numbers. I made an ASCII version and a UTF-16LE version. The UTF-16LE version uses the Fullwidth codes/characters for 0-9 and A-F for hexadecimal. When debugging my functions I noticed the characters looked a little different in Visual Studio than the ASCII characters, and while this didn't bother me, it got me thinking about it. So I decided to do a quick google search for "Unicode halfwidth vs fullwidth"

... And I found several pages that talk about the "Fullwidth" form referring to the Visual width of the characters, while I thought "Fullwidth" referred to the width of the encoding (2 Bytes or more)...

Here are a few pages and quotes from them:

It doesn't make sense to me that "Fullwidth" would refer to the visual width, when we have different Fonts for size and alignment.

Why does "Fullwidth" refer to the visual width? Where in the Unicode UTF-16 spec does it say this?

Is having the choice to output as Halfwidth or Fullwidth using flags be desirable?


Solution

  • You found your own answers to the origination of fullwidth vs. halfwidth so I won't get into that. Yes, the designation refers to the visual width of the characters. Sorry but I don't have any official reference for that.

    One of the goals of Unicode is to handle round-trip conversions from/to any legacy character set without loss. Since there are legacy character sets with fullwidth characters, they must also be part of Unicode or they would get converted incorrectly.

    I find it hard to imagine a circumstance in modern code where you would want a choice between normal and fullwidth characters. It's really only for legacy support.