AttrType

class AttrType

The PangoAttrType distinguishes between different types of attributes.

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

Methods

class AttrType
get_name(type: AttrType) str | None

Fetches the attribute type name.

The attribute type name is the string passed in when registering the type using register.

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

Added in version 1.22.

Parameters:

type – an attribute type ID to fetch the name for

register(name: str) AttrType

Allocate a new attribute type ID.

The attribute type name can be accessed later by using get_name.

Parameters:

name – an identifier for the type

Fields

class AttrType
ABSOLUTE_LINE_HEIGHT

Line height (AttrInt). Since: 1.50

ABSOLUTE_SIZE

Font size in pixels scaled by SCALE (AttrInt)

ALLOW_BREAKS

Whether breaks are allowed (AttrInt). Since 1.44

BACKGROUND

Background color (AttrColor)

BACKGROUND_ALPHA

Background alpha (AttrInt). Since 1.38

BASELINE_SHIFT

Baseline displacement (AttrInt). Since 1.50

FALLBACK

Whether fallback is enabled (AttrInt)

FAMILY

Font family name list (AttrString)

FONT_DESC

Font description (AttrFontDesc)

FONT_FEATURES

OpenType font features (AttrFontFeatures). Since 1.38

FONT_SCALE

Font-relative size change (AttrInt). Since 1.50

FOREGROUND

Foreground color (AttrColor)

FOREGROUND_ALPHA

Foreground alpha (AttrInt). Since 1.38

GRAVITY

Base text gravity (AttrInt)

GRAVITY_HINT

Gravity hint (AttrInt)

INSERT_HYPHENS

Whether to insert hyphens at intra-word line breaks (AttrInt). Since 1.44

INVALID

Does not happen

LANGUAGE

Language (AttrLanguage)

LETTER_SPACING

Letter spacing (PangoAttrInt)

LINE_HEIGHT

Line height factor (AttrFloat). Since: 1.50

OVERLINE

Whether the text has an overline (AttrInt). Since 1.46

OVERLINE_COLOR

Overline color (AttrColor). Since 1.46

RISE

Baseline displacement (AttrInt)

SCALE

Font size scale factor (AttrFloat)

SENTENCE

Override segmentation to classify the range of the attribute as a single sentence (AttrInt). Since 1.50

SHAPE

Shape (AttrShape)

SHOW

How to render invisible characters (AttrInt). Since 1.44

SIZE

Font size in points scaled by SCALE (AttrInt)

STRETCH

Font stretch (AttrInt)

STRIKETHROUGH

Whether the text is struck-through (AttrInt)

STRIKETHROUGH_COLOR

Strikethrough color (AttrColor)

STYLE

Font slant style (AttrInt)

TEXT_TRANSFORM
UNDERLINE

Whether the text has an underline (AttrInt)

UNDERLINE_COLOR

Underline color (AttrColor)

VARIANT

Font variant (normal or small caps) (AttrInt)

WEIGHT

Font weight (AttrInt)

WORD

Override segmentation to classify the range of the attribute as a single word (AttrInt). Since 1.50