func countGlyphs(s []rune) int {
	n := 0
	for _, r := range s {
		if r < 127 {
			n++
			continue
		}
		switch {
		case unicode.IsOneOf(zeroWidth, r):
		case unicode.IsOneOf(doubleWidth, r):
			n += 2
		default:
			n++
		}
	}
	return n
}
countGlyphs considers zero-width characters to be zero glyphs wide,
and members of Chinese, Japanese, and Korean scripts to be 2 glyphs wide.
package liner
import "unicode"
var zeroWidth = []*unicode.RangeTable{
	unicode.Mn,
	unicode.Me,
	unicode.Cc,
	unicode.Cf,
}
var doubleWidth = []*unicode.RangeTable{
	unicode.Han,
	unicode.Hangul,
	unicode.Hiragana,
	unicode.Katakana,
}