public class PrismTextLayout extends java.lang.Object implements TextLayout
Modifier and Type | Field and Description |
---|---|
private static java.lang.Object |
CACHE_SIZE_LOCK |
private java.lang.Integer |
cacheKey |
private static int |
cacheSize |
private int |
flags |
private PGFont |
font |
private static BaseTransform |
IDENTITY |
private LayoutCache |
layoutCache |
private float |
layoutHeight |
private float |
layoutWidth |
private TextLine[] |
lines |
private BaseBounds |
logicalBounds |
private static int |
MAX_CACHE_SIZE |
private static int |
MAX_STRING_SIZE |
private int |
runCount |
private TextRun[] |
runs |
private Shape |
shape |
private float |
spacing |
private TextSpan[] |
spans |
private FontStrike |
strike |
private static java.util.Hashtable<java.lang.Integer,LayoutCache> |
stringCache |
private char[] |
text |
private RectBounds |
visualBounds |
private float |
wrapWidth |
private static int |
X_MAX_INDEX |
private static int |
X_MIN_INDEX |
private static int |
Y_MAX_INDEX |
private static int |
Y_MIN_INDEX |
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) |
private void |
buildRuns(char[] chars) |
private void |
computeSideBearings(TextLine line) |
private boolean |
copyCache() |
private TextLine |
createLine(int start,
int end,
int startOffset) |
private void |
ensureLayout() |
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) |
private int |
getCharCount() |
int |
getDirection() |
PGFont |
getFont() |
HitInfo |
getHitInfo(float x,
float y) |
private int |
getLineCount() |
private int |
getLineIndex(float y)
*
Text Layout Implementation *
*
|
TextLine[] |
getLines()
Returns the lines of text layout.
|
private float |
getMirroringWidth() |
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.
|
private float |
getTabAdvance() |
private char[] |
getText() |
TextSpan[] |
getTextSpans() |
BaseBounds |
getVisualBounds(int type)
Returns the visual bounds of the layout using glyph bounding box
|
private void |
initCache() |
private boolean |
isMirrored() |
private boolean |
isSimpleLayout() |
private void |
layout() |
private void |
relayout() |
private void |
reorderLine(TextLine line) |
private void |
reset() |
private void |
reuseRuns() |
boolean |
setAlignment(int alignment)
Sets the alignment for the TextLayout.
|
boolean |
setBoundsType(int type)
Sets the bounds type for the TextLayout.
|
boolean |
setContent(java.lang.String text,
java.lang.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.
|
private void |
shape(TextRun run,
char[] chars,
GlyphLayout layout) |
private static final BaseTransform IDENTITY
private static final int X_MIN_INDEX
private static final int Y_MIN_INDEX
private static final int X_MAX_INDEX
private static final int Y_MAX_INDEX
private static final java.util.Hashtable<java.lang.Integer,LayoutCache> stringCache
private static final java.lang.Object CACHE_SIZE_LOCK
private static int cacheSize
private static final int MAX_STRING_SIZE
private static final int MAX_CACHE_SIZE
private char[] text
private TextSpan[] spans
private PGFont font
private FontStrike strike
private java.lang.Integer cacheKey
private TextLine[] lines
private TextRun[] runs
private int runCount
private BaseBounds logicalBounds
private RectBounds visualBounds
private float layoutWidth
private float layoutHeight
private float wrapWidth
private float spacing
private LayoutCache layoutCache
private Shape shape
private int flags
private void reset()
private void relayout()
public boolean setContent(TextSpan[] spans)
setContent
in interface TextLayout
public boolean setContent(java.lang.String text, java.lang.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
private void ensureLayout()
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 includeprivate int getLineIndex(float y)
private boolean copyCache()
private void initCache()
private int getLineCount()
private int getCharCount()
public TextSpan[] getTextSpans()
public PGFont getFont()
public int getDirection()
public void addTextRun(TextRun run)
private void buildRuns(char[] chars)
private void shape(TextRun run, char[] chars, GlyphLayout layout)
private TextLine createLine(int start, int end, int startOffset)
private void reorderLine(TextLine line)
private char[] getText()
private boolean isSimpleLayout()
private boolean isMirrored()
private float getMirroringWidth()
private void reuseRuns()
private float getTabAdvance()
private void layout()
public BaseBounds getVisualBounds(int type)
TextLayout
getVisualBounds
in interface TextLayout
private void computeSideBearings(TextLine line)