Provides width properties of East Asian Characters.
This package is port of Unicode::EastAsianWidth from Perl to Go.
https://godoc.org/github.com/moznion/go-unicode-east-asian-width
go get github.com/moznion/go-unicode-east-asian-width
import (
"unicode"
"github.com/moznion/go-unicode-east-asian-width"
)
func main() {
eastasianwidth.IsFullwidth('世') // true
eastasianwidth.IsHalfwidth('界') // false
eastasianwidth.IsHalfwidth('w') // true
unicode.Is(eastasianwidth.EastAsianWide, '禅') // true
}
EastAsian bool
EastAsian is the flag for ambiguous character.
If this flag is true
, ambiguous characters are treated as full width.
Elsewise, ambiguous characters are treated as half width.
Default value is false
.
EastAsianAmbiguous unicode.RangeTable
EastAsianFullwidth unicode.RangeTable
EastAsianHalfwidth unicode.RangeTable
EastAsianNarrow unicode.RangeTable
EastAsianNeutral unicode.RangeTable
EastAsianWide unicode.RangeTable
Fullwidth unicode.RangeTable
Halfwidth unicode.RangeTable
RangeTable for East Asian characters.
func Fullwidth() map[string]*unicode.RangeTable
Returns the map of RangeTable of full width East Asian characters.
func Halfwidth() map[string]*unicode.RangeTable
Returns the map of RangeTable of half width East Asian characters.
func IsFullwidth(r rune) bool
Reports whether the rune is in range of full width character of East Asian.
func IsHalfwidth(r rune) bool
Reports whether the rune is in range of half width character of East Asian.
MIT