Class GlyphItemIter
- All Implemented Interfaces:
Proxy
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 Summary
ConstructorsConstructorDescriptionAllocate a new GlyphItemIter.GlyphItemIter(Arena arena) Allocate a new GlyphItemIter.GlyphItemIter(MemorySegment address) Create a GlyphItemIter proxy instance for the provided memory address.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.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. -
Method Summary
Modifier and TypeMethodDescription@Nullable GlyphItemItercopy()Make a shallow copy of an existingPangoGlyphItemIterstructure.voidfree()Frees aPangoGlyphItemIter.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the GlyphItemIter classbooleanInitializes aPangoGlyphItemIterstructure to point to the last cluster in a glyph item.booleanInitializes aPangoGlyphItemIterstructure to point to the first cluster in a glyph item.booleanAdvances the iterator to the next cluster in the glyph item.booleanMoves the iterator to the preceding cluster in the glyph item.intRead the value of the fieldend_char.intRead the value of the fieldend_glyph.intRead the value of the fieldend_index.Read the value of the fieldglyph_item.intRead the value of the fieldstart_char.intRead the value of the fieldstart_glyph.intRead the value of the fieldstart_index.readText()Read the value of the fieldtext.voidwriteEndChar(int endChar) Write a value in the fieldend_char.voidwriteEndGlyph(int endGlyph) Write a value in the fieldend_glyph.voidwriteEndIndex(int endIndex) Write a value in the fieldend_index.voidwriteGlyphItem(GlyphItem glyphItem) Write a value in the fieldglyph_item.voidwriteStartChar(int startChar) Write a value in the fieldstart_char.voidwriteStartGlyph(int startGlyph) Write a value in the fieldstart_glyph.voidwriteStartIndex(int startIndex) Write a value in the fieldstart_index.voidWrite a value in the fieldtext.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
GlyphItemIter
Create a GlyphItemIter proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
GlyphItemIter
Allocate a new GlyphItemIter.- Parameters:
arena- to control the memory allocation scope
-
GlyphItemIter
public GlyphItemIter()Allocate a new GlyphItemIter. The memory is allocated withArena.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 fieldglyphItemtext- value for the fieldtextstartGlyph- value for the fieldstartGlyphstartIndex- value for the fieldstartIndexstartChar- value for the fieldstartCharendGlyph- value for the fieldendGlyphendIndex- value for the fieldendIndexendChar- value for the fieldendChararena- 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 withArena.ofAuto().- Parameters:
glyphItem- value for the fieldglyphItemtext- value for the fieldtextstartGlyph- value for the fieldstartGlyphstartIndex- value for the fieldstartIndexstartChar- value for the fieldstartCharendGlyph- value for the fieldendGlyphendIndex- value for the fieldendIndexendChar- value for the fieldendChar
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readGlyphItem
Read the value of the fieldglyph_item.- Returns:
- The value of the field
glyph_item
-
writeGlyphItem
Write a value in the fieldglyph_item.- Parameters:
glyphItem- The new value for the fieldglyph_item
-
readText
-
writeText
-
readStartGlyph
public int readStartGlyph()Read the value of the fieldstart_glyph.- Returns:
- The value of the field
start_glyph
-
writeStartGlyph
public void writeStartGlyph(int startGlyph) Write a value in the fieldstart_glyph.- Parameters:
startGlyph- The new value for the fieldstart_glyph
-
readStartIndex
public int readStartIndex()Read the value of the fieldstart_index.- Returns:
- The value of the field
start_index
-
writeStartIndex
public void writeStartIndex(int startIndex) Write a value in the fieldstart_index.- Parameters:
startIndex- The new value for the fieldstart_index
-
readStartChar
public int readStartChar()Read the value of the fieldstart_char.- Returns:
- The value of the field
start_char
-
writeStartChar
public void writeStartChar(int startChar) Write a value in the fieldstart_char.- Parameters:
startChar- The new value for the fieldstart_char
-
readEndGlyph
public int readEndGlyph()Read the value of the fieldend_glyph.- Returns:
- The value of the field
end_glyph
-
writeEndGlyph
public void writeEndGlyph(int endGlyph) Write a value in the fieldend_glyph.- Parameters:
endGlyph- The new value for the fieldend_glyph
-
readEndIndex
public int readEndIndex()Read the value of the fieldend_index.- Returns:
- The value of the field
end_index
-
writeEndIndex
public void writeEndIndex(int endIndex) Write a value in the fieldend_index.- Parameters:
endIndex- The new value for the fieldend_index
-
readEndChar
public int readEndChar()Read the value of the fieldend_char.- Returns:
- The value of the field
end_char
-
writeEndChar
public void writeEndChar(int endChar) Write a value in the fieldend_char.- Parameters:
endChar- The new value for the fieldend_char
-
copy
Make a shallow copy of an existingPangoGlyphItemIterstructure.- Returns:
- the newly allocated
PangoGlyphItemIter - Since:
- 1.22
-
free
public void free()Frees aPangoGlyphItemIter.- Since:
- 1.22
-
initEnd
Initializes aPangoGlyphItemIterstructure to point to the last cluster in a glyph item.See
PangoGlyphItemIterfor details of cluster orders.- Parameters:
glyphItem- the glyph item to iterate overtext- text corresponding to the glyph item- Returns:
falseif there are no clusters in the glyph item- Since:
- 1.22
-
initStart
Initializes aPangoGlyphItemIterstructure to point to the first cluster in a glyph item.See
PangoGlyphItemIterfor details of cluster orders.- Parameters:
glyphItem- the glyph item to iterate overtext- text corresponding to the glyph item- Returns:
falseif 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
PangoGlyphItemIterfor details of cluster orders.- Returns:
trueif the iterator was advanced,falseif 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. SeePangoGlyphItemIterfor details of cluster orders.- Returns:
trueif the iterator was moved,falseif we were already on the first cluster.- Since:
- 1.22
-