TextRunShaper
public
class
TextRunShaper
extends Object
java.lang.Object | |
↳ | android.graphics.text.TextRunShaper |
Provides conversion from a text into glyph array.
Text shaping is a preprocess for drawing text into canvas with glyphs. The glyph is a most
primitive unit of the text drawing, consist of glyph identifier in the font file and its position
and style. You can draw the shape result to Canvas by calling Canvas#drawGlyphs.
For most of the use cases, TextShaper
will provide text shaping
functionalities needed. TextRunShaper
is a lower level API that is used by
TextShaper
.
See also:
Summary
Public methods | |
---|---|
static
PositionedGlyphs
|
shapeTextRun(CharSequence text, int start, int count, int contextStart, int contextCount, float xOffset, float yOffset, boolean isRtl, Paint paint)
Shape non-styled text. |
static
PositionedGlyphs
|
shapeTextRun(char[] text, int start, int count, int contextStart, int contextCount, float xOffset, float yOffset, boolean isRtl, Paint paint)
Shape non-styled text. |
Inherited methods | |
---|---|
Public methods
shapeTextRun
public static PositionedGlyphs shapeTextRun (CharSequence text, int start, int count, int contextStart, int contextCount, float xOffset, float yOffset, boolean isRtl, Paint paint)
Shape non-styled text. This function shapes the text of the given range under the context of given context range. Some script, e.g. Arabic or Devanagari, changes letter shape based on its location or surrounding characters.
Parameters | |
---|---|
text |
CharSequence : a text buffer to be shaped. Any styled spans stored in this text are ignored.
This value cannot be null . |
start |
int : a start index of shaping target in the buffer. |
count |
int : a length of shaping target in the buffer. |
contextStart |
int : a start index of context used for shaping in the buffer. |
contextCount |
int : a length of context used for shaping in the buffer. |
xOffset |
float : an additional amount of x offset of the result glyphs. |
yOffset |
float : an additional amount of y offset of the result glyphs. |
isRtl |
boolean : true if this text is shaped for RTL direction, false otherwise. |
paint |
Paint : a paint used for shaping text.
This value cannot be null . |
Returns | |
---|---|
PositionedGlyphs |
a shape result
This value cannot be null . |
shapeTextRun
public static PositionedGlyphs shapeTextRun (char[] text, int start, int count, int contextStart, int contextCount, float xOffset, float yOffset, boolean isRtl, Paint paint)
Shape non-styled text. This function shapes the text of the given range under the context of given context range. Some script, e.g. Arabic or Devanagari, changes letter shape based on its location or surrounding characters.
Parameters | |
---|---|
text |
char : a text buffer to be shaped
This value cannot be null . |
start |
int : a start index of shaping target in the buffer. |
count |
int : a length of shaping target in the buffer. |
contextStart |
int : a start index of context used for shaping in the buffer. |
contextCount |
int : a length of context used for shaping in the buffer. |
xOffset |
float : an additional amount of x offset of the result glyphs. |
yOffset |
float : an additional amount of y offset of the result glyphs. |
isRtl |
boolean : true if this text is shaped for RTL direction, false otherwise. |
paint |
Paint : a paint used for shaping text.
This value cannot be null . |
Returns | |
---|---|
PositionedGlyphs |
a shape result.
This value cannot be null . |