TextRunShaper
public
class
TextRunShaper
extends Object
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:
shapeTextRun(CharSequence, int, int, int, int, float, float, boolean, Paint)
shapeTextRun(char[], int, int, int, int, float, float, boolean, Paint)
TextShaper.shapeText(CharSequence, int, int, TextDirectionHeuristic, TextPaint, TextShaper.GlyphsConsumer)
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 |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
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 . |
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 . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[]]