package language
Import Path
github.com/go-text/typesetting/language (on go.dev)
Dependency Relation
imports 5 packages, and imported by 5 packages
Package-Level Type Names (total 5)
LangID is a compact representation of a language
this package has orthographic knowledge of.
The zero value represents a language not known by the package.
( LangID) Language() Language
UseScript returns true if 's' is used to to write the language.
If nothing is known about the language (including if 'lang' is 0),
true will be returned.
func NewLangID(l Language) (LangID, bool)
const LangAa
const LangAb
const LangAf
const LangAgr
const LangAk
const LangAm
const LangAn
const LangAnp
const LangAr
const LangAs
const LangAst
const LangAv
const LangAy
const LangAyc
const LangAz_Az
const LangAz_Ir
const LangBa
const LangBe
const LangBem
const LangBer_Dz
const LangBer_Ma
const LangBg
const LangBh
const LangBhb
const LangBho
const LangBi
const LangBin
const LangBku
const LangBm
const LangBn
const LangBo
const LangBr
const LangBrx
const LangBs
const LangBua
const LangBug
const LangByn
const LangCa
const LangCe
const LangCh
const LangChm
const LangChr
const LangCkb
const LangCmn
const LangCo
const LangCop
const LangCrh
const LangCs
const LangCsb
const LangCu
const LangCv
const LangCy
const LangDa
const LangDe
const LangDoi
const LangDsb
const LangDv
const LangDz
const LangEe
const LangEl
const LangEn
const LangEo
const LangEs
const LangEt
const LangEu
const LangFa
const LangFat
const LangFf
const LangFi
const LangFil
const LangFj
const LangFo
const LangFr
const LangFur
const LangFy
const LangGa
const LangGd
const LangGez
const LangGl
const LangGn
const LangGot
const LangGu
const LangGv
const LangHa
const LangHak
const LangHaw
const LangHe
const LangHi
const LangHif
const LangHne
const LangHnn
const LangHo
const LangHr
const LangHsb
const LangHt
const LangHu
const LangHy
const LangHz
const LangIa
const LangId
const LangIe
const LangIg
const LangIi
const LangIk
const LangIo
const LangIs
const LangIt
const LangIu
const LangJa
const LangJv
const LangKa
const LangKaa
const LangKab
const LangKi
const LangKj
const LangKk
const LangKl
const LangKm
const LangKn
const LangKo
const LangKok
const LangKr
const LangKs
const LangKs_Devanagari
const LangKu_Am
const LangKu_Iq
const LangKu_Ir
const LangKu_Tr
const LangKum
const LangKv
const LangKw
const LangKwm
const LangKy
const LangLa
const LangLah
const LangLb
const LangLez
const LangLg
const LangLi
const LangLij
const LangLn
const LangLo
const LangLt
const LangLv
const LangLzh
const LangMag
const LangMai
const LangMfe
const LangMg
const LangMh
const LangMhr
const LangMi
const LangMiq
const LangMjw
const LangMk
const LangMl
const LangMl_In
const LangMn
const LangMn_Cn
const LangMn_Mn
const LangMni
const LangMnw
const LangMo
const LangMr
const LangMs
const LangMt
const LangMy
const LangNa
const LangNan
const LangNb
const LangNds
const LangNe
const LangNg
const LangNhn
const LangNiu
const LangNl
const LangNn
const LangNo
const LangNqo
const LangNr
const LangNso
const LangNv
const LangNy
const LangOc
const LangOm
const LangOr
const LangOs
const LangOta
const LangPa
const LangPa_Pk
const LangPap_An
const LangPap_Aw
const LangPeo
const LangPes
const LangPl
const LangPrs
const LangPs_Af
const LangPs_Pk
const LangPt
const LangQu
const LangQuz
const LangRaj
const LangRif
const LangRm
const LangRn
const LangRo
const LangRu
const LangRw
const LangSa
const LangSah
const LangSat
const LangSc
const LangSco
const LangSd
const LangSd_Devanagari
const LangSe
const LangSel
const LangSg
const LangSgs
const LangSh
const LangShn
const LangShs
const LangSi
const LangSid
const LangSk
const LangSl
const LangSm
const LangSma
const LangSmj
const LangSmn
const LangSms
const LangSn
const LangSo
const LangSq
const LangSr
const LangSs
const LangSt
const LangSu
const LangSv
const LangSw
const LangSyl
const LangSyr
const LangSzl
const LangTa
const LangTbw
const LangTcy
const LangTe
const LangTg
const LangTh
const LangThe
const LangTi_Er
const LangTi_Et
const LangTig
const LangTk
const LangTl
const LangTn
const LangTo
const LangTpi
const LangTr
const LangTs
const LangTt
const LangTw
const LangTy
const LangTyv
const LangUg
const LangUga
const LangUk
const LangUnd_Zmth
const LangUnd_Zsye
const LangUnm
const LangUr
const LangUz
const LangVe
const LangVi
const LangVo
const LangVot
const LangWa
const LangWae
const LangWal
const LangWen
const LangWo
const LangXh
const LangYap
const LangYi
const LangYo
const LangYue
const LangYuw
const LangZa
const LangZh_Cn
const LangZh_Hk
const LangZh_Mo
const LangZh_Sg
const LangZh_Tw
const LangZu
Language store the canonicalized BCP 47 tag,
which has the generic form <lang>-<country>-<other tags>...
Compare compares `other` and `l`.
Undetermined languages are only compared using the remaining tags,
meaning that "und-fr" and "und-be" are compared as LanguagesDiffer, not
LanguagePrimaryMatch.
IsDerivedFrom returns `true` if `l` has
the `root` as primary
IsUndetermined returns `true` if its primary language is "und".
It is a shortcut for IsDerivedFrom("und").
Primary returns the root language of l, that is
the part before the first '-' separator
SimpleInheritance returns the list of matching language, using simple truncation inheritance.
The resulting slice starts with the given whole
See http://www.unicode.org/reports/tr35/#Locale_Inheritance for more information.
SplitExtensionTags splits the language at the extension and private-use subtags, which are
marked by a "-<one char>-" pattern.
It returns the language before the first pattern, and, if any, the private-use subtag.
(l, "") is returned if the language has no extension or private-use tag.
func DefaultLanguage() Language
func NewLanguage(language string) Language
func LangID.Language() Language
func Language.Primary() Language
func Language.SimpleInheritance() []Language
func Language.SplitExtensionTags() (prefix, private Language)
func github.com/go-text/typesetting/font/opentype/tables.Ltag.Language(i uint16) Language
func NewLangID(l Language) (LangID, bool)
func Language.Compare(other Language) LanguageComparison
func Language.IsDerivedFrom(root Language) bool
LanguageComparison is a three state enum resulting from comparing two languages
func Language.Compare(other Language) LanguageComparison
const LanguagePrimaryMatch
const LanguagesDiffer
const LanguagesExactMatch
Script identifies different writing systems.
It is represented as the binary encoding of a script tag of 4 (case sensitive) letters,
as specified by ISO 15924.
Note that the default value is usually the Unknown script, not the 0 value (which is invalid)
String returns the ISO 4 lower letters code of the script
Strong returns true if the script is not Common or Inherited
Script : expvar.Var
Script : fmt.Stringer
func LookupScript(r rune) Script
func ParseScript(script string) (Script, error)
func LangID.UseScript(s Script) bool
func github.com/go-text/typesetting/internal/unicodedata.LookupVerticalOrientation(s Script) unicodedata.ScriptVerticalOrientation
func github.com/go-text/typesetting/shaping.FontmapScript.SetScript(Script)
const Adlam
const Afaka
const Ahom
const Anatolian_Hieroglyphs
const Arabic
const Armenian
const Avestan
const Balinese
const Bamum
const Bassa_Vah
const Batak
const Bengali
const Beria_Erfe
const Bhaiksuki
const Blissymbols
const Book_Pahlavi
const Bopomofo
const Brahmi
const Braille
const Buginese
const Buhid
const Canadian_Aboriginal
const Carian
const Caucasian_Albanian
const Chakma
const Cham
const Cherokee
const Chisoi
const Chorasmian
const Cirth
const Code_for_unwritten_documents
const Common
const Coptic
const Cuneiform
const Cypriot
const Cypro_Minoan
const Cyrillic
const Deseret
const Devanagari
const Dives_Akuru
const Dogra
const Duployan
const Egyptian_demotic
const Egyptian_hieratic
const Egyptian_Hieroglyphs
const Elbasan
const Elymaic
const Ethiopic
const Garay
const Georgian
const Glagolitic
const Gothic
const Grantha
const Greek
const Gujarati
const Gunjala_Gondi
const Gurmukhi
const Gurung_Khema
const Han
const Hangul
const Hanifi_Rohingya
const Hanunoo
const Hatran
const Hebrew
const Hiragana
const Imperial_Aramaic
const Inherited
const Inscriptional_Pahlavi
const Inscriptional_Parthian
const Javanese
const Jurchen
const Kaithi
const Kannada
const Katakana
const Katakana_Or_Hiragana
const Kawi
const Kayah_Li
const Kharoshthi
const Khitan_large_script
const Khitan_Small_Script
const Khmer
const Khojki
const Khudawadi
const Kirat_Rai
const Kpelle
const Lao
const Latin
const Leke
const Lepcha
const Limbu
const Linear_A
const Linear_B
const Lisu
const Loma
const Lycian
const Lydian
const Mahajani
const Makasar
const Malayalam
const Mandaic
const Manichaean
const Marchen
const Masaram_Gondi
const Mathematical_notation
const Mayan_hieroglyphs
const Medefaidrin
const Meetei_Mayek
const Mende_Kikakui
const Meroitic_Cursive
const Meroitic_Hieroglyphs
const Miao
const Modi
const Mongolian
const Mro
const Multani
const Myanmar
const Nabataean
const Nag_Mundari
const Nandinagari
const New_Tai_Lue
const Newa
const Nko
const Nushu
const Nyiakeng_Puachue_Hmong
const Ogham
const Ol_Chiki
const Ol_Onal
const Old_Hungarian
const Old_Italic
const Old_North_Arabian
const Old_Permic
const Old_Persian
const Old_Sogdian
const Old_South_Arabian
const Old_Turkic
const Old_Uyghur
const Oriya
const Osage
const Osmanya
const Pahawh_Hmong
const Palmyrene
const Pau_Cin_Hau
const Phags_Pa
const Phoenician
const Psalter_Pahlavi
const Ranjana
const Rejang
const Rongorongo
const Runic
const Samaritan
const Sarati
const Saurashtra
const Sharada
const Shavian
const Shuishu
const Siddham
const Sidetic
const SignWriting
const Sinhala
const Sogdian
const Sora_Sompeng
const Soyombo
const Sundanese
const Sunuwar
const Syloti_Nagri
const Symbols
const Syriac
const Tagalog
const Tagbanwa
const Tai_Le
const Tai_Tham
const Tai_Viet
const Tai_Yo
const Takri
const Tamil
const Tangsa
const Tangut
const Telugu
const Tengwar
const Thaana
const Thai
const Tibetan
const Tifinagh
const Tirhuta
const Todhri
const Tolong_Siki
const Toto
const Tulu_Tigalari
const Ugaritic
const Unknown
const Vai
const Visible_Speech
const Vithkuqi
const Wancho
const Warang_Citi
const Woleai
const Yezidi
const Yi
const Zanabazar_Square
Package-Level Functions (total 5)
DefaultLanguage returns the language found in environment variables LC_ALL, LC_CTYPE or
LANG (in that order), or the zero value if not found.
LookupScript looks up the script for a particular character (as defined by
Unicode Standard Annex #24), and returns Unknown if not found.
NewLangID returns the compact index of the given language,
or false if it is not supported by this package.
Derived languages not exactly supported are mapped to their primary part : for instance,
'fr-be' is mapped to 'fr'
NewLanguage canonicalizes the language input (as a BCP 47 language tag), by converting it to
lowercase, mapping '_' to '-', and stripping all characters other
than letters, numbers and '-'.
ParseScript converts a 4 bytes string into its binary encoding,
enforcing the conventional capitalized case.
If [script] is longer, only its 4 first bytes are used.
Package-Level Variables (total 2)
ScriptRanges is a sorted list of script ranges.
ScriptToLang maps a script to a language that is reasonably
representative of the script. This will usually be the
most widely spoken or used language written in that script:
for instance, the sample language for `Cyrillic`
is 'ru' (Russian), the sample language for `Arabic` is 'ar'.
For some scripts, no sample language will be returned because there
is no language that is sufficiently representative. The best
example of this is `Han`, where various different
variants of written Chinese, Japanese, and Korean all use
significantly different sets of Han characters and forms
of shared characters. No sample language can be provided
for many historical scripts as well.
inspired by pango/pango-language.c
Package-Level Constants (total 496)
const Anatolian_Hieroglyphs Script = 1215067511 // Hluw const Beria_Erfe Script = 1113944678 // Berf const Blissymbols Script = 1114401139 // Blis const Book_Pahlavi Script = 1349020790 // Phlv const Canadian_Aboriginal Script = 1130458739 // Cans const Caucasian_Albanian Script = 1097295970 // Aghb const Chorasmian Script = 1130918515 // Chrs const Code_for_unwritten_documents Script = 1517844600 // Zxxx const Cypro_Minoan Script = 1131441518 // Cpmn const Devanagari Script = 1147500129 // Deva const Dives_Akuru Script = 1147756907 // Diak const Egyptian_demotic Script = 1164409188 // Egyd const Egyptian_hieratic Script = 1164409192 // Egyh const Egyptian_Hieroglyphs Script = 1164409200 // Egyp const Glagolitic Script = 1198285159 // Glag const Gunjala_Gondi Script = 1198485095 // Gong const Gurung_Khema Script = 1198877544 // Gukh const Hanifi_Rohingya Script = 1383032935 // Rohg const Imperial_Aramaic Script = 1098018153 // Armi const Inscriptional_Pahlavi Script = 1349020777 // Phli const Inscriptional_Parthian Script = 1349678185 // Prti const Katakana_Or_Hiragana Script = 1215458164 // Hrkt const Kharoshthi Script = 1265131890 // Khar const Khitan_large_script Script = 1265202284 // Kitl const Khitan_Small_Script Script = 1265202291 // Kits const LangBer_Dz LangID = 20 const LangBer_Ma LangID = 21 const LangKs_Devanagari LangID = 287 const LangPap_An LangID = 185 const LangPap_Aw LangID = 186 const LangSd_Devanagari LangID = 291 const LanguagePrimaryMatch LanguageComparison = 2 // the two languages have the same primary language, but differs. const LanguagesDiffer LanguageComparison = 0 // the two languages are totally differents const LanguagesExactMatch LanguageComparison = 1 // the two languages are exactly the same const LangUnd_Zmth LangID = 257 const LangUnd_Zsye LangID = 258 const Manichaean Script = 1298230889 // Mani const Masaram_Gondi Script = 1198485101 // Gonm const Mathematical_notation Script = 1517122664 // Zmth const Mayan_hieroglyphs Script = 1298233697 // Maya const Medefaidrin Script = 1298490470 // Medf const Meetei_Mayek Script = 1299473769 // Mtei const Mende_Kikakui Script = 1298493028 // Mend const Meroitic_Cursive Script = 1298494051 // Merc const Meroitic_Hieroglyphs Script = 1298494063 // Mero const Nag_Mundari Script = 1315006317 // Nagm const Nandinagari Script = 1315008100 // Nand const New_Tai_Lue Script = 1415670901 // Talu const Nyiakeng_Puachue_Hmong Script = 1215131248 // Hmnp const Old_Hungarian Script = 1215655527 // Hung const Old_Italic Script = 1232363884 // Ital const Old_North_Arabian Script = 1315009122 // Narb const Old_Permic Script = 1348825709 // Perm const Old_Persian Script = 1483761007 // Xpeo const Old_Sogdian Script = 1399809903 // Sogo const Old_South_Arabian Script = 1398895202 // Sarb const Old_Turkic Script = 1332898664 // Orkh const Old_Uyghur Script = 1333094258 // Ougr const Pahawh_Hmong Script = 1215131239 // Hmng const Pau_Cin_Hau Script = 1348564323 // Pauc const Phoenician Script = 1349021304 // Phnx const Psalter_Pahlavi Script = 1349020784 // Phlp const Rongorongo Script = 1383035503 // Roro const Saurashtra Script = 1398895986 // Saur const SignWriting Script = 1399287415 // Sgnw const Sora_Sompeng Script = 1399812705 // Sora const Syloti_Nagri Script = 1400466543 // Sylo const Tolong_Siki Script = 1416588403 // Tols const Tulu_Tigalari Script = 1416983655 // Tutg const Visible_Speech Script = 1449751408 // Visp const Warang_Citi Script = 1466004065 // Wara const Zanabazar_Square Script = 1516334690 // Zanb
![]() |
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. |