OpenTypeLanguage Class
Finds the language systems of the OpenType Layout tables a text in a language can use: the tags a font can have a language system under, for a BCP 47 language tag.
public static class OpenTypeLanguageRemarks
A language system tag of OpenType is not a language code: the registry of the specification ("Language system tags") gives, for each tag, the ISO 639 codes of the languages it is for. One code can have several tags (a language and a group of languages it belongs to, or two written forms of a language), so the result is a list by order of preference: the first tag a font has for the script of the text is the language system that is used, and the default language system of the script is used when the font has none of them.
The table (OpenTypeLanguageTable.g.cs) is transcribed from the registry: for a code, the tag of fewer languages comes first. It is completed with what the language subtag registry of BCP 47 says: a language that belongs to a macrolanguage also has the tags of the macrolanguage, and a deprecated subtag has the tags of the subtag that replaces it. The rules of this file are the ones the codes alone cannot give, each from what the registry says of the tag:
- the tags of the phonetic transcriptions, which the registry relates to the variant subtags
fonipa,fonnapaandfonupa; - the tags of a written form of a language, which are used when the language tag says so and not otherwise: the three forms of the Syriac script (script subtags
Syre,Syrj,Syrn), polytonic Greek (variantpolyton), Khutsuri Georgian (script subtagGeok); - Chinese and the languages it encompasses, whose five tags all have the code of Chinese: the script and the region choose (simplified by default, traditional for
Hantand Taiwan, the tags of Hong Kong and Macao for these regions, the one of Hong Kong for Cantonese and traditional for Literary Chinese when the tag says nothing else, phonetic for a text in Bopomofo or Latin letters); - the Romanian of Moldova (
ro-MD) and the Arabic of Morocco (ary), which have a tag the registry gives no code for, or the code of a subtag that is not used anymore; - two subtags of two letters that name a macrolanguage the registry has no tag for:
nois Norwegian Bokmål andquis the Quechua of Cusco.
A macrolanguage does not get the tags of the languages it encompasses, and the tags BCP 47 keeps from older standards (i-klingon, art-lojban) are not known: both give no tag.
Methods
| Name | Description |
|---|---|
| GetTags(ReadOnlySpan<char>) | Gets the tags of the language systems of a language, by order of preference. |
| IsWellFormed(ReadOnlySpan<char>) | Determines whether a text has the form of a BCP 47 language tag: subtags of one to eight letters and digits separated by hyphens, the first one made of letters. |
GetTags(ReadOnlySpan<char>)
OpenTypeLanguage.csGets the tags of the language systems of a language, by order of preference.
public static uint[] GetTags(ReadOnlySpan<char> languageTag)Parameters
languageTagReadOnlySpan<char>- A well-formed BCP 47 language tag, in any case.
Returns
uint[] The tags; empty when the registry of OpenType has no tag for the language.
IsWellFormed(ReadOnlySpan<char>)
OpenTypeLanguage.csDetermines whether a text has the form of a BCP 47 language tag: subtags of one to eight letters and digits separated by hyphens, the first one made of letters.
public static bool IsWellFormed(ReadOnlySpan<char> languageTag)Parameters
languageTagReadOnlySpan<char>
Returns
Remarks
The subtags are not checked against the registry of subtags: a tag that names nothing gives no language system.