All Projects → joshuarubin → wcwidth9

joshuarubin / wcwidth9

Licence: other
platform independent, header only, wcwidth with full unicode 9 support

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
Makefile
30231 projects

wcwidth9

platform independent, header only, wcwidth with full unicode 9 support

This code is primarily derived from the neovim project. The tables were produced from parsing the official unicode files EastAsianWidth.txt and emoji-data.txt using genunicodetables.lua.

Simply include wcwidth9.h in your project and use the wcwidth9 function. It works just like wcwidth.

int wcwidth9(int c);

The input value c is expected to be a unicode code point value. The widths returned are according to unicode version 9.0.0.

Return values:

  • 1 or 2: the width of the character
  • -1: non-printable, combining or unassigned character
  • -2: ambiguous width character
  • -3: private-use character

Ambiguous width characters should almost always be considered width 1 except in the context of some East Asian languages as described here.

As private-use characters may not necessarily need to vary depending on East Asian context, but are still considered ambiguous, a separate return value is provided to distinguish them.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].