Documentation ¶
Overview ¶
Generator of the mapping from OpenType tags to BCP 47 tags and vice versa.
CLI usage : go run gen.go -local=true -- ../../../typesetting/harfbuzz/ot_language_table.go
It creates an array, matching the tags from the OpenType languages system tag list to the language subtags of the BCP 47 language subtag registry, with some manual adjustments. The mappings are supplemented with macrolanguages sublanguages and retired codes replacements, according to BCP 47 and some manual additions where BCP 47 omits a retired code entirely.
Also generated is a function, `ambiguousTagToLanguage`, intended for use by `hb_ot_tag_to_language`. It maps OpenType tags back to BCP 47 tags. Ambiguous OpenType tags (those that correspond to multiple BCP 47 tags) are listed here, except when the alphabetically first BCP 47 tag happens to be the chosen disambiguated tag. In that case, the fallback behavior will choose the right tag anyway.
Input files: * https://docs.microsoft.com/en-us/typography/opentype/spec/languagetags * https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry