Package com.myscript.iink.text
Class Text
- java.lang.Object
-
- com.myscript.iink.text.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 textint
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.
-
-
-
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 byteendIndex
- 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
- 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:
java.lang.IndexOutOfBoundsException
- whenindex
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
- whenindex
is invalid.
-
-