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

The type of the None singleton.

ANATOLIAN_HIEROGLYPHS

The type of the None singleton.

ARABIC

The type of the None singleton.

ARMENIAN

The type of the None singleton.

BALINESE

The type of the None singleton.

BASSA_VAH

The type of the None singleton.

BATAK

The type of the None singleton.

BENGALI

The type of the None singleton.

BOPOMOFO

The type of the None singleton.

BRAHMI

The type of the None singleton.

BRAILLE

The type of the None singleton.

BUGINESE

The type of the None singleton.

BUHID

The type of the None singleton.

CANADIAN_ABORIGINAL

The type of the None singleton.

CARIAN

The type of the None singleton.

CAUCASIAN_ALBANIAN

The type of the None singleton.

CHAKMA

The type of the None singleton.

CHAM

The type of the None singleton.

CHEROKEE

The type of the None singleton.

COMMON

The type of the None singleton.

COPTIC

The type of the None singleton.

CUNEIFORM

The type of the None singleton.

CYPRIOT

The type of the None singleton.

CYRILLIC

The type of the None singleton.

DESERET

The type of the None singleton.

DEVANAGARI

The type of the None singleton.

DUPLOYAN

The type of the None singleton.

ELBASAN

The type of the None singleton.

ETHIOPIC

The type of the None singleton.

GEORGIAN

The type of the None singleton.

GLAGOLITIC

The type of the None singleton.

GOTHIC

The type of the None singleton.

GRANTHA

The type of the None singleton.

GREEK

The type of the None singleton.

GUJARATI

The type of the None singleton.

GURMUKHI

The type of the None singleton.

HAN

The type of the None singleton.

HANGUL

The type of the None singleton.

HANUNOO

The type of the None singleton.

HATRAN

The type of the None singleton.

HEBREW

The type of the None singleton.

HIRAGANA

The type of the None singleton.

INHERITED

The type of the None singleton.

INVALID_CODE

The type of the None singleton.

KANNADA

The type of the None singleton.

KATAKANA

The type of the None singleton.

KAYAH_LI

The type of the None singleton.

KHAROSHTHI

The type of the None singleton.

KHMER

The type of the None singleton.

KHOJKI

The type of the None singleton.

KHUDAWADI

The type of the None singleton.

LAO

The type of the None singleton.

LATIN

The type of the None singleton.

LEPCHA

The type of the None singleton.

LIMBU

The type of the None singleton.

LINEAR_A

The type of the None singleton.

LINEAR_B

The type of the None singleton.

LYCIAN

The type of the None singleton.

LYDIAN

The type of the None singleton.

MAHAJANI

The type of the None singleton.

MALAYALAM

The type of the None singleton.

MANDAIC

The type of the None singleton.

MANICHAEAN

The type of the None singleton.

MENDE_KIKAKUI

The type of the None singleton.

MEROITIC_CURSIVE

The type of the None singleton.

MEROITIC_HIEROGLYPHS

The type of the None singleton.

MIAO

The type of the None singleton.

MODI

The type of the None singleton.

MONGOLIAN

The type of the None singleton.

MRO

Return a type’s method resolution order.

MULTANI

The type of the None singleton.

MYANMAR

The type of the None singleton.

NABATAEAN

The type of the None singleton.

NEW_TAI_LUE

The type of the None singleton.

NKO

The type of the None singleton.

OGHAM

The type of the None singleton.

OLD_HUNGARIAN

The type of the None singleton.

OLD_ITALIC

The type of the None singleton.

OLD_NORTH_ARABIAN

The type of the None singleton.

OLD_PERMIC

The type of the None singleton.

OLD_PERSIAN

The type of the None singleton.

OL_CHIKI

The type of the None singleton.

ORIYA

The type of the None singleton.

OSMANYA

The type of the None singleton.

PAHAWH_HMONG

The type of the None singleton.

PALMYRENE

The type of the None singleton.

PAU_CIN_HAU

The type of the None singleton.

PHAGS_PA

The type of the None singleton.

PHOENICIAN

The type of the None singleton.

PSALTER_PAHLAVI

The type of the None singleton.

REJANG

The type of the None singleton.

RUNIC

The type of the None singleton.

SAURASHTRA

The type of the None singleton.

SHARADA

The type of the None singleton.

SHAVIAN

The type of the None singleton.

SIDDHAM

The type of the None singleton.

SIGNWRITING

The type of the None singleton.

SINHALA

The type of the None singleton.

SORA_SOMPENG

The type of the None singleton.

SUNDANESE

The type of the None singleton.

SYLOTI_NAGRI

The type of the None singleton.

SYRIAC

The type of the None singleton.

TAGALOG

The type of the None singleton.

TAGBANWA

The type of the None singleton.

TAI_LE

The type of the None singleton.

TAKRI

The type of the None singleton.

TAMIL

The type of the None singleton.

TELUGU

The type of the None singleton.

THAANA

The type of the None singleton.

THAI

The type of the None singleton.

TIBETAN

The type of the None singleton.

TIFINAGH

The type of the None singleton.

TIRHUTA

The type of the None singleton.

UGARITIC

The type of the None singleton.

UNKNOWN

The type of the None singleton.

VAI

The type of the None singleton.

WARANG_CITI

The type of the None singleton.

YI

The type of the None singleton.