Class Text


  • public class Text
    extends java.lang.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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getGlyphBeginAt​(int index)
      Returns the starting position in the label, in bytes, of a given glyph.
      int getGlyphCount()
      Returns the number of glyphs associated with this text.
      int getGlyphCount​(int beginIndex, int endIndex)
      Returns the number of glyphs included in span of two index of bytes in this text
      int getGlyphEndAt​(int index)
      Returns the end position in the label, in bytes, of a given glyph.
      @NotNull java.lang.String getGlyphLabelAt​(int index)
      Returns the label of the glyph at a given index.
      @NotNull java.lang.String getLabel()
      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 Detail

      • getLabel

        @NotNull
        public final @NotNull java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.IndexOutOfBoundsException - when index is invalid.
      • getGlyphLabelAt

        @NotNull
        public final @NotNull java.lang.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:
        java.lang.IndexOutOfBoundsException - when index is invalid.