A .NET library that calculates the width of Unicode characters.
Перейти к файлу
Patrik Svensson a57f43b716 Rename Wcwidth class to UnicodeCalculator
Also cleans up GetWidth method a bit.
2020-09-17 10:22:34 +02:00
.github Remove GitHub Actions step for docs 2020-09-16 14:38:17 +02:00
scripts Rename Wcwidth class to UnicodeCalculator 2020-09-17 10:22:34 +02:00
src Rename Wcwidth class to UnicodeCalculator 2020-09-17 10:22:34 +02:00
.editorconfig Rename Wcwidth class to UnicodeCalculator 2020-09-17 10:22:34 +02:00
.gitignore Initial commit 2020-09-16 14:32:37 +02:00
LICENSE.md Initial commit 2020-09-16 14:32:37 +02:00
README.md Rename Wcwidth class to UnicodeCalculator 2020-09-17 10:22:34 +02:00
build.cake Initial commit 2020-09-16 14:32:37 +02:00
dotnet-tools.json Initial commit 2020-09-16 14:32:37 +02:00
global.json Initial commit 2020-09-16 14:32:37 +02:00

README.md

Wcwidth

This is a port of the Python port written by Jeff Quast, which originally was written by Markus Kuhn.

Usage

using Wcwidth;

// Get the width
var width = UnicodeCalculator.GetWidth('コ');

// It should be 2 cells wide
Debug.Assert(width == 2);

Building

We're using Cake as a dotnet tool for building. So make sure that you've restored Cake by running the following in the repository root:

> dotnet tool restore

After that, running the build is as easy as writing:

> dotnet cake

Acknowledgement

This code is a port of https://github.com/jquast/wcwidth, licensed under MIT.

This code was originally derived directly from C code of the same name, whose latest version is available at http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c:

* Markus Kuhn -- 2007-05-26 (Unicode 5.0)
* Permission to use, copy, modify, and distribute this software
* for any purpose and without fee is hereby granted. The author
* disclaims all warranties with regard to this software.