Skip to content

Pango.Attribute

record (struct)

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

Methods

as_color

def as_color(self) -> AttrColor | None

Returns the attribute cast to PangoAttrColor.

This is mainly useful for language bindings.

as_float

def as_float(self) -> AttrFloat | None

Returns the attribute cast to PangoAttrFloat.

This is mainly useful for language bindings.

as_font_desc

def as_font_desc(self) -> AttrFontDesc | None

Returns the attribute cast to PangoAttrFontDesc.

This is mainly useful for language bindings.

as_font_features

def as_font_features(self) -> AttrFontFeatures | None

Returns the attribute cast to PangoAttrFontFeatures.

This is mainly useful for language bindings.

as_int

def as_int(self) -> AttrInt | None

Returns the attribute cast to PangoAttrInt.

This is mainly useful for language bindings.

as_language

def as_language(self) -> AttrLanguage | None

Returns the attribute cast to PangoAttrLanguage.

This is mainly useful for language bindings.

as_shape

def as_shape(self) -> AttrShape | None

Returns the attribute cast to PangoAttrShape.

This is mainly useful for language bindings.

as_size

def as_size(self) -> AttrSize | None

Returns the attribute cast to PangoAttrSize.

This is mainly useful for language bindings.

as_string

def as_string(self) -> AttrString | None

Returns the attribute cast to PangoAttrString.

This is mainly useful for language bindings.

copy

def copy(self) -> Attribute

Make a copy of an attribute.

destroy

def destroy(self) -> None

Destroy a PangoAttribute and free all associated memory.

equal

def equal(self, 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

def init(self, 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.

Parameters:

  • klass — a PangoAttrClass

Properties

klass

klass: AttrClass  # read/write

start_index

start_index: int  # read/write

end_index

end_index: int  # read/write