:right-sidebar: True
Script
===================================================================
.. currentmodule:: gi.repository.Pango
.. class:: Script
:no-contents-entry:
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
:obj:`~gi.repository.GLib.UnicodeScript` enumeration instead,
whose values are interchangeable with ``PangoScript``.
Methods
-------
.. rst-class:: interim-class
.. class:: Script
:no-index:
.. method:: for_unichar(ch: str) -> ~gi.repository.Pango.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 :obj:`~gi.repository.GLib.unichar_get_script`. Callers must be
prepared to handle unknown values.
.. versionadded:: 1.4
.. deprecated:: 1.44.
Use :func:`~gi.repository.GLib.unichar_get_script`
:param ch: a Unicode character
.. method:: get_sample_language(script: ~gi.repository.Pango.Script) -> ~gi.repository.Pango.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
:const:`~gi.repository.Pango.Script.CYRILLIC` is ru (Russian), the sample language for
:const:`~gi.repository.Pango.Script.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 :const:`~gi.repository.Pango.Script.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 :obj:`~gi.repository.Pango.Language.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 :const:`~gi.repository.Pango.Script.HAN` when setting
context language is not feasible.
.. versionadded:: 1.4
:param script: a ``PangoScript``
Fields
------
.. rst-class:: interim-class
.. class:: Script
:no-index:
.. attribute:: AHOM
Ahom. Since: 1.40
.. attribute:: ANATOLIAN_HIEROGLYPHS
Anatolian Hieroglyphs. Since: 1.40
.. attribute:: ARABIC
Arabic
.. attribute:: ARMENIAN
Armenian
.. attribute:: BALINESE
Balinese. Since 1.14
.. attribute:: BASSA_VAH
Bassa. Since: 1.40
.. attribute:: BATAK
Batak. Since 1.32
.. attribute:: BENGALI
Bengali
.. attribute:: BOPOMOFO
Bopomofo
.. attribute:: BRAHMI
Brahmi. Since 1.32
.. attribute:: BRAILLE
Braille
.. attribute:: BUGINESE
Buginese. Since 1.10
.. attribute:: BUHID
Buhid
.. attribute:: CANADIAN_ABORIGINAL
Canadian Aboriginal
.. attribute:: CARIAN
Carian. Since 1.20.1
.. attribute:: CAUCASIAN_ALBANIAN
Caucasian Albanian. Since: 1.40
.. attribute:: CHAKMA
Chakma. Since: 1.32
.. attribute:: CHAM
Cham. Since 1.20.1
.. attribute:: CHEROKEE
Cherokee
.. attribute:: COMMON
A character used by multiple different scripts
.. attribute:: COPTIC
Coptic
.. attribute:: CUNEIFORM
Cuneiform. Since 1.14
.. attribute:: CYPRIOT
Cypriot
.. attribute:: CYRILLIC
Cyrillic
.. attribute:: DESERET
Deseret
.. attribute:: DEVANAGARI
Devanagari
.. attribute:: DUPLOYAN
Duployan. Since: 1.40
.. attribute:: ELBASAN
Elbasan. Since: 1.40
.. attribute:: ETHIOPIC
Ethiopic
.. attribute:: GEORGIAN
Georgian
.. attribute:: GLAGOLITIC
Glagolitic. Since 1.10
.. attribute:: GOTHIC
Gothic
.. attribute:: GRANTHA
Grantha. Since: 1.40
.. attribute:: GREEK
Greek
.. attribute:: GUJARATI
Gujarati
.. attribute:: GURMUKHI
Gurmukhi
.. attribute:: HAN
Han
.. attribute:: HANGUL
Hangul
.. attribute:: HANUNOO
Hanunoo
.. attribute:: HATRAN
Hatran. Since: 1.40
.. attribute:: HEBREW
Hebrew
.. attribute:: HIRAGANA
Hiragana
.. attribute:: INHERITED
A mark glyph that takes its script from the
base glyph to which it is attached
.. attribute:: INVALID_CODE
A value never returned from pango_script_for_unichar()
.. attribute:: KANNADA
Kannada
.. attribute:: KATAKANA
Katakana
.. attribute:: KAYAH_LI
Kayah Li. Since 1.20.1
.. attribute:: KHAROSHTHI
Kharoshthi. Since 1.10
.. attribute:: KHMER
Khmer
.. attribute:: KHOJKI
Kjohki. Since: 1.40
.. attribute:: KHUDAWADI
Khudawadi, Sindhi. Since: 1.40
.. attribute:: LAO
Lao
.. attribute:: LATIN
Latin
.. attribute:: LEPCHA
Lepcha. Since 1.20.1
.. attribute:: LIMBU
Limbu
.. attribute:: LINEAR_A
Linear A. Since: 1.40
.. attribute:: LINEAR_B
Linear B
.. attribute:: LYCIAN
Lycian. Since 1.20.1
.. attribute:: LYDIAN
Lydian. Since 1.20.1
.. attribute:: MAHAJANI
Mahajani. Since: 1.40
.. attribute:: MALAYALAM
Malayalam
.. attribute:: MANDAIC
Mandaic. Since 1.32
.. attribute:: MANICHAEAN
Manichaean. Since: 1.40
.. attribute:: MENDE_KIKAKUI
Mende Kikakui. Since: 1.40
.. attribute:: MEROITIC_CURSIVE
Meroitic Cursive. Since: 1.32
.. attribute:: MEROITIC_HIEROGLYPHS
Meroitic Hieroglyphs. Since: 1.32
.. attribute:: MIAO
Miao. Since: 1.32
.. attribute:: MODI
Modi. Since: 1.40
.. attribute:: MONGOLIAN
Mongolian
.. attribute:: MRO
Return a type's method resolution order.
.. attribute:: MULTANI
Multani. Since: 1.40
.. attribute:: MYANMAR
Myanmar
.. attribute:: NABATAEAN
Nabataean. Since: 1.40
.. attribute:: NEW_TAI_LUE
New Tai Lue. Since 1.10
.. attribute:: NKO
N'Ko. Since 1.14
.. attribute:: OGHAM
Ogham
.. attribute:: OLD_HUNGARIAN
Old Hungarian. Since: 1.40
.. attribute:: OLD_ITALIC
Old Italic
.. attribute:: OLD_NORTH_ARABIAN
Old North Arabian. Since: 1.40
.. attribute:: OLD_PERMIC
Old Permic. Since: 1.40
.. attribute:: OLD_PERSIAN
Old Persian. Since 1.10
.. attribute:: OL_CHIKI
Ol Chiki. Since 1.20.1
.. attribute:: ORIYA
Oriya
.. attribute:: OSMANYA
Osmanya
.. attribute:: PAHAWH_HMONG
Pahawh Hmong. Since: 1.40
.. attribute:: PALMYRENE
Palmyrene. Since: 1.40
.. attribute:: PAU_CIN_HAU
Pau Cin Hau. Since: 1.40
.. attribute:: PHAGS_PA
Phags-pa. Since 1.14
.. attribute:: PHOENICIAN
Phoenician. Since 1.14
.. attribute:: PSALTER_PAHLAVI
Psalter Pahlavi. Since: 1.40
.. attribute:: REJANG
Rejang. Since 1.20.1
.. attribute:: RUNIC
Runic
.. attribute:: SAURASHTRA
Saurashtra. Since 1.20.1
.. attribute:: SHARADA
Sharada. Since: 1.32
.. attribute:: SHAVIAN
Shavian
.. attribute:: SIDDHAM
Siddham. Since: 1.40
.. attribute:: SIGNWRITING
Signwriting. Since: 1.40
.. attribute:: SINHALA
Sinhala
.. attribute:: SORA_SOMPENG
Sora Sompeng. Since: 1.32
.. attribute:: SUNDANESE
Sundanese. Since 1.20.1
.. attribute:: SYLOTI_NAGRI
Syloti Nagri. Since 1.10
.. attribute:: SYRIAC
Syriac
.. attribute:: TAGALOG
Tagalog
.. attribute:: TAGBANWA
Tagbanwa
.. attribute:: TAI_LE
Tai Le
.. attribute:: TAKRI
Takri. Since: 1.32
.. attribute:: TAMIL
Tamil
.. attribute:: TELUGU
Telugu
.. attribute:: THAANA
Thaana
.. attribute:: THAI
Thai
.. attribute:: TIBETAN
Tibetan
.. attribute:: TIFINAGH
Tifinagh. Since 1.10
.. attribute:: TIRHUTA
Tirhuta. Since: 1.40
.. attribute:: UGARITIC
Ugaritic
.. attribute:: UNKNOWN
An unassigned code point. Since 1.14
.. attribute:: VAI
Vai. Since 1.20.1
.. attribute:: WARANG_CITI
Warang Citi. Since: 1.40
.. attribute:: YI
Yi