Functions

tag_from_language(language: Language | None = None) int

Finds the OpenType language-system tag best describing language.

Added in version 1.18.

Parameters:

language – A PangoLanguage

Returns:

PangoOTTag best matching language or %PANGO_OT_TAG_DEFAULT_LANGUAGE if none found or if language is None.

tag_from_script(script: Script) int

Finds the OpenType script tag corresponding to script.

The %PANGO_SCRIPT_COMMON, %PANGO_SCRIPT_INHERITED, and %PANGO_SCRIPT_UNKNOWN scripts are mapped to the OpenType ‘DFLT’ script tag that is also defined as %PANGO_OT_TAG_DEFAULT_SCRIPT.

Note that multiple PangoScript values may map to the same OpenType script tag. In particular, %PANGO_SCRIPT_HIRAGANA and %PANGO_SCRIPT_KATAKANA both map to the OT tag ‘kana’.

Added in version 1.18.

Parameters:

script – A PangoScript

Returns:

PangoOTTag corresponding to script or %PANGO_OT_TAG_DEFAULT_SCRIPT if none found.

tag_to_language(language_tag: int) Language

Finds a PangoLanguage corresponding to language_tag.

Added in version 1.18.

Parameters:

language_tag – A PangoOTTag OpenType language-system tag

Returns:

PangoLanguage best matching language_tag or PangoLanguage corresponding to the string “xx” if none found.

tag_to_script(script_tag: int) Script

Finds the PangoScript corresponding to script_tag.

The ‘DFLT’ script tag is mapped to %PANGO_SCRIPT_COMMON.

Note that an OpenType script tag may correspond to multiple PangoScript values. In such cases, the PangoScript value with the smallest value is returned. In particular, %PANGO_SCRIPT_HIRAGANA and %PANGO_SCRIPT_KATAKANA both map to the OT tag ‘kana’. This function will return %PANGO_SCRIPT_HIRAGANA for ‘kana’.

Added in version 1.18.

Parameters:

script_tag – A PangoOTTag OpenType script tag

Returns:

PangoScript corresponding to script_tag or %PANGO_SCRIPT_UNKNOWN if none found.