module UnicodeCharWidth
Overview
Provides methods to get fixed width of the unicode character or string.
Defined in:
charwidth/charwidth.crcharwidth/eastasian.cr
charwidth/table.cr
uniwidth.cr
Constant Summary
-
NEW_LINE =
"\n"
-
VERSION =
"0.1.2"
Class Method Summary
-
.ambiguous?(codepoint : Int32)
returns whether is ambiguous width or not EastAsian Ambiguous characters that can be sometimes wide and sometimes narrow and require additional information not contained in the character code to further resolve their width.
-
.ambiguous?(char : Char)
returns whether char is ambiguous width or not EastAsian Ambiguous characters that can be sometimes wide and sometimes narrow and require additional information not contained in the character code to further resolve their width.
-
.default_condition
DefaultCondition is a condition in current locale
-
.east_asian?
return true if the current locale is CJK
-
.neutral?(codepoint : Int32)
returns whether is neutral width or not Neutral characters do not occur in legacy East Asian character sets.
-
.neutral?(char : Char)
returns whether char is neutral width or not Neutral characters do not occur in legacy East Asian character sets.
-
.pad_left(str : String, w : Int32)
returns a string filled in left by spaces in
w
cells -
.pad_right(str : String, w : Int32)
returns a string filled in right by spaces in
w
cells -
.truncate(str : String, w : Int32, tail : String)
return string truncated with
w
cells -
.width(codepoint : Int32)
returns the number of cells in codepoint see http://www.unicode.org/reports/tr11/
-
.width(char : Char)
return the number of cells in `char'
-
.width(str : String)
returns string width
-
.wrap(str : String, w : Int32)
returns a string wrapped with
w
cells
Class Method Detail
returns whether is ambiguous width or not EastAsian Ambiguous characters that can be sometimes wide and sometimes narrow and require additional information not contained in the character code to further resolve their width.
returns whether char is ambiguous width or not EastAsian Ambiguous characters that can be sometimes wide and sometimes narrow and require additional information not contained in the character code to further resolve their width.
returns whether is neutral width or not Neutral characters do not occur in legacy East Asian character sets.
returns whether char is neutral width or not Neutral characters do not occur in legacy East Asian character sets.
returns the number of cells in codepoint see http://www.unicode.org/reports/tr11/