Class Item

All Implemented Interfaces:
Proxy

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

The PangoItem structure stores information about a segment of text.

You typically obtain PangoItems by itemizing a piece of text with Pango.itemize(Context, String, int, int, AttrList, AttrIterator).

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new PangoItem structure initialized to default values.
    Create a Item proxy instance for the provided memory address.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add attributes to a PangoItem.
    @Nullable Item
    Copy an existing PangoItem structure.
    void
    Free a PangoItem and all associated memory.
    int
    Returns the character offset of the item from the beginning of the itemized text.
    The memory layout of the native struct.
    static @Nullable Type
    Get the GType of the Item class.
    @Nullable Analysis
    Read the value of the field analysis.
    int
    Read the value of the field length.
    int
    Read the value of the field num_chars.
    int
    Read the value of the field offset.
    split(int splitIndex, int splitOffset)
    Modifies this Item to cover only the text after splitIndex, and returns a new item that covers the text before splitIndex that used to be in orig.
    void
    writeAnalysis(@Nullable Analysis analysis)
    Write a value in the field analysis.
    void
    writeLength(int length)
    Write a value in the field length.
    void
    writeNumChars(int numChars)
    Write a value in the field num_chars.
    void
    writeOffset(int offset)
    Write a value in the field offset.

    Methods inherited from class ProxyInstance

    equals, handle, hashCode

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Item

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

      public Item()
      Creates a new PangoItem structure initialized to default values.
  • Method Details

    • getType

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

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

      public int readOffset()
      Read the value of the field offset.
      Returns:
      The value of the field offset
    • writeOffset

      public void writeOffset(int offset)
      Write a value in the field offset.
      Parameters:
      offset - The new value for the field offset
    • readLength

      public int readLength()
      Read the value of the field length.
      Returns:
      The value of the field length
    • writeLength

      public void writeLength(int length)
      Write a value in the field length.
      Parameters:
      length - The new value for the field length
    • readNumChars

      public int readNumChars()
      Read the value of the field num_chars.
      Returns:
      The value of the field num_chars
    • writeNumChars

      public void writeNumChars(int numChars)
      Write a value in the field num_chars.
      Parameters:
      numChars - The new value for the field num_chars
    • readAnalysis

      public @Nullable Analysis readAnalysis()
      Read the value of the field analysis.
      Returns:
      The value of the field analysis
    • writeAnalysis

      public void writeAnalysis(@Nullable Analysis analysis)
      Write a value in the field analysis.
      Parameters:
      analysis - The new value for the field analysis
    • applyAttrs

      public void applyAttrs(AttrIterator iter)

      Add attributes to a PangoItem.

      The idea is that you have attributes that don't affect itemization, such as font features, so you filter them out using AttrList.filter(AttrFilterFunc), itemize your text, then reapply the attributes to the resulting items using this function.

      The iter should 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 - a PangoAttrIterator
      Since:
      1.44
    • copy

      public @Nullable Item copy()
      Copy an existing PangoItem structure.
      Returns:
      the newly allocated PangoItem
    • free

      public void free()
      Free a PangoItem and 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

      public Item split(int splitIndex, int splitOffset)

      Modifies this Item to cover only the text after splitIndex, and returns a new item that covers the text before splitIndex that used to be in orig.

      You can think of splitIndex as the length of the returned item. splitIndex may 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). splitOffset is the length of the first item in chars, and must be provided because the text used to generate the item isn't available, so pango_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 item
      splitOffset - number of chars between start of this Item and splitIndex
      Returns:
      new item representing text before splitIndex, which should be freed with free().