Pango.Attribute

Fields

Name

Type

Access

Description

end_index

int

r/w

end index of the range (in bytes). The character at this index is not included in the range.

klass

Pango.AttrClass

r/w

the class structure holding information about the type of the attribute

start_index

int

r/w

the start index of the range (in bytes).

Methods

as_color ()

as_float ()

as_font_desc ()

as_font_features ()

as_int ()

as_language ()

as_shape ()

as_size ()

as_string ()

copy ()

destroy ()

equal (attr2)

init (klass)

Details

class Pango.Attribute

The PangoAttribute structure represents the common portions of all attributes.

Particular types of attributes include this structure as their initial portion. The common portion of the attribute holds the range to which the value in the type-specific part of the attribute applies and should be initialized using [method`Pango`.Attribute.init]. By default, an attribute will have an all-inclusive range of [0,:obj:GObject.G_MAXUINT].

as_color()[source]
Returns:

The attribute as PangoAttrColor, or None if it’s not a color attribute

Return type:

Pango.AttrColor or None

Returns the attribute cast to PangoAttrColor.

This is mainly useful for language bindings.

New in version 1.50.

as_float()[source]
Returns:

The attribute as PangoAttrFloat, or None if it’s not a floating point attribute

Return type:

Pango.AttrFloat or None

Returns the attribute cast to PangoAttrFloat.

This is mainly useful for language bindings.

New in version 1.50.

as_font_desc()[source]
Returns:

The attribute as PangoAttrFontDesc, or None if it’s not a font description attribute

Return type:

Pango.AttrFontDesc or None

Returns the attribute cast to PangoAttrFontDesc.

This is mainly useful for language bindings.

New in version 1.50.

as_font_features()[source]
Returns:

The attribute as PangoAttrFontFeatures, or None if it’s not a font features attribute

Return type:

Pango.AttrFontFeatures or None

Returns the attribute cast to PangoAttrFontFeatures.

This is mainly useful for language bindings.

New in version 1.50.

as_int()[source]
Returns:

The attribute as PangoAttrInt, or None if it’s not an integer attribute

Return type:

Pango.AttrInt or None

Returns the attribute cast to PangoAttrInt.

This is mainly useful for language bindings.

New in version 1.50.

as_language()[source]
Returns:

The attribute as PangoAttrLanguage, or None if it’s not a language attribute

Return type:

Pango.AttrLanguage or None

Returns the attribute cast to PangoAttrLanguage.

This is mainly useful for language bindings.

New in version 1.50.

as_shape()[source]
Returns:

The attribute as PangoAttrShape, or None if it’s not a shape attribute

Return type:

Pango.AttrShape or None

Returns the attribute cast to PangoAttrShape.

This is mainly useful for language bindings.

New in version 1.50.

as_size()[source]
Returns:

The attribute as PangoAttrSize, or None if it’s not a size attribute

Return type:

Pango.AttrSize or None

Returns the attribute cast to PangoAttrSize.

This is mainly useful for language bindings.

New in version 1.50.

as_string()[source]
Returns:

The attribute as PangoAttrString, or None if it’s not a string attribute

Return type:

Pango.AttrString or None

Returns the attribute cast to PangoAttrString.

This is mainly useful for language bindings.

New in version 1.50.

copy()[source]
Returns:

the newly allocated PangoAttribute, which should be freed with [method`Pango`.Attribute.destroy].

Return type:

Pango.Attribute

Make a copy of an attribute.

destroy()[source]

Destroy a PangoAttribute and free all associated memory.

equal(attr2)[source]
Parameters:

attr2 (Pango.Attribute) – another PangoAttribute

Returns:

True if the two attributes have the same value

Return type:

bool

Compare two attributes for equality.

This compares only the actual value of the two attributes and not the ranges that the attributes apply to.

init(klass)[source]
Parameters:

klass (Pango.AttrClass) – a PangoAttrClass

Initializes self's klass to klass, it’s start_index to Pango.ATTR_INDEX_FROM_TEXT_BEGINNING and end_index to Pango.ATTR_INDEX_TO_TEXT_END such that the attribute applies to the entire text by default.

New in version 1.20.