Documentation ¶
Overview ¶
package width provides methods to get text width defined by unicode east asisn width. see http://unicode.org/reports/tr11/
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Default = NewCondition(runewidth.EastAsianWidth)
default Condition which can calucate east asian width depended on running system environment. you can check your system's east asian condition using by:
isEastAsian = Default.IsEastAsian
Functions ¶
func BytesWidth ¶
return unicode east asian width in given bytes, using default condition. It will panic if the bytes is invalid utf8 encoding.
func RuneWidth ¶
return unicode east asian width in a rune, using default condition. It will panic if the rune is invalid.
func StringWidth ¶
return unicode east asian width in given string, using default condition. It will panic if the string is invalid utf8 encoding.
Types ¶
type Condition ¶
type Condition struct { IsEastAsian bool // contains filtered or unexported fields }
Condition holds isEastAsian flag and can calucate east asian width using that flag. zero value of Condition can not use .RuneWidth(), but other methods can do.
func (Condition) BytesWidth ¶
return unicode east asian width in given bytes. it will panic if the bytes is invalid utf8 encoding.
func (Condition) StringWidth ¶
same as BytesWidth exception that input type is string.