module UnicodeCharWidth

Overview

Provides methods to get fixed width of the unicode character or string.

Defined in:

charwidth/charwidth.cr
charwidth/eastasian.cr
charwidth/table.cr
uniwidth.cr

Constant Summary

NEW_LINE = "\n"
VERSION = "0.1.2"

Class Method Summary

Class Method Detail

def self.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.


[View source]
def self.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.


[View source]
def self.default_condition #

DefaultCondition is a condition in current locale


[View source]
def self.east_asian? #

return true if the current locale is CJK


[View source]
def self.neutral?(codepoint : Int32) #

returns whether is neutral width or not Neutral characters do not occur in legacy East Asian character sets.


[View source]
def self.neutral?(char : Char) #

returns whether char is neutral width or not Neutral characters do not occur in legacy East Asian character sets.


[View source]
def self.pad_left(str : String, w : Int32) #

returns a string filled in left by spaces in w cells


[View source]
def self.pad_right(str : String, w : Int32) #

returns a string filled in right by spaces in w cells


[View source]
def self.truncate(str : String, w : Int32, tail : String) #

return string truncated with w cells


[View source]
def self.width(codepoint : Int32) #

returns the number of cells in codepoint see http://www.unicode.org/reports/tr11/


[View source]
def self.width(char : Char) #

return the number of cells in `char'


[View source]
def self.width(str : String) #

returns string width


[View source]
def self.wrap(str : String, w : Int32) #

returns a string wrapped with w cells


[View source]