package runewidth
import "zgo.at/runewidth"
Index ¶
- Variables
- func CreateLUT()
- func IsAmbiguousWidth(r rune) bool
- func IsEastAsian() bool
- func IsNeutralWidth(r rune) bool
- func RuneWidth(r rune) int
- type Condition
Variables ¶
var ( // EastAsianWidth will be set true if the current locale is CJK EastAsianWidth bool // StrictEmojiNeutral should be set false if handle broken fonts StrictEmojiNeutral bool = true // DefaultCondition is a condition in current locale DefaultCondition = &Condition{ EastAsianWidth: false, StrictEmojiNeutral: true, } )
Functions ¶
func CreateLUT ¶
func CreateLUT()
CreateLUT will create an in-memory lookup table of 557055 bytes for faster operation. This should not be called concurrently with other operations.
func IsAmbiguousWidth ¶
IsAmbiguousWidth returns whether is ambiguous width or not.
func IsEastAsian ¶
func IsEastAsian() bool
IsEastAsian return true if the current locale is CJK
func IsNeutralWidth ¶
IsNeutralWidth returns whether is neutral width or not.
func RuneWidth ¶
RuneWidth returns the number of cells in r. See http://www.unicode.org/reports/tr11/
Types ¶
type Condition ¶
type Condition struct { EastAsianWidth bool StrictEmojiNeutral bool // contains filtered or unexported fields }
Condition have flag EastAsianWidth whether the current locale is CJK or not.
func NewCondition ¶
func NewCondition() *Condition
NewCondition return new instance of Condition which is current locale.
func (*Condition) CreateLUT ¶
func (c *Condition) CreateLUT()
CreateLUT will create an in-memory lookup table of 557056 bytes for faster operation. This should not be called concurrently with other operations on c. If options in c is changed, CreateLUT should be called again.
func (*Condition) RuneWidth ¶
RuneWidth returns the number of cells in r. See http://www.unicode.org/reports/tr11/
Source Files ¶
runewidth.go runewidth_posix.go runewidth_table.go
Directories ¶
Path | Synopsis |
---|---|
script |
- Version
- v0.1.0 (latest)
- Published
- May 22, 2024
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 13 hours ago –
Tools for package owners.