Class GlyphItemIter

java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.pango.GlyphItemIter
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class GlyphItemIter extends ProxyInstance

A PangoGlyphItemIter is an iterator over the clusters in a PangoGlyphItem.

The forward direction of the iterator is the logical direction of text. That is, with increasing startIndex and startChar values. If glyphItem is right-to-left (that is, if glyph_item->item->analysis.level is odd), then startGlyph decreases as the iterator moves forward. Moreover, in right-to-left cases, startGlyph is greater than endGlyph.

An iterator should be initialized using either pango_glyph_item_iter_init_start() or pango_glyph_item_iter_init_end(), for forward and backward iteration respectively, and walked over using any desired mixture of pango_glyph_item_iter_next_cluster() and pango_glyph_item_iter_prev_cluster().

A common idiom for doing a forward iteration over the clusters is:

PangoGlyphItemIter cluster_iter;
gboolean have_cluster;

for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter,
                                                      glyph_item, text);
     have_cluster;
     have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter))
{
  ...
}

Note that text is the start of the text for layout, which is then indexed by glyph_item->item->offset to get to the text of glyphItem. The startIndex and endIndex values can directly index into text. The startGlyph, endGlyph, startChar, and endChar values however are zero-based for the glyphItem. For each cluster, the item pointed at by the start variables is included in the cluster while the one pointed at by end variables is not.

None of the members of a PangoGlyphItemIter should be modified manually.

Since:
1.22
  • Constructor Details

    • GlyphItemIter

      public GlyphItemIter(MemorySegment address)
      Create a GlyphItemIter proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • GlyphItemIter

      public GlyphItemIter(Arena arena)
      Allocate a new GlyphItemIter.
      Parameters:
      arena - to control the memory allocation scope
    • GlyphItemIter

      public GlyphItemIter()
      Allocate a new GlyphItemIter. The memory is allocated with Arena.ofAuto().
    • GlyphItemIter

      public GlyphItemIter(GlyphItem glyphItem, String text, int startGlyph, int startIndex, int startChar, int endGlyph, int endIndex, int endChar, Arena arena)
      Allocate a new GlyphItemIter with the fields set to the provided values.
      Parameters:
      glyphItem - value for the field glyphItem
      text - value for the field text
      startGlyph - value for the field startGlyph
      startIndex - value for the field startIndex
      startChar - value for the field startChar
      endGlyph - value for the field endGlyph
      endIndex - value for the field endIndex
      endChar - value for the field endChar
      arena - to control the memory allocation scope
    • GlyphItemIter

      public GlyphItemIter(GlyphItem glyphItem, String text, int startGlyph, int startIndex, int startChar, int endGlyph, int endIndex, int endChar)
      Allocate a new GlyphItemIter with the fields set to the provided values. The memory is allocated with Arena.ofAuto().
      Parameters:
      glyphItem - value for the field glyphItem
      text - value for the field text
      startGlyph - value for the field startGlyph
      startIndex - value for the field startIndex
      startChar - value for the field startChar
      endGlyph - value for the field endGlyph
      endIndex - value for the field endIndex
      endChar - value for the field endChar
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the GlyphItemIter class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • readGlyphItem

      public GlyphItem readGlyphItem()
      Read the value of the field glyph_item.
      Returns:
      The value of the field glyph_item
    • writeGlyphItem

      public void writeGlyphItem(GlyphItem glyphItem)
      Write a value in the field glyph_item.
      Parameters:
      glyphItem - The new value for the field glyph_item
    • readText

      public String readText()
      Read the value of the field text.
      Returns:
      The value of the field text
    • writeText

      public void writeText(String text, Arena _arena)
      Write a value in the field text.
      Parameters:
      text - The new value for the field text
      _arena - to control the memory allocation scope
    • readStartGlyph

      public int readStartGlyph()
      Read the value of the field start_glyph.
      Returns:
      The value of the field start_glyph
    • writeStartGlyph

      public void writeStartGlyph(int startGlyph)
      Write a value in the field start_glyph.
      Parameters:
      startGlyph - The new value for the field start_glyph
    • readStartIndex

      public int readStartIndex()
      Read the value of the field start_index.
      Returns:
      The value of the field start_index
    • writeStartIndex

      public void writeStartIndex(int startIndex)
      Write a value in the field start_index.
      Parameters:
      startIndex - The new value for the field start_index
    • readStartChar

      public int readStartChar()
      Read the value of the field start_char.
      Returns:
      The value of the field start_char
    • writeStartChar

      public void writeStartChar(int startChar)
      Write a value in the field start_char.
      Parameters:
      startChar - The new value for the field start_char
    • readEndGlyph

      public int readEndGlyph()
      Read the value of the field end_glyph.
      Returns:
      The value of the field end_glyph
    • writeEndGlyph

      public void writeEndGlyph(int endGlyph)
      Write a value in the field end_glyph.
      Parameters:
      endGlyph - The new value for the field end_glyph
    • readEndIndex

      public int readEndIndex()
      Read the value of the field end_index.
      Returns:
      The value of the field end_index
    • writeEndIndex

      public void writeEndIndex(int endIndex)
      Write a value in the field end_index.
      Parameters:
      endIndex - The new value for the field end_index
    • readEndChar

      public int readEndChar()
      Read the value of the field end_char.
      Returns:
      The value of the field end_char
    • writeEndChar

      public void writeEndChar(int endChar)
      Write a value in the field end_char.
      Parameters:
      endChar - The new value for the field end_char
    • copy

      public @Nullable GlyphItemIter copy()
      Make a shallow copy of an existing PangoGlyphItemIter structure.
      Returns:
      the newly allocated PangoGlyphItemIter
      Since:
      1.22
    • free

      public void free()
      Frees a PangoGlyphItemIter.
      Since:
      1.22
    • initEnd

      public boolean initEnd(GlyphItem glyphItem, String text)

      Initializes a PangoGlyphItemIter structure to point to the last cluster in a glyph item.

      See PangoGlyphItemIter for details of cluster orders.

      Parameters:
      glyphItem - the glyph item to iterate over
      text - text corresponding to the glyph item
      Returns:
      false if there are no clusters in the glyph item
      Since:
      1.22
    • initStart

      public boolean initStart(GlyphItem glyphItem, String text)

      Initializes a PangoGlyphItemIter structure to point to the first cluster in a glyph item.

      See PangoGlyphItemIter for details of cluster orders.

      Parameters:
      glyphItem - the glyph item to iterate over
      text - text corresponding to the glyph item
      Returns:
      false if there are no clusters in the glyph item
      Since:
      1.22
    • nextCluster

      public boolean nextCluster()

      Advances the iterator to the next cluster in the glyph item.

      See PangoGlyphItemIter for details of cluster orders.

      Returns:
      true if the iterator was advanced, false if we were already on the last cluster.
      Since:
      1.22
    • prevCluster

      public boolean prevCluster()
      Moves the iterator to the preceding cluster in the glyph item. See PangoGlyphItemIter for details of cluster orders.
      Returns:
      true if the iterator was moved, false if we were already on the first cluster.
      Since:
      1.22