Attribute

class Attribute(*args, **kwargs)

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 init. By default, an attribute will have an all-inclusive range of [0,``%G_MAXUINT``].

Methods

class Attribute
as_color() AttrColor | None

Returns the attribute cast to PangoAttrColor.

This is mainly useful for language bindings.

Added in version 1.50.

as_float() AttrFloat | None

Returns the attribute cast to PangoAttrFloat.

This is mainly useful for language bindings.

Added in version 1.50.

as_font_desc() AttrFontDesc | None

Returns the attribute cast to PangoAttrFontDesc.

This is mainly useful for language bindings.

Added in version 1.50.

as_font_features() AttrFontFeatures | None

Returns the attribute cast to PangoAttrFontFeatures.

This is mainly useful for language bindings.

Added in version 1.50.

as_int() AttrInt | None

Returns the attribute cast to PangoAttrInt.

This is mainly useful for language bindings.

Added in version 1.50.

as_language() AttrLanguage | None

Returns the attribute cast to PangoAttrLanguage.

This is mainly useful for language bindings.

Added in version 1.50.

as_shape() AttrShape | None

Returns the attribute cast to PangoAttrShape.

This is mainly useful for language bindings.

Added in version 1.50.

as_size() AttrSize | None

Returns the attribute cast to PangoAttrSize.

This is mainly useful for language bindings.

Added in version 1.50.

as_string() AttrString | None

Returns the attribute cast to PangoAttrString.

This is mainly useful for language bindings.

Added in version 1.50.

destroy() None

Destroy a PangoAttribute and free all associated memory.

equal(attr2: Attribute) 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.

Parameters:

attr2 – another PangoAttribute

init(klass: AttrClass) None

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

Added in version 1.20.

Parameters:

klass – a PangoAttrClass

Fields

class Attribute
end_index

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

klass

The class structure holding information about the type of the attribute

start_index

The start index of the range (in bytes).