Class Text

java.lang.Object
com.myscript.iink.text.Text

public class Text extends Object
Allows to access the glyphs (i.e. grapheme clusters) within a label.

Note: what is called glyph here, is actually a grapheme cluster. For more details refer to http://unicode.org/reports/tr29/

  • Method Summary

    Modifier and Type
    Method
    Description
    final int
    getGlyphBeginAt(int index)
    Returns the starting position in the label, in bytes, of a given glyph.
    final int
    Returns the number of glyphs associated with this text.
    final int
    getGlyphCount(int beginIndex, int endIndex)
    Returns the number of glyphs included in span of two index of bytes in this text
    final int
    getGlyphEndAt(int index)
    Returns the end position in the label, in bytes, of a given glyph.
    final @NotNull String
    getGlyphLabelAt(int index)
    Returns the label of the glyph at a given index.
    final @NotNull String
    Returns the label of this text.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getLabel

      @NotNull public final @NotNull String getLabel()
      Returns the label of this text.
      Returns:
      the label of this text.
    • getGlyphCount

      public final int getGlyphCount()
      Returns the number of glyphs associated with this text.
      Returns:
      the number of glyphs in this text.
    • getGlyphCount

      public final int getGlyphCount(int beginIndex, int endIndex)
      Returns the number of glyphs included in span of two index of bytes in this text
      Parameters:
      beginIndex - the index of the first byte
      endIndex - the index of the last byte (included)
      Returns:
      the number of glyphs
      Throws:
      IllegalArgumentException - when the indexes are not valid.
    • getGlyphBeginAt

      public final int getGlyphBeginAt(int index)
      Returns the starting position in the label, in bytes, of a given glyph.
      Parameters:
      index - the index of the glyph to retrieve, in glyph count.
      Returns:
      the starting position on the glyph in the label, in bytes.
      Throws:
      IndexOutOfBoundsException - when index is invalid.
    • getGlyphEndAt

      public final int getGlyphEndAt(int index)
      Returns the end position in the label, in bytes, of a given glyph.
      Parameters:
      index - the index of the glyph to retrieve, in glyph count.
      Returns:
      the starting position on the glyph in the label, in bytes.
      Throws:
      IndexOutOfBoundsException - when index is invalid.
    • getGlyphLabelAt

      @NotNull public final @NotNull String getGlyphLabelAt(int index)
      Returns the label of the glyph at a given index.
      Parameters:
      index - the index of the glyph to retrieve, in glyph count.
      Returns:
      the label of the glyph at index.
      Throws:
      IndexOutOfBoundsException - when index is invalid.