Enums

Details

class Pango.Alignment(value)

Bases: GObject.GEnum

A Pango.Alignment describes how to align the lines of a Pango.Layout within the available space. If the Pango.Layout is set to justify using Pango.Layout.set_justify(), this only has effect for partial lines.

LEFT = 0

Put all available space on the right

CENTER = 1

Center the line within the available space

RIGHT = 2

Put all available space on the left

class Pango.AttrType(value)

Bases: GObject.GEnum

The Pango.AttrType distinguishes between different types of attributes. Along with the predefined values, it is possible to allocate additional values for custom attributes using Pango.AttrType.register(). The predefined values are given below. The type of structure used to store the attribute is listed in parentheses after the description.

classmethod get_name(type)[source]
Parameters:type (Pango.AttrType) – an attribute type ID to fetch the name for
Returns:the type ID name (which may be None), or None if type is a built-in Pango attribute type or invalid.
Return type:str or None

Fetches the attribute type name passed in when registering the type using Pango.AttrType.register().

The returned value is an interned string (see GLib.intern_string() for what that means) that should not be modified or freed.

New in version 1.22.

classmethod register(name)[source]
Parameters:name (str) – an identifier for the type
Returns:the new type ID.
Return type:Pango.AttrType

Allocate a new attribute type ID. The attribute type name can be accessed later by using Pango.AttrType.get_name().

INVALID = 0

does not happen

LANGUAGE = 1

language (Pango.AttrLanguage)

BACKGROUND = 10

background color (Pango.AttrColor)

UNDERLINE = 11

whether the text has an underline (Pango.AttrInt)

STRIKETHROUGH = 12

whether the text is struck-through (Pango.AttrInt)

RISE = 13

baseline displacement (Pango.AttrInt)

SHAPE = 14

shape (Pango.AttrShape)

SCALE = 15

font size scale factor (Pango.AttrFloat)

FALLBACK = 16

whether fallback is enabled (Pango.AttrInt)

LETTER_SPACING = 17

letter spacing (Pango.AttrInt)

UNDERLINE_COLOR = 18

underline color (Pango.AttrColor)

STRIKETHROUGH_COLOR = 19

strikethrough color (Pango.AttrColor)

FAMILY = 2

font family name list (Pango.AttrString)

ABSOLUTE_SIZE = 20

font size in pixels scaled by Pango.SCALE (Pango.AttrInt)

GRAVITY = 21

base text gravity (Pango.AttrInt)

GRAVITY_HINT = 22

gravity hint (Pango.AttrInt)

FONT_FEATURES = 23

OpenType font features (Pango.AttrString).

New in version 1.38.

FOREGROUND_ALPHA = 24

foreground alpha (Pango.AttrInt).

New in version 1.38.

BACKGROUND_ALPHA = 25

background alpha (Pango.AttrInt).

New in version 1.38.

STYLE = 3

font slant style (Pango.AttrInt)

WEIGHT = 4

font weight (Pango.AttrInt)

VARIANT = 5

font variant (normal or small caps) (Pango.AttrInt)

STRETCH = 6

font stretch (Pango.AttrInt)

SIZE = 7

font size in points scaled by Pango.SCALE (Pango.AttrInt)

FONT_DESC = 8

font description (Pango.AttrFontDesc)

FOREGROUND = 9

foreground color (Pango.AttrColor)

class Pango.BidiType(value)

Bases: GObject.GEnum

The Pango.BidiType type represents the bidirectional character type of a Unicode character as specified by the

Unicode bidirectional algorithm.

New in version 1.22.

classmethod for_unichar(ch)[source]
Parameters:ch (str) – a Unicode character
Returns:the bidirectional character type, as used in the Unicode bidirectional algorithm.
Return type:Pango.BidiType

Determines the normative bidirectional character type of a character, as specified in the Unicode Character Database.

A simplified version of this function is available as Pango.unichar_direction().

New in version 1.22.

L = 0

Left-to-Right

LRE = 1

Left-to-Right Embedding

ET = 10

European Number Terminator

AN = 11

Arabic Number

CS = 12

Common Number Separator

NSM = 13

Nonspacing Mark

BN = 14

Boundary Neutral

B = 15

Paragraph Separator

S = 16

Segment Separator

WS = 17

Whitespace

ON = 18

Other Neutrals

LRO = 2

Left-to-Right Override

R = 3

Right-to-Left

AL = 4

Right-to-Left Arabic

RLE = 5

Right-to-Left Embedding

RLO = 6

Right-to-Left Override

PDF = 7

Pop Directional Format

EN = 8

European Number

ES = 9

European Number Separator

class Pango.CoverageLevel(value)

Bases: GObject.GEnum

Used to indicate how well a font can represent a particular Unicode character point for a particular script.

NONE = 0

The character is not representable with the font.

FALLBACK = 1

The character is represented in a way that may be comprehensible but is not the correct graphical form. For instance, a Hangul character represented as a a sequence of Jamos, or a Latin transliteration of a Cyrillic word.

APPROXIMATE = 2

The character is represented as basically the correct graphical form, but with a stylistic variant inappropriate for the current script.

EXACT = 3

The character is represented as the correct graphical form.

class Pango.Direction(value)

Bases: GObject.GEnum

The Pango.Direction type represents a direction in the Unicode bidirectional algorithm; not every value in this enumeration makes sense for every usage of Pango.Direction; for example, the return value of Pango.unichar_direction() and Pango.find_base_dir() cannot be Pango.Direction.WEAK_LTR or Pango.Direction.WEAK_RTL, since every character is either neutral or has a strong direction; on the other hand Pango.Direction.NEUTRAL doesn’t make sense to pass to Pango.itemize_with_base_dir().

The Pango.Direction.TTB_LTR, Pango.Direction.TTB_RTL values come from an earlier interpretation of this enumeration as the writing direction of a block of text and are no longer used; See Pango.Gravity for how vertical text is handled in Pango.

LTR = 0

A strong left-to-right direction

RTL = 1

A strong right-to-left direction

TTB_LTR = 2

Deprecated value; treated the same as Pango.Direction.RTL.

TTB_RTL = 3

Deprecated value; treated the same as Pango.Direction.LTR

WEAK_LTR = 4

A weak left-to-right direction

WEAK_RTL = 5

A weak right-to-left direction

NEUTRAL = 6

No direction specified

class Pango.EllipsizeMode(value)

Bases: GObject.GEnum

The Pango.EllipsizeMode type describes what sort of (if any) ellipsization should be applied to a line of text. In the ellipsization process characters are removed from the text in order to make it fit to a given width and replaced with an ellipsis.

NONE = 0

No ellipsization

START = 1

Omit characters at the start of the text

MIDDLE = 2

Omit characters in the middle of the text

END = 3

Omit characters at the end of the text

class Pango.Gravity(value)

Bases: GObject.GEnum

The Pango.Gravity type represents the orientation of glyphs in a segment of text. This is useful when rendering vertical text layouts. In those situations, the layout is rotated using a non-identity Pango.Matrix, and then glyph orientation is controlled using Pango.Gravity. Not every value in this enumeration makes sense for every usage of Pango.Gravity; for example, Pango.Gravity.AUTO only can be passed to Pango.Context.set_base_gravity() and can only be returned by Pango.Context.get_base_gravity().

See also: Pango.GravityHint

New in version 1.16.

classmethod get_for_matrix(matrix)[source]
Parameters:matrix (Pango.Matrix or None) – a Pango.Matrix
Returns:the gravity of matrix, which will never be Pango.Gravity.AUTO, or Pango.Gravity.SOUTH if matrix is None
Return type:Pango.Gravity

Finds the gravity that best matches the rotation component in a Pango.Matrix.

New in version 1.16.

classmethod get_for_script(script, base_gravity, hint)[source]
Parameters:
Returns:

resolved gravity suitable to use for a run of text with script.

Return type:

Pango.Gravity

Based on the script, base gravity, and hint, returns actual gravity to use in laying out a single Pango.Item.

If base_gravity is Pango.Gravity.AUTO, it is first replaced with the preferred gravity of script. To get the preferred gravity of a script, pass Pango.Gravity.AUTO and Pango.GravityHint.STRONG in.

New in version 1.16.

classmethod get_for_script_and_width(script, wide, base_gravity, hint)[source]
Parameters:
Returns:

resolved gravity suitable to use for a run of text with script and wide.

Return type:

Pango.Gravity

Based on the script, East Asian width, base gravity, and hint, returns actual gravity to use in laying out a single character or Pango.Item.

This function is similar to Pango.Gravity.get_for_script() except that this function makes a distinction between narrow/half-width and wide/full-width characters also. Wide/full-width characters always stand upright, that is, they always take the base gravity, whereas narrow/full-width characters are always rotated in vertical context.

If base_gravity is Pango.Gravity.AUTO, it is first replaced with the preferred gravity of script.

New in version 1.26.

classmethod to_rotation(gravity)[source]
Parameters:gravity (Pango.Gravity) – gravity to query
Returns:the rotation value corresponding to gravity.
Return type:float

Converts a Pango.Gravity value to its natural rotation in radians. gravity should not be Pango.Gravity.AUTO.

Note that Pango.Matrix.rotate() takes angle in degrees, not radians. So, to call Pango.Matrix.rotate() with the output of this function you should multiply it by (180. / GLib.PI).

New in version 1.16.

SOUTH = 0

Glyphs stand upright (default)

EAST = 1

Glyphs are rotated 90 degrees clockwise

NORTH = 2

Glyphs are upside-down

WEST = 3

Glyphs are rotated 90 degrees counter-clockwise

AUTO = 4

Gravity is resolved from the context matrix

class Pango.GravityHint(value)

Bases: GObject.GEnum

The Pango.GravityHint defines how horizontal scripts should behave in a vertical context. That is, English excerpt in a vertical paragraph for example.

See Pango.Gravity.

New in version 1.16.

NATURAL = 0

scripts will take their natural gravity based on the base gravity and the script. This is the default.

STRONG = 1

always use the base gravity set, regardless of the script.

LINE = 2

for scripts not in their natural direction (eg. Latin in East gravity), choose per-script gravity such that every script respects the line progression. This means, Latin and Arabic will take opposite gravities and both flow top-to-bottom for example.

class Pango.RenderPart(value)

Bases: GObject.GEnum

Pango.RenderPart defines different items to render for such purposes as setting colors.

New in version 1.8.

FOREGROUND = 0

the text itself

BACKGROUND = 1

the area behind the text

UNDERLINE = 2

underlines

STRIKETHROUGH = 3

strikethrough lines

class Pango.Script(value)

Bases: GObject.GEnum

The Pango.Script enumeration identifies different writing systems. The values correspond to the names as defined in the Unicode standard. Note that new types may be added in the future. Applications should be ready to handle unknown values. This enumeration is interchangeable with GLib.UnicodeScript. See Unicode Standard Annex #24: Script names.

classmethod for_unichar(ch)[source]
Parameters:ch (str) – a Unicode character
Returns:the Pango.Script for the character.
Return type:Pango.Script

Looks up the Pango.Script for a particular character (as defined by Unicode Standard Annex \#24). No check is made for ch being a valid Unicode character; if you pass in invalid character, the result is undefined.

As of Pango 1.18, this function simply returns the return value of GLib.unichar_get_script().

New in version 1.4.

classmethod get_sample_language(script)[source]
Parameters:script (Pango.Script) – a Pango.Script
Returns:a Pango.Language that is representative of the script, or None if no such language exists.
Return type:Pango.Language or None

Given a script, finds a language tag that is reasonably representative of that script. This will usually be the most widely spoken or used language written in that script: for instance, the sample language for Pango.Script.CYRILLIC is ru (Russian), the sample language for 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 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 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 Pango.Script.HAN when setting context language is not feasible.

New in version 1.4.

INVALID_CODE = -1

a value never returned from Pango.Script.for_unichar()

COMMON = 0

a character used by multiple different scripts

INHERITED = 1

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

DEVANAGARI = 10

Devanagari

MRO = 100

Mro.

New in version 1.40.

NABATAEAN = 101

Nabataean.

New in version 1.40.

OLD_NORTH_ARABIAN = 102

Old North Arabian.

New in version 1.40.

OLD_PERMIC = 103

Old Permic.

New in version 1.40.

PAHAWH_HMONG = 104

Pahawh Hmong.

New in version 1.40.

PALMYRENE = 105

Palmyrene.

New in version 1.40.

PAU_CIN_HAU = 106

Pau Cin Hau.

New in version 1.40.

PSALTER_PAHLAVI = 107

Psalter Pahlavi.

New in version 1.40.

SIDDHAM = 108

Siddham.

New in version 1.40.

TIRHUTA = 109

Tirhuta.

New in version 1.40.

ETHIOPIC = 11

Ethiopic

WARANG_CITI = 110

Warang Citi.

New in version 1.40.

AHOM = 111

Ahom.

New in version 1.40.

ANATOLIAN_HIEROGLYPHS = 112

Anatolian Hieroglyphs.

New in version 1.40.

HATRAN = 113

Hatran.

New in version 1.40.

MULTANI = 114

Multani.

New in version 1.40.

OLD_HUNGARIAN = 115

Old Hungarian.

New in version 1.40.

SIGNWRITING = 116

Signwriting.

New in version 1.40.

GEORGIAN = 12

Georgian

GOTHIC = 13

Gothic

GREEK = 14

Greek

GUJARATI = 15

Gujarati

GURMUKHI = 16

Gurmukhi

HAN = 17

Han

HANGUL = 18

Hangul

HEBREW = 19

Hebrew

ARABIC = 2

Arabic

HIRAGANA = 20

Hiragana

KANNADA = 21

Kannada

KATAKANA = 22

Katakana

KHMER = 23

Khmer

LAO = 24

Lao

LATIN = 25

Latin

MALAYALAM = 26

Malayalam

MONGOLIAN = 27

Mongolian

MYANMAR = 28

Myanmar

OGHAM = 29

Ogham

ARMENIAN = 3

Armenian

OLD_ITALIC = 30

Old Italic

ORIYA = 31

Oriya

RUNIC = 32

Runic

SINHALA = 33

Sinhala

SYRIAC = 34

Syriac

TAMIL = 35

Tamil

TELUGU = 36

Telugu

THAANA = 37

Thaana

THAI = 38

Thai

TIBETAN = 39

Tibetan

BENGALI = 4

Bengali

CANADIAN_ABORIGINAL = 40

Canadian Aboriginal

YI = 41

Yi

TAGALOG = 42

Tagalog

HANUNOO = 43

Hanunoo

BUHID = 44

Buhid

TAGBANWA = 45

Tagbanwa

BRAILLE = 46

Braille

CYPRIOT = 47

Cypriot

LIMBU = 48

Limbu

OSMANYA = 49

Osmanya

BOPOMOFO = 5

Bopomofo

SHAVIAN = 50

Shavian

LINEAR_B = 51

Linear B

TAI_LE = 52

Tai Le

UGARITIC = 53

Ugaritic

NEW_TAI_LUE = 54

New Tai Lue.

New in version 1.10.

BUGINESE = 55

Buginese.

New in version 1.10.

GLAGOLITIC = 56

Glagolitic.

New in version 1.10.

TIFINAGH = 57

Tifinagh.

New in version 1.10.

SYLOTI_NAGRI = 58

Syloti Nagri.

New in version 1.10.

OLD_PERSIAN = 59

Old Persian.

New in version 1.10.

CHEROKEE = 6

Cherokee

KHAROSHTHI = 60

Kharoshthi.

New in version 1.10.

UNKNOWN = 61

an unassigned code point.

New in version 1.14.

BALINESE = 62

Balinese.

New in version 1.14.

CUNEIFORM = 63

Cuneiform.

New in version 1.14.

PHOENICIAN = 64

Phoenician.

New in version 1.14.

PHAGS_PA = 65

Phags-pa.

New in version 1.14.

NKO = 66

N’Ko.

New in version 1.14.

KAYAH_LI = 67

Kayah Li.

New in version 1.20.1.

LEPCHA = 68

Lepcha.

New in version 1.20.1.

REJANG = 69

Rejang.

New in version 1.20.1.

COPTIC = 7

Coptic

SUNDANESE = 70

Sundanese.

New in version 1.20.1.

SAURASHTRA = 71

Saurashtra.

New in version 1.20.1.

CHAM = 72

Cham.

New in version 1.20.1.

OL_CHIKI = 73

Ol Chiki.

New in version 1.20.1.

VAI = 74

Vai.

New in version 1.20.1.

CARIAN = 75

Carian.

New in version 1.20.1.

LYCIAN = 76

Lycian.

New in version 1.20.1.

LYDIAN = 77

Lydian.

New in version 1.20.1.

BATAK = 78

Batak.

New in version 1.32.

BRAHMI = 79

Brahmi.

New in version 1.32.

CYRILLIC = 8

Cyrillic

MANDAIC = 80

Mandaic.

New in version 1.32.

CHAKMA = 81

Chakma.

New in version 1.32.

MEROITIC_CURSIVE = 82

Meroitic Cursive.

New in version 1.32.

MEROITIC_HIEROGLYPHS = 83

Meroitic Hieroglyphs.

New in version 1.32.

MIAO = 84

Miao.

New in version 1.32.

SHARADA = 85

Sharada.

New in version 1.32.

SORA_SOMPENG = 86

Sora Sompeng.

New in version 1.32.

TAKRI = 87

Takri.

New in version 1.32.

BASSA_VAH = 88

Bassa.

New in version 1.40.

CAUCASIAN_ALBANIAN = 89

Caucasian Albanian.

New in version 1.40.

DESERET = 9

Deseret

DUPLOYAN = 90

Duployan.

New in version 1.40.

ELBASAN = 91

Elbasan.

New in version 1.40.

GRANTHA = 92

Grantha.

New in version 1.40.

KHOJKI = 93

Kjohki.

New in version 1.40.

KHUDAWADI = 94

Khudawadi, Sindhi.

New in version 1.40.

LINEAR_A = 95

Linear A.

New in version 1.40.

MAHAJANI = 96

Mahajani.

New in version 1.40.

MANICHAEAN = 97

Manichaean.

New in version 1.40.

MENDE_KIKAKUI = 98

Mende Kikakui.

New in version 1.40.

MODI = 99

Modi.

New in version 1.40.

class Pango.Stretch(value)

Bases: GObject.GEnum

An enumeration specifying the width of the font relative to other designs within a family.

ULTRA_CONDENSED = 0

ultra condensed width

EXTRA_CONDENSED = 1

extra condensed width

CONDENSED = 2

condensed width

SEMI_CONDENSED = 3

semi condensed width

NORMAL = 4

the normal width

SEMI_EXPANDED = 5

semi expanded width

EXPANDED = 6

expanded width

EXTRA_EXPANDED = 7

extra expanded width

ULTRA_EXPANDED = 8

ultra expanded width

class Pango.Style(value)

Bases: GObject.GEnum

An enumeration specifying the various slant styles possible for a font.

NORMAL = 0

the font is upright.

OBLIQUE = 1

the font is slanted, but in a roman style.

ITALIC = 2

the font is slanted in an italic style.

class Pango.TabAlign(value)

Bases: GObject.GEnum

A Pango.TabAlign specifies where a tab stop appears relative to the text.

LEFT = 0

the tab stop appears to the left of the text.

class Pango.Underline(value)

Bases: GObject.GEnum

The Pango.Underline enumeration is used to specify whether text should be underlined, and if so, the type of underlining.

NONE = 0

no underline should be drawn

SINGLE = 1

a single underline should be drawn

DOUBLE = 2

a double underline should be drawn

LOW = 3

a single underline should be drawn at a position beneath the ink extents of the text being underlined. This should be used only for underlining single characters, such as for keyboard accelerators. Pango.Underline.SINGLE should be used for extended portions of text.

ERROR = 4

a wavy underline should be drawn below. This underline is typically used to indicate an error such as a possilble mispelling; in some cases a contrasting color may automatically be used. This type of underlining is available since Pango 1.4.

class Pango.Variant(value)

Bases: GObject.GEnum

An enumeration specifying capitalization variant of the font.

NORMAL = 0

A normal font.

SMALL_CAPS = 1

A font with the lower case characters replaced by smaller variants of the capital characters.

class Pango.Weight(value)

Bases: GObject.GEnum

An enumeration specifying the weight (boldness) of a font. This is a numerical value ranging from 100 to 1000, but there are some predefined values:

THIN = 100

the thin weight (= 100;

New in version 1.24).

ULTRAHEAVY = 1000

the ultraheavy weight (= 1000;

New in version 1.24).

ULTRALIGHT = 200

the ultralight weight (= 200)

LIGHT = 300

the light weight (= 300)

SEMILIGHT = 350

the semilight weight (= 350;

New in version 1.36.7).

BOOK = 380

the book weight (= 380;

New in version 1.24).

NORMAL = 400

the default weight (= 400)

MEDIUM = 500

the normal weight (= 500;

New in version 1.24).

SEMIBOLD = 600

the semibold weight (= 600)

BOLD = 700

the bold weight (= 700)

ULTRABOLD = 800

the ultrabold weight (= 800)

HEAVY = 900

the heavy weight (= 900)

class Pango.WrapMode(value)

Bases: GObject.GEnum

A Pango.WrapMode describes how to wrap the lines of a Pango.Layout to the desired width.

WORD = 0

wrap lines at word boundaries.

CHAR = 1

wrap lines at character boundaries.

WORD_CHAR = 2

wrap lines at word boundaries, but fall back to character boundaries if there is not enough space for a full word.