Script

class Script

The PangoScript enumeration identifies different writing systems.

The values correspond to the names as defined in the Unicode standard. See Unicode Standard Annex 24: Script names

Note that this enumeration is deprecated and will not be updated to include values in newer versions of the Unicode standard. Applications should use the UnicodeScript enumeration instead, whose values are interchangeable with PangoScript.

Methods

class Script
for_unichar(ch: str) Script

Looks up the script for a particular character.

The script of a character is defined by Unicode Standard Annex 24: Script names.

No check is made for ch being a valid Unicode character; if you pass in invalid character, the result is undefined.

Note that while the return type of this function is declared as PangoScript, as of Pango 1.18, this function simply returns the return value of unichar_get_script. Callers must be prepared to handle unknown values.

Added in version 1.4.

Deprecated since version 1.44.: Use unichar_get_script()

Parameters:

ch – a Unicode character

get_sample_language(script: Script) Language | None

Finds a language tag that is reasonably representative of script.

The language 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.

As of 1.18, this function checks the environment variables PANGO_LANGUAGE and LANGUAGE (checked in that order) first. If one of them is set, it is parsed as a list of language tags separated by colons or other separators. This function will return the first language in the parsed list that Pango believes may use script for writing. This last predicate is tested using includes_script. This can be used to control Pango’s font selection for non-primary languages. For example, a PANGO_LANGUAGE enviroment variable set to “en:fa” makes Pango choose fonts suitable for Persian (fa) instead of Arabic (ar) when a segment of Arabic text is found in an otherwise non-Arabic text. The same trick can be used to choose a default language for HAN when setting context language is not feasible.

Added in version 1.4.

Parameters:

script – a PangoScript

Fields

class Script
AHOM

Ahom. Since: 1.40

ANATOLIAN_HIEROGLYPHS

Anatolian Hieroglyphs. Since: 1.40

ARABIC

Arabic

ARMENIAN

Armenian

BALINESE

Balinese. Since 1.14

BASSA_VAH

Bassa. Since: 1.40

BATAK

Batak. Since 1.32

BENGALI

Bengali

BOPOMOFO

Bopomofo

BRAHMI

Brahmi. Since 1.32

BRAILLE

Braille

BUGINESE

Buginese. Since 1.10

BUHID

Buhid

CANADIAN_ABORIGINAL

Canadian Aboriginal

CARIAN

Carian. Since 1.20.1

CAUCASIAN_ALBANIAN

Caucasian Albanian. Since: 1.40

CHAKMA

Chakma. Since: 1.32

CHAM

Cham. Since 1.20.1

CHEROKEE

Cherokee

COMMON

A character used by multiple different scripts

COPTIC

Coptic

CUNEIFORM

Cuneiform. Since 1.14

CYPRIOT

Cypriot

CYRILLIC

Cyrillic

DESERET

Deseret

DEVANAGARI

Devanagari

DUPLOYAN

Duployan. Since: 1.40

ELBASAN

Elbasan. Since: 1.40

ETHIOPIC

Ethiopic

GEORGIAN

Georgian

GLAGOLITIC

Glagolitic. Since 1.10

GOTHIC

Gothic

GRANTHA

Grantha. Since: 1.40

GREEK

Greek

GUJARATI

Gujarati

GURMUKHI

Gurmukhi

HAN

Han

HANGUL

Hangul

HANUNOO

Hanunoo

HATRAN

Hatran. Since: 1.40

HEBREW

Hebrew

HIRAGANA

Hiragana

INHERITED

A mark glyph that takes its script from the base glyph to which it is attached

INVALID_CODE

A value never returned from pango_script_for_unichar()

KANNADA

Kannada

KATAKANA

Katakana

KAYAH_LI

Kayah Li. Since 1.20.1

KHAROSHTHI

Kharoshthi. Since 1.10

KHMER

Khmer

KHOJKI

Kjohki. Since: 1.40

KHUDAWADI

Khudawadi, Sindhi. Since: 1.40

LAO

Lao

LATIN

Latin

LEPCHA

Lepcha. Since 1.20.1

LIMBU

Limbu

LINEAR_A

Linear A. Since: 1.40

LINEAR_B

Linear B

LYCIAN

Lycian. Since 1.20.1

LYDIAN

Lydian. Since 1.20.1

MAHAJANI

Mahajani. Since: 1.40

MALAYALAM

Malayalam

MANDAIC

Mandaic. Since 1.32

MANICHAEAN

Manichaean. Since: 1.40

MENDE_KIKAKUI

Mende Kikakui. Since: 1.40

MEROITIC_CURSIVE

Meroitic Cursive. Since: 1.32

MEROITIC_HIEROGLYPHS

Meroitic Hieroglyphs. Since: 1.32

MIAO

Miao. Since: 1.32

MODI

Modi. Since: 1.40

MONGOLIAN

Mongolian

MRO

Return a type’s method resolution order.

MULTANI

Multani. Since: 1.40

MYANMAR

Myanmar

NABATAEAN

Nabataean. Since: 1.40

NEW_TAI_LUE

New Tai Lue. Since 1.10

NKO

N’Ko. Since 1.14

OGHAM

Ogham

OLD_HUNGARIAN

Old Hungarian. Since: 1.40

OLD_ITALIC

Old Italic

OLD_NORTH_ARABIAN

Old North Arabian. Since: 1.40

OLD_PERMIC

Old Permic. Since: 1.40

OLD_PERSIAN

Old Persian. Since 1.10

OL_CHIKI

Ol Chiki. Since 1.20.1

ORIYA

Oriya

OSMANYA

Osmanya

PAHAWH_HMONG

Pahawh Hmong. Since: 1.40

PALMYRENE

Palmyrene. Since: 1.40

PAU_CIN_HAU

Pau Cin Hau. Since: 1.40

PHAGS_PA

Phags-pa. Since 1.14

PHOENICIAN

Phoenician. Since 1.14

PSALTER_PAHLAVI

Psalter Pahlavi. Since: 1.40

REJANG

Rejang. Since 1.20.1

RUNIC

Runic

SAURASHTRA

Saurashtra. Since 1.20.1

SHARADA

Sharada. Since: 1.32

SHAVIAN

Shavian

SIDDHAM

Siddham. Since: 1.40

SIGNWRITING

Signwriting. Since: 1.40

SINHALA

Sinhala

SORA_SOMPENG

Sora Sompeng. Since: 1.32

SUNDANESE

Sundanese. Since 1.20.1

SYLOTI_NAGRI

Syloti Nagri. Since 1.10

SYRIAC

Syriac

TAGALOG

Tagalog

TAGBANWA

Tagbanwa

TAI_LE

Tai Le

TAKRI

Takri. Since: 1.32

TAMIL

Tamil

TELUGU

Telugu

THAANA

Thaana

THAI

Thai

TIBETAN

Tibetan

TIFINAGH

Tifinagh. Since 1.10

TIRHUTA

Tirhuta. Since: 1.40

UGARITIC

Ugaritic

UNKNOWN

An unassigned code point. Since 1.14

VAI

Vai. Since 1.20.1

WARANG_CITI

Warang Citi. Since: 1.40

YI

Yi