Top Description Fields Constructors Methods
com.sun.javafx.text

public Class PrismTextLayout

extends Object
implements TextLayout
Class Inheritance
All Implemented Interfaces
com.sun.javafx.scene.text.TextLayout
Imports
java.text.Bidi, .BreakIterator, java.util.ArrayList, .Arrays, .Hashtable, java.util.concurrent.atomic.AtomicBoolean, javafx.scene.layout.Region, javafx.scene.shape.PathElement, com.sun.javafx.font.CharToGlyphMapper, .FontResource, .FontStrike, .Metrics, .PGFont, com.sun.javafx.geom.BaseBounds, .Path2D, .Point2D, .RectBounds, .RoundRectangle2D, .Shape, com.sun.javafx.geom.transform.BaseTransform, .Translate2D, com.sun.javafx.scene.text.GlyphList, .TabAdvancePolicy, .TextLayout, .TextLine, .TextSpan

Prism TextLayout

Field Summary

Modifier and TypeField and Description
private static final Object
private Integer
private static int
private int
private PGFont
private static final BaseTransform
private LayoutCache
private float
private float
private PrismTextLine[]
private BaseBounds
private static final int
private final int
private int
private TextRun[]
private Shape
private float
private TextSpan[]
private FontStrike
private static final Hashtable<Integer, LayoutCache>
private TabAdvancePolicy
private char[]
private RectBounds
private float
private static final int
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
PrismTextLayout(int maxCacheSize)

Method Summary

Modifier and TypeMethod and Description
public void
private void
buildRuns(char[] chars)

private float
private void
private float

Returns:

the X size of the white space trailing the run
computeTrailingSpaceWidth
(TextRun
the run to compute trailing space width for, cannot be null
run
)

Computes the size of the white space trailing a given run.

private boolean
private PrismTextLine
createLine(int start, int end, int startOffset, float collapsedSpaceWidth)

private void
public BaseBounds
getBounds()

Implements com.sun.javafx.scene.text.TextLayout.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!

public BaseBounds
public TextLayout.CaretGeometry
getCaretGeometry(int offset, boolean isLeading)

Implements com.sun.javafx.scene.text.TextLayout.getCaretGeometry.

Queries the caret geometry and associated information at the specified text position.

private int
public int
public PGFont
public TextLayout.Hit
getHitInfo(float x, float y)

Implements com.sun.javafx.scene.text.TextLayout.getHitInfo.

Calculates character index and insertion index for the given coordinates and maps to Hit class.

private int
private int
getLineIndex(float y)

* Text Layout Implementation * *

public TextLine[]
getLines()

Implements com.sun.javafx.scene.text.TextLayout.getLines.

Returns the lines of text layout.

private float
public void
getRange(int start, int end, int type, TextLayout.GeometryCallback client)

Implements com.sun.javafx.scene.text.TextLayout.getRange.

Queries the range geometry of the range of text within the text layout for one of the three possible types:

public GlyphList[]
getRuns()

Implements com.sun.javafx.scene.text.TextLayout.getRuns.

Returns the GlyphList of text layout.

public Shape
getShape(int type, TextSpan filter)

Implements com.sun.javafx.scene.text.TextLayout.getShape.

Returns the shape of the entire text layout relative to the baseline of the first line.

private float
private char[]
public TextSpan[]
public BaseBounds
getVisualBounds(int type)

Implements com.sun.javafx.scene.text.TextLayout.getVisualBounds.

Returns the visual bounds of the layout using glyph bounding box

protected GlyphLayout
private void
private boolean
private boolean
private void
private void
private void
private void
private void
public boolean
setAlignment(int alignment)

Implements com.sun.javafx.scene.text.TextLayout.setAlignment.

Sets the alignment for the TextLayout.

public boolean
setBoundsType(int type)

Implements com.sun.javafx.scene.text.TextLayout.setBoundsType.

Sets the bounds type for the TextLayout.

public boolean
setContent(TextSpan[] spans)

Implements com.sun.javafx.scene.text.TextLayout.setContent.

* TextLayout API * *

public boolean
setContent(String text, Object font)

Implements com.sun.javafx.scene.text.TextLayout.setContent.

Sets the content for the TextLayout.

public boolean
setDirection(int direction)

Implements com.sun.javafx.scene.text.TextLayout.setDirection.

Sets the direction (bidi algorithm's) for the TextLayout.

public boolean
setLineSpacing(float spacing)

Implements com.sun.javafx.scene.text.TextLayout.setLineSpacing.

Sets the line spacing for the TextLayout.

public boolean
setTabAdvancePolicy(int tabSize, TabAdvancePolicy policy)

Implements com.sun.javafx.scene.text.TextLayout.setTabAdvancePolicy.

Sets the tab size and the tab advance policy for the TextLayout.

public boolean
setWrapWidth(float newWidth)

Implements com.sun.javafx.scene.text.TextLayout.setWrapWidth.

Sets the wrap width for the TextLayout.

private void
shape(TextRun run, char[] chars, GlyphLayout layout)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CACHE_SIZE_LOCKback to summary
private static final Object CACHE_SIZE_LOCK
cacheKeyback to summary
private Integer cacheKey
cacheSizeback to summary
private static int cacheSize
flagsback to summary
private int flags
fontback to summary
private PGFont font
IDENTITYback to summary
private static final BaseTransform IDENTITY
layoutCacheback to summary
private LayoutCache layoutCache
layoutHeightback to summary
private float layoutHeight
layoutWidthback to summary
private float layoutWidth
linesback to summary
private PrismTextLine[] lines
logicalBoundsback to summary
private BaseBounds logicalBounds
MAX_STRING_SIZEback to summary
private static final int MAX_STRING_SIZE
maxCacheSizeback to summary
private final int maxCacheSize
runCountback to summary
private int runCount
runsback to summary
private TextRun[] runs
shapeback to summary
private Shape shape
spacingback to summary
private float spacing
spansback to summary
private TextSpan[] spans
strikeback to summary
private FontStrike strike
stringCacheback to summary
private static final Hashtable<Integer, LayoutCache> stringCache
tabAdvancePolicyback to summary
private TabAdvancePolicy tabAdvancePolicy
textback to summary
private char[] text
visualBoundsback to summary
private RectBounds visualBounds
wrapWidthback to summary
private float wrapWidth
X_MAX_INDEXback to summary
private static final int X_MAX_INDEX
X_MIN_INDEXback to summary
private static final int X_MIN_INDEX
Y_MAX_INDEXback to summary
private static final int Y_MAX_INDEX
Y_MIN_INDEXback to summary
private static final int Y_MIN_INDEX

Constructor Detail

PrismTextLayoutback to summary
public PrismTextLayout(int maxCacheSize)

Method Detail

addTextRunback to summary
public void addTextRun(TextRun run)
buildRunsback to summary
private void buildRuns(char[] chars)
computeLayoutShiftback to summary
private float computeLayoutShift(TextSpan span)
computeSideBearingsback to summary
private void computeSideBearings(PrismTextLine line)
computeTrailingSpaceWidthback to summary
private float computeTrailingSpaceWidth(TextRun run)

Computes the size of the white space trailing a given run.

Parameters
run:TextRun

the run to compute trailing space width for, cannot be null

Returns:float

the X size of the white space trailing the run

copyCacheback to summary
private boolean copyCache()
createLineback to summary
private PrismTextLine createLine(int start, int end, int startOffset, float collapsedSpaceWidth)
ensureLayoutback to summary
private void ensureLayout()
getBoundsback to summary
public BaseBounds getBounds()

Implements com.sun.javafx.scene.text.TextLayout.getBounds.

Doc from com.sun.javafx.scene.text.TextLayout.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!

Annotations
@Override
getBoundsback to summary
public BaseBounds getBounds(TextSpan filter, BaseBounds bounds)

Implements com.sun.javafx.scene.text.TextLayout.getBounds.

Annotations
@Override
getCaretGeometryback to summary
public TextLayout.CaretGeometry getCaretGeometry(int offset, boolean isLeading)

Implements com.sun.javafx.scene.text.TextLayout.getCaretGeometry.

Doc from com.sun.javafx.scene.text.TextLayout.getCaretGeometry.

Queries the caret geometry and associated information at the specified text position.

Annotations
@Override
getCharCountback to summary
private int getCharCount()
getDirectionback to summary
public int getDirection()
getFontback to summary
public PGFont getFont()
getHitInfoback to summary
public TextLayout.Hit getHitInfo(float x, float y)

Implements com.sun.javafx.scene.text.TextLayout.getHitInfo.

Doc from com.sun.javafx.scene.text.TextLayout.getHitInfo.

Calculates character index and insertion index for the given coordinates and maps to Hit class.

Annotations
@Override
getLineCountback to summary
private int getLineCount()
getLineIndexback to summary
private int getLineIndex(float y)

* Text Layout Implementation * *

getLinesback to summary
public TextLine[] getLines()

Implements com.sun.javafx.scene.text.TextLayout.getLines.

Doc from com.sun.javafx.scene.text.TextLayout.getLines.

Returns the lines of text layout.

Annotations
@Override
getMirroringWidthback to summary
private float getMirroringWidth()
getRangeback to summary
public void getRange(int start, int end, int type, TextLayout.GeometryCallback client)

Implements com.sun.javafx.scene.text.TextLayout.getRange.

Doc from com.sun.javafx.scene.text.TextLayout.getRange.

Queries the range geometry of the range of text within the text layout for one of the three possible types:

Annotations
@Override
getRunsback to summary
public GlyphList[] getRuns()

Implements com.sun.javafx.scene.text.TextLayout.getRuns.

Doc from com.sun.javafx.scene.text.TextLayout.getRuns.

Returns the GlyphList of text layout. The runs are returned order visually (rendering order), starting from the first line.

Annotations
@Override
getShapeback to summary
public Shape getShape(int type, TextSpan filter)

Implements com.sun.javafx.scene.text.TextLayout.getShape.

Doc from com.sun.javafx.scene.text.TextLayout.getShape.

Returns the shape of the entire text layout relative to the baseline of the first line.

Annotations
@Override
getSpaceAdvanceback to summary
private float getSpaceAdvance()
getTextback to summary
private char[] getText()
getTextSpansback to summary
public TextSpan[] getTextSpans()
getVisualBoundsback to summary
public BaseBounds getVisualBounds(int type)

Implements com.sun.javafx.scene.text.TextLayout.getVisualBounds.

Doc from com.sun.javafx.scene.text.TextLayout.getVisualBounds.

Returns the visual bounds of the layout using glyph bounding box

Annotations
@Override
glyphLayoutback to summary
protected GlyphLayout glyphLayout()
initCacheback to summary
private void initCache()
isMirroredback to summary
private boolean isMirrored()
isSimpleLayoutback to summary
private boolean isSimpleLayout()
layoutback to summary
private void layout()
relayoutback to summary
private void relayout()
reorderLineback to summary
private void reorderLine(PrismTextLine line)
resetback to summary
private void reset()
reuseRunsback to summary
private void reuseRuns()
setAlignmentback to summary
public boolean setAlignment(int alignment)

Implements com.sun.javafx.scene.text.TextLayout.setAlignment.

Doc from com.sun.javafx.scene.text.TextLayout.setAlignment.

Sets the alignment for the TextLayout.

Annotations
@Override
setBoundsTypeback to summary
public boolean setBoundsType(int type)

Implements com.sun.javafx.scene.text.TextLayout.setBoundsType.

Doc from com.sun.javafx.scene.text.TextLayout.setBoundsType.

Sets the bounds type for the TextLayout.

Annotations
@Override
setContentback to summary
public boolean setContent(TextSpan[] spans)

Implements com.sun.javafx.scene.text.TextLayout.setContent.

* TextLayout API * *

Annotations
@Override
setContentback to summary
public boolean setContent(String text, Object font)

Implements com.sun.javafx.scene.text.TextLayout.setContent.

Doc from com.sun.javafx.scene.text.TextLayout.setContent.

Sets the content for the TextLayout. Shorthand for single span text (no rich text).

Annotations
@Override
setDirectionback to summary
public boolean setDirection(int direction)

Implements com.sun.javafx.scene.text.TextLayout.setDirection.

Doc from com.sun.javafx.scene.text.TextLayout.setDirection.

Sets the direction (bidi algorithm's) for the TextLayout.

Annotations
@Override
setLineSpacingback to summary
public boolean setLineSpacing(float spacing)

Implements com.sun.javafx.scene.text.TextLayout.setLineSpacing.

Doc from com.sun.javafx.scene.text.TextLayout.setLineSpacing.

Sets the line spacing for the TextLayout.

Annotations
@Override
setTabAdvancePolicyback to summary
public boolean setTabAdvancePolicy(int tabSize, TabAdvancePolicy policy)

Implements com.sun.javafx.scene.text.TextLayout.setTabAdvancePolicy.

Doc from com.sun.javafx.scene.text.TextLayout.setTabAdvancePolicy.

Sets the tab size and the tab advance policy for the TextLayout. A non-null policy will override the fixed tab size.

Annotations
@Override
setWrapWidthback to summary
public boolean setWrapWidth(float newWidth)

Implements com.sun.javafx.scene.text.TextLayout.setWrapWidth.

Doc from com.sun.javafx.scene.text.TextLayout.setWrapWidth.

Sets the wrap width for the TextLayout.

Annotations
@Override
shapeback to summary
private void shape(TextRun run, char[] chars, GlyphLayout layout)