public class PrismTextLayout extends Object implements TextLayout
ALIGN_CENTER, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_MASK, ALIGN_RIGHT, ANALYSIS_MASK, BOUNDS_CENTER, BOUNDS_MASK, DIRECTION_DEFAULT_LTR, DIRECTION_DEFAULT_RTL, DIRECTION_LTR, DIRECTION_MASK, DIRECTION_RTL, FLAGS_ANALYSIS_VALID, FLAGS_CACHED_STRIKETHROUGH, FLAGS_CACHED_UNDERLINE, FLAGS_HAS_BIDI, FLAGS_HAS_CJK, FLAGS_HAS_COMPLEX, FLAGS_HAS_EMBEDDED, FLAGS_HAS_TABS, FLAGS_LAST, FLAGS_LINES_VALID, FLAGS_RTL_BASE, FLAGS_WRAPPED, TYPE_BASELINE, TYPE_BEARINGS, TYPE_STRIKETHROUGH, TYPE_TEXT, TYPE_TOP, TYPE_UNDERLINE
Constructor and Description |
---|
PrismTextLayout() |
Modifier and Type | Method and Description |
---|---|
void |
addTextRun(TextRun run) |
BaseBounds |
getBounds()
Returns the (logical) bounds of the layout
minX is always zero
minY is the ascent of the first line (negative)
width the width of the widest line
height the sum of all lines height
Note that this width is different the wrapping width!
|
BaseBounds |
getBounds(TextSpan filter,
BaseBounds bounds) |
PathElement[] |
getCaretShape(int offset,
boolean isLeading,
float x,
float y) |
int |
getDirection() |
PGFont |
getFont() |
HitInfo |
getHitInfo(float x,
float y) |
TextLine[] |
getLines()
Returns the lines of text layout.
|
PathElement[] |
getRange(int start,
int end,
int type,
float x,
float y) |
GlyphList[] |
getRuns()
Returns the GlyphList of text layout.
|
Shape |
getShape(int type,
TextSpan filter)
Returns the shape of the entire text layout relative to the baseline
of the first line.
|
TextSpan[] |
getTextSpans() |
BaseBounds |
getVisualBounds(int type)
Returns the visual bounds of the layout using glyph bounding box
|
boolean |
setAlignment(int alignment)
Sets the alignment for the TextLayout.
|
boolean |
setBoundsType(int type)
Sets the bounds type for the TextLayout.
|
boolean |
setContent(String text,
Object font)
Sets the content for the TextLayout.
|
boolean |
setContent(TextSpan[] spans)
*
TextLayout API *
*
|
boolean |
setDirection(int direction)
Sets the direction (bidi algorithm's) for the TextLayout.
|
boolean |
setLineSpacing(float spacing)
Sets the line spacing for the TextLayout.
|
boolean |
setWrapWidth(float newWidth)
Sets the wrap width for the TextLayout.
|
public boolean setContent(TextSpan[] spans)
setContent
in interface TextLayout
public boolean setContent(String text, Object font)
TextLayout
setContent
in interface TextLayout
public boolean setDirection(int direction)
TextLayout
setDirection
in interface TextLayout
public boolean setBoundsType(int type)
TextLayout
setBoundsType
in interface TextLayout
public boolean setAlignment(int alignment)
TextLayout
setAlignment
in interface TextLayout
public boolean setWrapWidth(float newWidth)
TextLayout
setWrapWidth
in interface TextLayout
public boolean setLineSpacing(float spacing)
TextLayout
setLineSpacing
in interface TextLayout
public TextLine[] getLines()
TextLayout
getLines
in interface TextLayout
public GlyphList[] getRuns()
TextLayout
getRuns
in interface TextLayout
public BaseBounds getBounds()
TextLayout
getBounds
in interface TextLayout
public BaseBounds getBounds(TextSpan filter, BaseBounds bounds)
getBounds
in interface TextLayout
public PathElement[] getCaretShape(int offset, boolean isLeading, float x, float y)
getCaretShape
in interface TextLayout
public HitInfo getHitInfo(float x, float y)
getHitInfo
in interface TextLayout
public PathElement[] getRange(int start, int end, int type, float x, float y)
getRange
in interface TextLayout
public Shape getShape(int type, TextSpan filter)
TextLayout
getShape
in interface TextLayout
type
- the type of the shapes to includepublic TextSpan[] getTextSpans()
public PGFont getFont()
public int getDirection()
public void addTextRun(TextRun run)
public BaseBounds getVisualBounds(int type)
TextLayout
getVisualBounds
in interface TextLayout
Copyright © 2020. All rights reserved.