Package org.gnome.pango
Class AttrIterator
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.pango.AttrIterator
- All Implemented Interfaces:
Proxy
A
PangoAttrIterator
is used to iterate through a PangoAttrList
.
A new iterator is created with AttrList.getIterator()
.
Once the iterator is created, it can be advanced through the style
changes in the text using next()
. At each
style change, the range of the current style segment and the attributes
currently in effect can be queried.
-
Constructor Summary
ConstructorDescriptionAttrIterator
(MemorySegment address) Create a AttrIterator proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copy aPangoAttrIterator
.void
destroy()
Destroy aPangoAttrIterator
and free all associated memory.Find the current attribute of a particular type at the iterator location.getAttrs()
Gets a list of all attributes at the current position of the iterator.void
getFont
(FontDescription desc, @Nullable Out<Language> language, @Nullable Out<SList<Attribute>> extraAttrs) Get the font and other attributes at the current iterator position.static Type
getType()
Get the GType of the AttrIterator classboolean
next()
Advance the iterator until the next change of style.void
Get the range of the current segment.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
AttrIterator
Create a AttrIterator proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
copy
Copy aPangoAttrIterator
.- Returns:
- the newly allocated
PangoAttrIterator
, which should be freed withdestroy()
-
destroy
public void destroy()Destroy aPangoAttrIterator
and free all associated memory. -
get
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.
- Parameters:
type
- the type of attribute to find- Returns:
- the current
attribute of the given type, or
null
if no attribute of that type applies to the current location.
-
getAttrs
Gets a list of all attributes at the current position of the iterator.- Returns:
- a list of all attributes for the current range. To free
this value, call
Attribute.destroy()
on each value and g_slist_free() on the list.
-
getFont
public void getFont(FontDescription desc, @Nullable @Nullable Out<Language> language, @Nullable @Nullable Out<SList<Attribute>> extraAttrs) Get the font and other attributes at the current iterator position.- Parameters:
desc
- aPangoFontDescription
to fill in with the current values. The family name in this structure will be set usingFontDescription.setFamilyStatic(java.lang.String)
using values from an attribute in thePangoAttrList
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))
.language
- location to store language tag for item, ornull
if none is found.extraAttrs
- location in which to store a list of non-font attributes at the the current position; only the highest priority value of each attribute will be added to this list. In order to free this value, you must callAttribute.destroy()
on each member.
-
next
public boolean next()Advance the iterator until the next change of style.- Returns:
false
if the iterator is at the end of the list, otherwisetrue
-
range
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 toG_MAXINT
.- Parameters:
start
- location to store the start of the rangeend
- location to store the end of the range
-