Package com.myscript.iink.text
Class Text
java.lang.Object
com.myscript.iink.text.Text
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 TypeMethodDescriptionfinal 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 textfinal 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
getLabel()
Returns the label of this text.
-
Method Details
-
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 byteendIndex
- 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
- whenindex
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
- whenindex
is invalid.
-
getGlyphLabelAt
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
- whenindex
is invalid.
-