Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ check if unicode character is full width

How to check if a unicode character is full width?

I use Win32 / MFC

For example, is full width, A is not full width, is full width, F is not full width.

like image 502
linquize Avatar asked Dec 18 '13 14:12

linquize


1 Answers

What you need is to retrieve the East Asian Width of the character. You can do it by parsing the EastAsianWidth.txt file from the Unicode Character Database. I could not find a Win32 API that returns this info, but in Python, for example, you can use unicodedata.east_asian_width(unichr).

See the Annex #11 for the background of the problem and more information.

like image 66
Igor Skochinsky Avatar answered Oct 21 '22 09:10

Igor Skochinsky