ClickHouse/base/widechar_width
Robert Schulze b79ead9c84
Move poco to base/poco/ (#46075)
* Replicate poco into base/poco/

* De-register poco submodule

* Build poco from ClickHouse

* Exclude poco from stylecheck

* Exclude poco from whitespace check

* Exclude poco from typo check

* Remove x bit from sources/headers (the style check complained)

* Exclude poco from duplicate include check

* Fix fasttest

* Remove contrib/poco-cmake/*

* Simplify poco build descriptions

* Remove poco stuff not used by ClickHouse

* Glob poco sources

* Exclude poco from clang-tidy
2023-02-08 12:04:11 +01:00
..
CMakeLists.txt Move poco to base/poco/ (#46075) 2023-02-08 12:04:11 +01:00
LICENSE Move contrib/widecharwidth → base/widechar_width 2020-04-13 18:55:48 +03:00
README.md Move contrib/widecharwidth → base/widechar_width 2020-04-13 18:55:48 +03:00
widechar_width.cpp Move contrib/widecharwidth → base/widechar_width 2020-04-13 18:55:48 +03:00
widechar_width.h More clang-tidy fixes 2022-06-28 11:50:05 +00:00

url: https://github.com/ridiculousfish/widecharwidth commit: 62edda3d435392bf84c7db59f01f53370bbb1715

widecharwidth is a Python script that outputs a C++11 header-only implementation of wcwidth(), by downloading and parsing the latest UnicodeData.txt, EastAsianWidth.txt, and emoji-data.txt.

Usage

You may directly copy and use the included widechar_width.h.

This header contains a single public function widechar_wcwidth(). This returns either a positive width value (1 or 2), or a negative value such as widechar_private_use. Note that there are several possible negative return values, to distinguish among different scenarios.

If you aren't sure how to handle negative return values, try this table:

return value width
widechar_nonprint 0
widechar_combining 0
widechar_ambiguous 1
widechar_private_use 1
widechar_unassigned 0
widechar_widened_in_9 2 (or maybe 1, renderer dependent)

Regenerating the header

To regenerate the header, run make. This will download and parse the relevant files, and run tests.

License

widecharwidth and its output headers are released into the public domain. They may be used for any purpose without requiring attribution, or under the CC0 license if public domain is not available. See included LICENSE.