java.awt.font

Class TextLayout

public final class TextLayout extends Object implements Cloneable

Nested Class Summary
static classTextLayout.CaretPolicy
Inner class describing a caret policy
Field Summary
static TextLayout.CaretPolicyDEFAULT_CARET_POLICY
The default caret policy.
Constructor Summary
TextLayout(String str, Font font, FontRenderContext frc)
Constructs a TextLayout.
TextLayout(String string, Map<? extends AttributedCharacterIterator.Attribute,?> attributes, FontRenderContext frc)
TextLayout(AttributedCharacterIterator text, FontRenderContext frc)
Method Summary
protected Objectclone()
voiddraw(Graphics2D g2, float x, float y)
booleanequals(Object obj)
booleanequals(TextLayout tl)
floatgetAdvance()
floatgetAscent()
bytegetBaseline()
float[]getBaselineOffsets()
ShapegetBlackBoxBounds(int firstEndpoint, int secondEndpoint)
Rectangle2DgetBounds()
float[]getCaretInfo(TextHitInfo hit)
float[]getCaretInfo(TextHitInfo hit, Rectangle2D bounds)
ShapegetCaretShape(TextHitInfo hit)
ShapegetCaretShape(TextHitInfo hit, Rectangle2D bounds)
Shape[]getCaretShapes(int offset)
Shape[]getCaretShapes(int offset, Rectangle2D bounds)
Shape[]getCaretShapes(int offset, Rectangle2D bounds, TextLayout.CaretPolicy policy)
intgetCharacterCount()
bytegetCharacterLevel(int index)
floatgetDescent()
TextLayoutgetJustifiedLayout(float justificationWidth)
floatgetLeading()
ShapegetLogicalHighlightShape(int firstEndpoint, int secondEndpoint)
ShapegetLogicalHighlightShape(int firstEndpoint, int secondEndpoint, Rectangle2D bounds)
int[]getLogicalRangesForVisualSelection(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
TextHitInfogetNextLeftHit(int offset)
TextHitInfogetNextLeftHit(int offset, TextLayout.CaretPolicy policy)
TextHitInfogetNextLeftHit(TextHitInfo hit)
TextHitInfogetNextRightHit(int offset)
TextHitInfogetNextRightHit(int offset, TextLayout.CaretPolicy policy)
TextHitInfogetNextRightHit(TextHitInfo hit)
ShapegetOutline(AffineTransform tx)
floatgetVisibleAdvance()
ShapegetVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
ShapegetVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint, Rectangle2D bounds)
TextHitInfogetVisualOtherHit(TextHitInfo hit)
protected voidhandleJustify(float justificationWidth)
This is a protected method of a final class, meaning it exists only to taunt you.
inthashCode()
TextHitInfohitTestChar(float x, float y)
TextHitInfohitTestChar(float x, float y, Rectangle2D bounds)
Finds the character hit at the specified point.
booleanisLeftToRight()
booleanisVertical()
StringtoString()

Field Detail

DEFAULT_CARET_POLICY

public static final TextLayout.CaretPolicy DEFAULT_CARET_POLICY
The default caret policy.

Constructor Detail

TextLayout

public TextLayout(String str, Font font, FontRenderContext frc)
Constructs a TextLayout.

TextLayout

public TextLayout(String string, Map<? extends AttributedCharacterIterator.Attribute,?> attributes, FontRenderContext frc)

TextLayout

public TextLayout(AttributedCharacterIterator text, FontRenderContext frc)

Method Detail

clone

protected Object clone()

draw

public void draw(Graphics2D g2, float x, float y)

equals

public boolean equals(Object obj)

equals

public boolean equals(TextLayout tl)

getAdvance

public float getAdvance()

getAscent

public float getAscent()

getBaseline

public byte getBaseline()

getBaselineOffsets

public float[] getBaselineOffsets()

getBlackBoxBounds

public Shape getBlackBoxBounds(int firstEndpoint, int secondEndpoint)

getBounds

public Rectangle2D getBounds()

getCaretInfo

public float[] getCaretInfo(TextHitInfo hit)

getCaretInfo

public float[] getCaretInfo(TextHitInfo hit, Rectangle2D bounds)

getCaretShape

public Shape getCaretShape(TextHitInfo hit)

getCaretShape

public Shape getCaretShape(TextHitInfo hit, Rectangle2D bounds)

getCaretShapes

public Shape[] getCaretShapes(int offset)

getCaretShapes

public Shape[] getCaretShapes(int offset, Rectangle2D bounds)

getCaretShapes

public Shape[] getCaretShapes(int offset, Rectangle2D bounds, TextLayout.CaretPolicy policy)

getCharacterCount

public int getCharacterCount()

getCharacterLevel

public byte getCharacterLevel(int index)

getDescent

public float getDescent()

getJustifiedLayout

public TextLayout getJustifiedLayout(float justificationWidth)

getLeading

public float getLeading()

getLogicalHighlightShape

public Shape getLogicalHighlightShape(int firstEndpoint, int secondEndpoint)

getLogicalHighlightShape

public Shape getLogicalHighlightShape(int firstEndpoint, int secondEndpoint, Rectangle2D bounds)

getLogicalRangesForVisualSelection

public int[] getLogicalRangesForVisualSelection(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)

getNextLeftHit

public TextHitInfo getNextLeftHit(int offset)

getNextLeftHit

public TextHitInfo getNextLeftHit(int offset, TextLayout.CaretPolicy policy)

getNextLeftHit

public TextHitInfo getNextLeftHit(TextHitInfo hit)

getNextRightHit

public TextHitInfo getNextRightHit(int offset)

getNextRightHit

public TextHitInfo getNextRightHit(int offset, TextLayout.CaretPolicy policy)

getNextRightHit

public TextHitInfo getNextRightHit(TextHitInfo hit)

getOutline

public Shape getOutline(AffineTransform tx)

getVisibleAdvance

public float getVisibleAdvance()

getVisualHighlightShape

public Shape getVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)

getVisualHighlightShape

public Shape getVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint, Rectangle2D bounds)

getVisualOtherHit

public TextHitInfo getVisualOtherHit(TextHitInfo hit)

handleJustify

protected void handleJustify(float justificationWidth)
This is a protected method of a final class, meaning it exists only to taunt you.

hashCode

public int hashCode()

hitTestChar

public TextHitInfo hitTestChar(float x, float y)

hitTestChar

public TextHitInfo hitTestChar(float x, float y, Rectangle2D bounds)
Finds the character hit at the specified point. This 'clips' this text layout against the specified bounds rectangle. That means that in the case where a point is outside these bounds, this method returns the leading edge of the first character or the trailing edge of the last character.

Parameters: x the X location to test y the Y location to test bounds the bounds to test against

Returns: the character hit at the specified point

isLeftToRight

public boolean isLeftToRight()

isVertical

public boolean isVertical()

toString

public String toString()