:right-sidebar: True AttrIterator =================================================================== .. currentmodule:: gi.repository.Pango .. class:: AttrIterator(*args, **kwargs) :no-contents-entry: A ``PangoAttrIterator`` is used to iterate through a ``PangoAttrList``\. A new iterator is created with :obj:`~gi.repository.Pango.AttrList.get_iterator`\. Once the iterator is created, it can be advanced through the style changes in the text using :obj:`~gi.repository.Pango.AttrIterator.next`\. At each style change, the range of the current style segment and the attributes currently in effect can be queried. Methods ------- .. rst-class:: interim-class .. class:: AttrIterator :no-index: .. method:: destroy() -> None Destroy a ``PangoAttrIterator`` and free all associated memory. .. method:: get(type: ~gi.repository.Pango.AttrType) -> ~gi.repository.Pango.Attribute | None Find the current attribute of a particular type at the iterator location. When multiple attributes of the same type overlap, the attribute whose range starts closest to the current location is used. :param type: the type of attribute to find .. method:: get_attrs() -> list[~gi.repository.Pango.Attribute] Gets a list of all attributes at the current position of the iterator. .. versionadded:: 1.2 .. method:: get_font(desc: ~gi.repository.Pango.FontDescription) -> ~typing.Tuple[~gi.repository.Pango.Language, list[~gi.repository.Pango.Attribute]] Get the font and other attributes at the current iterator position. :param desc: a ``PangoFontDescription`` to fill in with the current values. The family name in this structure will be set using :obj:`~gi.repository.Pango.FontDescription.set_family_static` using values from an attribute in the ``PangoAttrList`` associated with the iterator, so if you plan to keep it around, you must call: ``pango_font_description_set_family (desc, pango_font_description_get_family (desc))``\. .. method:: next() -> bool Advance the iterator until the next change of style. .. method:: range() -> ~typing.Tuple[int, int] Get the range of the current segment. Note that the stored return values are signed, not unsigned like the values in ``PangoAttribute``\. To deal with this API oversight, stored return values that wouldn't fit into a signed integer are clamped to %G_MAXINT.