Top 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, javafx.scene.shape.LineTo, .MoveTo, .PathElement, com.sun.javafx.font.CharToGlyphMapper, .FontResource, .FontStrike, .Metrics, .PGFont, .PrismFontFactory, com.sun.javafx.geom.BaseBounds, .Path2D, .Point2D, .RectBounds, .RoundRectangle2D, .Shape, com.sun.javafx.geom.transform.BaseTransform, .Translate2D, com.sun.javafx.scene.text.GlyphList, .TextLayout, .TextSpan

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 TextLine[]
private BaseBounds
private static final int
private static final int
private int
private TextRun[]
private Shape
private float
private TextSpan[]
private FontStrike
private static final Hashtable<Integer, LayoutCache>
private int
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

Method Summary

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

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 TextLine
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 PathElement[]
getCaretShape(int offset, boolean isLeading, float x, float y)

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

private int
public int
public PGFont
public TextLayout.Hit
getHitInfo(float
x coordinate value.
x
,
float
y coordinate value.
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 PathElement[]
getRange(int start, int end, int type, float x, float y)

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

public GlyphList[]
getRuns()

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

Returns the GlyphList of text layout.

public Shape
getShape(int
the type of the shapes to include
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

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
setTabSize(int
the number of spaces represented by a tab. Default is 8. Minimum is 1, lower values will be clamped to 1.
spaces
)

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

Sets the tab size 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 TextLine[] lines
logicalBoundsback to summary
private BaseBounds logicalBounds
MAX_CACHE_SIZEback to summary
private static final int MAX_CACHE_SIZE
MAX_STRING_SIZEback to summary
private static final int MAX_STRING_SIZE
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
tabSizeback to summary
private int tabSize
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()

Method Detail

addTextRunback to summary
public void addTextRun(TextRun run)
buildRunsback to summary
private void buildRuns(char[] chars)
computeSideBearingsback to summary
private void computeSideBearings(TextLine 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 TextLine 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!

Returns:BaseBounds

the layout bounds

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

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

Annotations
@Override
getCaretShapeback to summary
public PathElement[] getCaretShape(int offset, boolean isLeading, float x, float y)

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

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.

Parameters
x:float

x coordinate value.

y:float

y coordinate value.

Returns:TextLayout.Hit

returns a Hit object containing character index, insertion index and position of cursor on the character.

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.

Returns:TextLine[]

the text lines

Annotations
@Override
getMirroringWidthback to summary
private float getMirroringWidth()
getRangeback to summary
public PathElement[] getRange(int start, int end, int type, float x, float y)

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

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.

Returns:GlyphList[]

the runs

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.

Parameters
type:int

the type of the shapes to include

Returns:Shape

the shape

Annotations
@Override
getTabAdvanceback to summary
private float getTabAdvance()
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

Returns:BaseBounds

the visual bounds

Annotations
@Override
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(TextLine 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.

Returns:boolean

returns true is the call modifies the layout internal state.

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.

Returns:boolean

returns true is the call modifies the layout internal state.

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

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

* TextLayout API * *

Returns:boolean

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

returns true is the call modifies the layout internal state.

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).

Returns:boolean

returns true is the call modifies the layout internal state.

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.

Returns:boolean

returns true is the call modifies the layout internal state.

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.

Returns:boolean

returns true is the call modifies the layout internal state.

Annotations
@Override
setTabSizeback to summary
public boolean setTabSize(int spaces)

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

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

Sets the tab size for the TextLayout.

Parameters
spaces:int

the number of spaces represented by a tab. Default is 8. Minimum is 1, lower values will be clamped to 1.

Returns:boolean

returns true if the call modifies the layout internal state.

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.

Returns:boolean

returns true is the call modifies the layout internal state.

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