Class Item
- All Implemented Interfaces:
Proxy
PangoItem structure stores information about a segment of text.
You typically obtain PangoItems by itemizing a piece of text
with Pango.itemize(org.gnome.pango.Context, java.lang.String, int, int, org.gnome.pango.AttrList, org.gnome.pango.AttrIterator).
-
Constructor Summary
ConstructorsConstructorDescriptionItem()Creates a newPangoItemstructure initialized to default values.Item(MemorySegment address) Create a Item proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyAttrs(AttrIterator iter) Add attributes to aPangoItem.@Nullable Itemcopy()Copy an existingPangoItemstructure.voidfree()Free aPangoItemand all associated memory.intReturns the character offset of the item from the beginning of the itemized text.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the Item class@Nullable AnalysisRead the value of the fieldanalysis.intRead the value of the fieldlength.intRead the value of the fieldnum_chars.intRead the value of the fieldoffset.split(int splitIndex, int splitOffset) Modifies this Item to cover only the text aftersplitIndex,and returns a new item that covers the text beforesplitIndexthat used to be inorig.voidwriteAnalysis(@Nullable Analysis analysis) Write a value in the fieldanalysis.voidwriteLength(int length) Write a value in the fieldlength.voidwriteNumChars(int numChars) Write a value in the fieldnum_chars.voidwriteOffset(int offset) Write a value in the fieldoffset.Methods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Item
Create a Item proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Item
public Item()Creates a newPangoItemstructure initialized to default values.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readOffset
public int readOffset()Read the value of the fieldoffset.- Returns:
- The value of the field
offset
-
writeOffset
public void writeOffset(int offset) Write a value in the fieldoffset.- Parameters:
offset- The new value for the fieldoffset
-
readLength
public int readLength()Read the value of the fieldlength.- Returns:
- The value of the field
length
-
writeLength
public void writeLength(int length) Write a value in the fieldlength.- Parameters:
length- The new value for the fieldlength
-
readNumChars
public int readNumChars()Read the value of the fieldnum_chars.- Returns:
- The value of the field
num_chars
-
writeNumChars
public void writeNumChars(int numChars) Write a value in the fieldnum_chars.- Parameters:
numChars- The new value for the fieldnum_chars
-
readAnalysis
Read the value of the fieldanalysis.- Returns:
- The value of the field
analysis
-
writeAnalysis
Write a value in the fieldanalysis.- Parameters:
analysis- The new value for the fieldanalysis
-
applyAttrs
Add attributes to aPangoItem.The idea is that you have attributes that don't affect itemization, such as font features, so you filter them out using
AttrList.filter(org.gnome.pango.AttrFilterFunc), itemize your text, then reapply the attributes to the resulting items using this function.The
itershould be positioned before the range of the item, and will be advanced past it. This function is meant to be called in a loop over the items resulting from itemization, while passing the iter to each call.- Parameters:
iter- aPangoAttrIterator- Since:
- 1.44
-
copy
Copy an existingPangoItemstructure.- Returns:
- the newly allocated
PangoItem
-
free
public void free()Free aPangoItemand all associated memory. -
getCharOffset
public int getCharOffset()Returns the character offset of the item from the beginning of the itemized text.If the item has not been obtained from Pango's itemization machinery, then the character offset is not available. In that case, this function returns -1.
- Returns:
- the character offset of the item from the beginning of the itemized text, or -1
- Since:
- 1.54
-
split
Modifies this Item to cover only the text aftersplitIndex,and returns a new item that covers the text beforesplitIndexthat used to be inorig.You can think of
splitIndexas the length of the returned item.splitIndexmay not be 0, and it may not be greater than or equal to the length of this Item (that is, there must be at least one byte assigned to each item, you can't create a zero-length item).splitOffsetis the length of the first item in chars, and must be provided because the text used to generate the item isn't available, sopango_item_split()can't count the char length of the split items itself.- Parameters:
splitIndex- byte index of position to split item, relative to the start of the itemsplitOffset- number of chars between start of this Item andsplitIndex- Returns:
- new item representing text before
splitIndex,which should be freed withfree().
-