0

I am working with the Windows Console, some Unicode code points such as / U+0FF0F FULLWIDTH SOLIDUS are two columns wide when printed, is there a way to get the width of the code point when printed? Unix has wcwidth(). C# or winapi ideas would be great.

Many thanks in advance.

Gene
  • 21
  • 3
  • Try to refer to [How to know the preferred display width (in columns) of Unicode characters?](https://stackoverflow.com/questions/3634627/how-to-know-the-preferred-display-width-in-columns-of-unicode-characters) – YangXiaoPo-MSFT Mar 17 '22 at 03:35
  • 1
    wcwidth is just one function implementing a (non-standard) given algorithm. If you want the same behavior, you should just port it to Windows https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c – Simon Mourier Mar 17 '22 at 06:50
  • This question has no answer. It is based on the assumption that rendering each glyph corresponding to a sequence of code points were to produce the same result as rendering the sequence as a whole. This is not the case, with Arabic scripts being a prominent example. The width depends on context. The answer to *"How wide is this glyph?"* is thus: *"It depends."* – IInspectable Mar 17 '22 at 12:50
  • @SimonMourier : Windows Console does not combine chars and everything >= U+E49D8 is two columns wide; otherwise wcwidth() ported to C# on Windows perfectly – correlated with every code point’s printed width. Thanks! ☺ – Gene Mar 18 '22 at 04:24

0 Answers0