Source File
ot_language.go
Belonging Package
github.com/go-text/typesetting/harfbuzz
package harfbuzzimport ()type langTag struct {language stringtag tables.Tag}// return -1 if `a` < `l`func ( *langTag) ( string) int {:= .language:= strings.IndexByte(, '-')// da := len(a)if != -1 {// da = p= [:]}= strings.IndexByte(, '-')// db := len(b)if != -1 {// db = p= [:]}// L := min(min(len(a), len(b)), max(da, db))return strings.Compare(, )}func bfindLanguage( string) int {, := 0, len(otLanguages)for <= {:= ( + ) / 2:= &otLanguages[]:= .compare()if < 0 {= - 1} else if > 0 {= + 1} else {return}}return -1}func subtagMatches( string, string) bool {:= len()if len() < {return false}for {:= strings.Index(, )if == -1 {return false}if + >= len() || !isAlnum([+]) {return true}= [+:]}}func langMatches(, string) bool {:= len()return strings.HasPrefix(, ) && (len() == || [] == '-')}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |