Java Platform 1.2
Beta 4

Class java.awt.font.TextLayout

java.lang.Object
  |
  +--java.awt.font.TextLayout

public final class TextLayout
extends Object
implements Cloneable
TextLayout is an immutable graphical representation of styled character data.

It provides the following capabilities:

TextLayout can be rendered by calling Graphics2D.drawString passing an instance of TextLayout and a position as the arguments.

TextLayout can be constructed either directly or through use of a LineBreakMeasurer. When constructed directly, the source text represents a single paragraph. LineBreakMeasurer provides support for line breaking to support wrapped text, see its documentation for more information.

TextLayout construction logically proceeds as follows:

All graphical information returned from TextLayout's methods is relative to the origin of the TextLayout, which is the intersection of the TextLayout's baseline with its left edge. Also, coordinates passed into TextLayout's methods are assumed to be relative to the TextLayout's origin. Clients will usually need to translate between TextLayout's coordinate system and the coordinate system in another object (such as a Graphics).

TextLayouts are constructed from styled text, but they do not retain a reference to their source text. Thus, changes in the text previously used to generate a TextLayout do not affect the TextLayout.

Three methods on TextLayout (getNextRightHit, getNextLeftHit, and hitTestChar) return instances of TextHitInfo. The offsets contained in these TextHitInfo's are relative to the start of the TextLayout, not to the text used to create the TextLayout. Similarly, TextLayout methods which accept TextHitInfo instances as parameters expect the TextHitInfo's offsets to be relative to the TextLayout, not to any underlying text storage model.

Examples:

Constructing and drawing a TextLayout and its bounding rectangle:

   Graphics2D g = ...;
   Point2D loc = ...;
   Font font = Font.getFont("Helvetica-bold-italic");
   TextLayout layout = new TextLayout("This is a string", font);
   g.drawString(layout, loc.getX(), loc.getY());

   Rectangle2D bounds = layout.getBounds();
   bounds.setRect(bounds.getX()+loc.getX(),
                  bounds.getY()+loc.getY(),
                  bounds.getWidth(),
                  bounds.getHeight())
   g.draw(bounds);
 

Hit-testing a TextLayout (determining which character is at a particular graphical location):

   Point2D click = ...;
   TextHitInfo hit = layout.hitTestChar(
                         (float) (click.getX() - loc.getX()),
                         (float) (click.getY() - loc.getY()));
 

Responding to a right-arrow key press:

   int insertionIndex = ...;
   TextHitInfo next = layout.getNextRightHit(insertionIndex);
   if (next != null) {
       // translate graphics to origin of layout on screen
       g.translate(loc.getX(), loc.getY());
       Shape[] carets = layout.getCaretShapes(next.getInsertionIndex());
       g.draw(carets[0]);
       if (carets[1] != null) {
           g.draw(carets[1]);
       }
   }
 

Drawing a selection range corresponding to a substring in the source text. The selected area may not be visually contiguous:

   // selStart, selLimit should be relative to the layout,
   // not to the source text

   int selStart = ..., selLimit = ...;
   Color selectionColor = ...;
   Shape selection = layout.getLogicalHighlightShape(selStart, selLimit);
   // selection may consist of disjoint areas
   // graphics is assumed to be tranlated to origin of layout
   g.setColor(selectionColor);
   g.fill(selection);
 

Drawing a visually contiguous selection range. The selection range may correspond to more than one substring in the source text. The ranges of the corresponding source text substrings can be obtained with getLogicalRangesForVisualSelection():

   TextHitInfo selStart = ..., selLimit = ...;
   Shape selection = layout.getVisualHighlightSelection(selStart, selLimit);
   g.setColor(selectionColor);
   g.fill(selection);
   int[] ranges = getLogicalRangesForVisualSelection(selStart, selLimit);
   // ranges[0], ranges[1] is the first selection range,
   // ranges[2], ranges[3] is the second selection range, etc.
 

See Also:
LineBreakMeasurer, TextAttribute, TextHitInfo

Inner Class Summary
static  TextLayout.CaretPolicy
          Define a policy for determining the strong caret location.
 
Field Summary
static TextLayout.CaretPolicy DEFAULT_CARET_POLICY
          This CaretPolicy is used when a policy is not specified by the client.
 
Constructor Summary
TextLayout(AttributedCharacterIterator text, FontRenderContext frc)
          Construct a layout from an iterator over styled text.
TextLayout(String string, Font font, FontRenderContext frc)
          Construct a layout from a string and a font.
TextLayout(String string, Map attributes, FontRenderContext frc)
          Construct a layout from a string and an attribute set.
 
Method Summary
protected  Object clone()
          Create a copy of this layout.
 void draw(Graphics2D g2, float x, float y)
          Render the layout at the provided location in the graphics.
 boolean equals(Object obj)
          Return true if the object is a TextLayout and this equals the object.
 boolean equals(TextLayout rhs)
          Return true if the two layouts are equal.
 float getAdvance()
          Return the advance of the layout.
 float getAscent()
          Return the ascent of the layout.
 byte getBaseline()
          Return the baseline for this layout.
 float[] getBaselineOffsets()
          Return the offsets array for the baselines used for this layout.
 Shape getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
          Return the black box bounds of the characters in the given range.
 Rectangle2D getBounds()
          Return the bounds of the layout.
 float[] getCaretInfo(TextHitInfo hit, Rectangle2D bounds)
          Return information about the caret corresponding to hit.
 float[] getCaretInfo(TextHitInfo hit)
          A convenience overload using the natural bounds of this layout.
 Shape getCaretShape(TextHitInfo hit, Rectangle2D bounds)
          Return a shape representing the caret at hit inside the given bounds.
 Shape getCaretShape(TextHitInfo hit)
          Return a shape representing the caret at hit.
 Shape[] getCaretShapes(int offset, Rectangle2D bounds, TextLayout.CaretPolicy policy)
          Return two paths corresponding to the strong and weak caret.
 Shape[] getCaretShapes(int offset, Rectangle2D bounds)
          A convenience overload that uses the default caret policy.
 Shape[] getCaretShapes(int offset)
          A convenience overload that uses the natural bounds of the layout as the bounds, and the default caret policy.
 int getCharacterCount()
          Return the number of characters represented by this layout.
 byte getCharacterLevel(int index)
          Return the level of the character at index.
 float getDescent()
          Return the descent of the layout.
 TextLayout getJustifiedLayout(float justificationWidth)
          Create a copy of this layout justified to the given width.
 float getLeading()
          Return the leading of the layout.
 Shape getLogicalHighlightShape(int firstEndpoint, int secondEndpoint, Rectangle2D bounds)
          Return a path enclosing the logical selection in the given range, extended to bounds.
 Shape getLogicalHighlightShape(int firstEndpoint, int secondEndpoint)
          A convenience overload which uses the natural bounds of the layout.
 int[] getLogicalRangesForVisualSelection(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
          Return the logical ranges of text corresponding to a visual selection.
 TextHitInfo getNextLeftHit(int offset, TextLayout.CaretPolicy policy)
          Return the hit for the next caret to the left (top); if no such hit, return null.
 TextHitInfo getNextLeftHit(int offset)
          Return the hit for the next caret to the left (top); if no such hit, return null.
 TextHitInfo getNextLeftHit(TextHitInfo hit)
          Return the hit for the next caret to the left (top); if no such hit, return null.
 TextHitInfo getNextRightHit(int offset, TextLayout.CaretPolicy policy)
          Return the hit for the next caret to the right (bottom); if no such hit, return null.
 TextHitInfo getNextRightHit(int offset)
          Return the hit for the next caret to the right (bottom); if no such hit, return null.
 TextHitInfo getNextRightHit(TextHitInfo hit)
          Return the hit for the next caret to the right (bottom); if no such hit, return null.
 Shape getOutline(AffineTransform tx, float x, float y)
           
 float getVisibleAdvance()
          Return the advance of the layout, minus trailing whitespace.
 Shape getVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint, Rectangle2D bounds)
          Return a path enclosing the visual selection in the given range, extended to bounds.
 Shape getVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
          A convenience overload which uses the natural bounds of the layout.
 TextHitInfo getVisualOtherHit(TextHitInfo hit)
          Return the hit on the opposite side of this hit's caret.
protected  void handleJustify(float justificationWidth)
          Justify this layout.
 int hashCode()
          Return the hash code of this layout.
 TextHitInfo hitTestChar(float x, float y, Rectangle2D bounds)
          Return a TextHitInfo corresponding to the point.
 TextHitInfo hitTestChar(float x, float y)
          A convenience overload which uses the natural bounds of the layout.
 boolean isLeftToRight()
          Return true if the layout is left-to-right.
 boolean isVertical()
          Return true if the layout is vertical.
 String toString()
          Return debugging information for the layout.
 
Methods inherited from class java.lang.Object
finalize , getClass , notify , notifyAll , wait , wait , wait
 

Field Detail

DEFAULT_CARET_POLICY

public static final TextLayout.CaretPolicy DEFAULT_CARET_POLICY
This CaretPolicy is used when a policy is not specified by the client. With this policy, a hit on a character whose direction is the same as the line direction is stronger than a hit on a counterdirectional character. If the characters' directions are the same, a hit on the leading edge of a character is stronger than a hit on the trailing edge of a character.
Constructor Detail

TextLayout

public TextLayout(String string,
                  Font font,
                  FontRenderContext frc)
Construct a layout from a string and a font. All the text is styled using the provided font. The string must specify a single paragraph of text, as an entire paragraph is required for the bidirectional algorithm.
Parameters:
str - the text to display.
font - a font used to style the text.

TextLayout

public TextLayout(String string,
                  Map attributes,
                  FontRenderContext frc)
Construct a layout from a string and an attribute set.

All the text is styled using the provided attributes.

The string must specify a single paragraph of text, as an entire paragraph is required for the bidirectional algorithm.

Parameters:
str - the text to display.
attributes - the attributes used to style the text.

TextLayout

public TextLayout(AttributedCharacterIterator text,
                  FontRenderContext frc)
Construct a layout from an iterator over styled text.

The iterator must specify a single paragraph of text, as an entire paragraph is required for the bidirectional algorithm.

Parameters:
text - the styled text to display.
Method Detail

clone

protected Object clone()
Create a copy of this layout.
Overrides:
clone in class Object

getJustifiedLayout

public TextLayout getJustifiedLayout(float justificationWidth)
Create a copy of this layout justified to the given width.

If this layout has already been justified, an exception is thrown. If this layout's justification ratio is zero, a layout identical to this one is returned.

Parameters:
justificationWidth - the width to use when justifying the line. For best results, it should not be too different from the current advance of the line.
Returns:
a layout justified to the given width.
Throws:
Error - if this layout has already been justified, an Error is thrown.

handleJustify

protected void handleJustify(float justificationWidth)
Justify this layout. Overridden by subclassers to control justification (if there were subclassers, that is...) The layout will only justify if the paragraph attributes (from the source text, possibly defaulted by the layout attributes) indicate a non-zero justification ratio. The text will be justified to the indicated width. The current implementation also adjusts hanging punctuation and trailing whitespace to overhang the justification width. Once justified, the layout may not be rejustified.

Some code may rely on immutablity of layouts. Subclassers should not call this directly, but instead should call getJustifiedLayout, which will call this method on a clone of this layout, preserving the original.

Parameters:
justificationWidth - the width to use when justifying the line. For best results, it should not be too different from the current advance of the line.
See Also:
getJustifiedLayout(float)

getBaseline

public byte getBaseline()
Return the baseline for this layout. The baseline is one of the values defined in Font (roman, centered, hanging). Ascent and descent are relative to this baseline. The baselineOffsets are also relative to this baseline.
See Also:
getBaselineOffsets(), Font

getBaselineOffsets

public float[] getBaselineOffsets()
Return the offsets array for the baselines used for this layout.

The array is indexed by one of the values defined in Font (roman, centered, hanging). The values are relative to this layout's baseline, so that getBaselineOffsets[getBaseline()] == 0. Offsets are added to the position of the layout's baseline to get the position for the new baseline.

See Also:
getBaseline(), Font

getAdvance

public float getAdvance()
Return the advance of the layout. The advance is the distance from the origin to the advance of the rightmost (bottommost) character measuring in the line direction.

getVisibleAdvance

public float getVisibleAdvance()
Return the advance of the layout, minus trailing whitespace.
See Also:
getAdvance()

getAscent

public float getAscent()
Return the ascent of the layout. The ascent is the distance from the top (right) of the layout to the baseline. It is always positive or zero. The ascent is sufficient to accomodate superscripted text and is the maximum of the sum of the the ascent, offset, and baseline of each glyph.

getDescent

public float getDescent()
Return the descent of the layout. The descent is the distance from the baseline to the bottom (left) of the layout. It is always positive or zero. The descent is sufficient to accomodate subscripted text and is maximum of the sum of the descent, offset, and baseline of each glyph.

getLeading

public float getLeading()
Return the leading of the layout. The leading is the suggested interline spacing for this layout.

The leading is computed from the leading, descent, and baseline of all glyphsets in the layout. The algorithm is roughly as follows:

 maxD = 0;
 maxDL = 0;
 for (GlyphSet g in all glyphsets) {
    maxD = max(maxD, g.getDescent() + offsets[g.getBaseline()]);
    maxDL = max(maxDL, g.getDescent() + g.getLeading() +
                       offsets[g.getBaseline()]);
 }
 return maxDL - maxD;
 

getBounds

public Rectangle2D getBounds()
Return the bounds of the layout. This contains all of the pixels the layout can draw. It may not coincide exactly with the ascent, descent, origin or advance of the layout.

isLeftToRight

public boolean isLeftToRight()
Return true if the layout is left-to-right. The layout has a base direction of either left-to-right (LTR) or right-to-left (RTL). This is independent of the actual direction of text on the line, which may be either or mixed. Left-to-right layouts by default should position flush left, and if on a tabbed line, the tabs run left to right, so that logically successive layouts position left to right. The opposite is true for RTL layouts. By default they should position flush left, and tabs run right-to-left. On vertical lines all text runs top-to-bottom, and is treated as LTR.

isVertical

public boolean isVertical()
Return true if the layout is vertical.

getCharacterCount

public int getCharacterCount()
Return the number of characters represented by this layout.

getCaretInfo

public float[] getCaretInfo(TextHitInfo hit,
                            Rectangle2D bounds)
Return information about the caret corresponding to hit. The first element of the array is the intersection of the caret with the baseline. The second element of the array is the slope (run/rise) of the caret.

This method is meant for informational use. To display carets, it is better to use getCaretShapes.

Parameters:
hit - a hit on a character in this layout
bounds - the bounds to which the caret info is constructed
Returns:
a two-element array containing the position and slope of the caret
See Also:
getCaretShapes(int, java.awt.geom.Rectangle2D, java.awt.font.TextLayout.CaretPolicy)

getCaretInfo

public float[] getCaretInfo(TextHitInfo hit)
A convenience overload using the natural bounds of this layout.

getNextRightHit

public TextHitInfo getNextRightHit(TextHitInfo hit)
Return the hit for the next caret to the right (bottom); if no such hit, return null. If the hit character index is out of bounds, an IllegalArgumentException is thrown.
Parameters:
hit - a hit on a character in this layout.
Returns:
a hit whose caret appears at the next position to the right (bottom) of the caret of the provided hit, or null.

getNextRightHit

public TextHitInfo getNextRightHit(int offset,
                                   TextLayout.CaretPolicy policy)
Return the hit for the next caret to the right (bottom); if no such hit, return null. The hit is to the right of the strong caret at the given offset, as determined by the given caret policy. The returned hit is the stronger of the two possible hits, as determined by the given caret policy.
Parameters:
offset - An insertion offset in this layout. Cannot be less than 0 or greater than the layout's character count.
policy - The policy used to select the strong caret.
Returns:
a hit whose caret appears at the next position to the right (bottom) of the caret of the provided hit, or null.

getNextRightHit

public TextHitInfo getNextRightHit(int offset)
Return the hit for the next caret to the right (bottom); if no such hit, return null. The hit is to the right of the strong caret at the given offset, as determined by the default caret policy. The returned hit is the stronger of the two possible hits, as determined by the default caret policy.
Parameters:
offset - An insertion offset in this layout. Cannot be less than 0 or greater than the layout's character count.
Returns:
a hit whose caret appears at the next position to the right (bottom) of the caret of the provided hit, or null.

getNextLeftHit

public TextHitInfo getNextLeftHit(TextHitInfo hit)
Return the hit for the next caret to the left (top); if no such hit, return null. If the hit character index is out of bounds, an IllegalArgumentException is thrown.
Parameters:
hit - a hit on a character in this layout.
Returns:
a hit whose caret appears at the next position to the left (top) of the caret of the provided hit, or null.

getNextLeftHit

public TextHitInfo getNextLeftHit(int offset,
                                  TextLayout.CaretPolicy policy)
Return the hit for the next caret to the left (top); if no such hit, return null. The hit is to the left of the strong caret at the given offset, as determined by the given caret policy. The returned hit is the stronger of the two possible hits, as determined by the given caret policy.
Parameters:
offset - An insertion offset in this layout. Cannot be less than 0 or greater than the layout's character count.
policy - The policy used to select the strong caret.
Returns:
a hit whose caret appears at the next position to the left (top) of the caret of the provided hit, or null.

getNextLeftHit

public TextHitInfo getNextLeftHit(int offset)
Return the hit for the next caret to the left (top); if no such hit, return null. The hit is to the left of the strong caret at the given offset, as determined by the default caret policy. The returned hit is the stronger of the two possible hits, as determined by the default caret policy.
Parameters:
offset - An insertion offset in this layout. Cannot be less than 0 or greater than the layout's character count.
Returns:
a hit whose caret appears at the next position to the left (top) of the caret of the provided hit, or null.

getVisualOtherHit

public TextHitInfo getVisualOtherHit(TextHitInfo hit)
Return the hit on the opposite side of this hit's caret.

getCaretShape

public Shape getCaretShape(TextHitInfo hit,
                           Rectangle2D bounds)
Return a shape representing the caret at hit inside the given bounds.
Parameters:
hit - the hit at which to generate the caret.
bounds - the bounds of the layout to use in generating the caret.
Returns:
A shape representing the caret.

getCaretShape

public Shape getCaretShape(TextHitInfo hit)
Return a shape representing the caret at hit. This uses the natural bounds of the layout.
Parameters:
hit - the hit at which to generate the caret.
Returns:
a shape representing the caret.

getCharacterLevel

public byte getCharacterLevel(int index)
Return the level of the character at index. Indices -1 and characterCount are assigned the base level of the layout.

getCaretShapes

public Shape[] getCaretShapes(int offset,
                              Rectangle2D bounds,
                              TextLayout.CaretPolicy policy)
Return two paths corresponding to the strong and weak caret.
Parameters:
offset - an offset in the layout
bounds - the bounds to which to extend the carets
Returns:
an array of two paths. Element zero is the strong caret (if any) or null. Element one is the weak caret (if any) or null. Element 0 and element 1 are never both null.

getCaretShapes

public Shape[] getCaretShapes(int offset,
                              Rectangle2D bounds)
A convenience overload that uses the default caret policy.

getCaretShapes

public Shape[] getCaretShapes(int offset)
A convenience overload that uses the natural bounds of the layout as the bounds, and the default caret policy.

getLogicalRangesForVisualSelection

public int[] getLogicalRangesForVisualSelection(TextHitInfo firstEndpoint,
                                                TextHitInfo secondEndpoint)
Return the logical ranges of text corresponding to a visual selection.
Parameters:
firstEndpoint - an endpoint of the visual range.
secondEndpoint - the other enpoint of the visual range. Can be less than firstEndpoint.
Returns:
an array of integers representing start/limit pairs for the selected ranges
See Also:
getVisualHighlightShape(java.awt.font.TextHitInfo, java.awt.font.TextHitInfo, java.awt.geom.Rectangle2D)

getVisualHighlightShape

public Shape getVisualHighlightShape(TextHitInfo firstEndpoint,
                                     TextHitInfo secondEndpoint,
                                     Rectangle2D bounds)
Return a path enclosing the visual selection in the given range, extended to bounds.

If the selection includes the leftmost (topmost) position, the selection is extended to the left (top) of the bounds. If the selection includes the rightmost (bottommost) position, the selection is extended to the right (bottom) of the bounds. The height (width on vertical lines) of the selection is always extended to bounds.

Although the selection is always contiguous, the logically selected text can be discontiguous on lines with mixed-direction text. The logical ranges of text selected can be retrieved using getLogicalRangesForVisualSelection. For example, consider the text 'ABCdef' where capital letters indicate right-to-left text, rendered on a right-to-left line, with a visual selection from 0L (the leading edge of 'A') to 3T (the trailing edge of 'd'). The text appears as follows, with bold underlined areas representing the selection:

    defCBA  
 
The logical selection ranges are 0-3, 4-6 (ABC, ef) because the visually contiguous text is logically discontiguous. Also note that since the rightmost position on the layout (to the right of 'A') is selected, the selection is extended to the right of the bounds.
Parameters:
firstEndpoint - one end of the visual selection
secondEndpoint - the other end of the visual selection
bounds - the bounding rectangle to which to extend the selection
Returns:
an area enclosing the selection
See Also:
getLogicalRangesForVisualSelection(java.awt.font.TextHitInfo, java.awt.font.TextHitInfo), getLogicalHighlightShape(int, int, java.awt.geom.Rectangle2D)

getVisualHighlightShape

public Shape getVisualHighlightShape(TextHitInfo firstEndpoint,
                                     TextHitInfo secondEndpoint)
A convenience overload which uses the natural bounds of the layout.

getLogicalHighlightShape

public Shape getLogicalHighlightShape(int firstEndpoint,
                                      int secondEndpoint,
                                      Rectangle2D bounds)
Return a path enclosing the logical selection in the given range, extended to bounds.

If the selection range includes the first logical character, the selection is extended to the portion of bounds before the start of the layout. If the range includes the last logical character, the selection is extended to the portion of bounds after the end of the layout. The height (width on vertical lines) of the selection is always extended to bounds.

The selection can be discontiguous on lines with mixed-direction text. Only those characters in the logical range between start and limit will appear selected. For example consider the text 'ABCdef' where capital letters indicate right-to-left text, rendered on a right-to-left line, with a logical selection from 0 to 4 ('ABCd'). The text appears as follows, with bold standing in for the selection, and underlining for the extension:

    defCBA  
 
The selection is discontiguous because the selected characters are visually discontiguous. Also note that since the range includes the first logical character (A), the selection is extended to the portion of the bounds before the start of the layout, which in this case (a right-to-left line) is the right portion of the bounds.
Parameters:
firstEndpoint - an endpoint in the range of characters to select
secondEndpoint - the other endpoint of the range of characters to select. Can be less than firstEndpoint. The range includes the character at min(firstEndpoint, secondEndpoint), but excludes max(firstEndpoint, secondEndpoint).
bounds - the bounding rectangle to which to extend the selection
Returns:
an area enclosing the selection
See Also:
getVisualHighlightShape(java.awt.font.TextHitInfo, java.awt.font.TextHitInfo, java.awt.geom.Rectangle2D)

getLogicalHighlightShape

public Shape getLogicalHighlightShape(int firstEndpoint,
                                      int secondEndpoint)
A convenience overload which uses the natural bounds of the layout.

getBlackBoxBounds

public Shape getBlackBoxBounds(int firstEndpoint,
                               int secondEndpoint)
Return the black box bounds of the characters in the given range. The black box bounds is an area consisting of the union of the bounding boxes of all the glyphs corresponding to the characters between start and limit. This path may be disjoint.
Parameters:
firstEndpoint - one end of the character range
secondEndpoint - the other end of the character range. Can be less than firstEndpoint.
Returns:
a path enclosing the black box bounds

hitTestChar

public TextHitInfo hitTestChar(float x,
                               float y,
                               Rectangle2D bounds)
Return a TextHitInfo corresponding to the point. Coordinates outside the bounds of the layout map to hits on the leading edge of the first logical character, or the trailing edge of the last logical character, as appropriate, regardless of the position of that character in the line. Only the direction along the baseline is used to make this evaluation.
Parameters:
x - the x offset from the origin of the layout
y - the y offset from the origin of the layout
Returns:
a hit describing the character and edge (leading or trailing) under the point

hitTestChar

public TextHitInfo hitTestChar(float x,
                               float y)
A convenience overload which uses the natural bounds of the layout.

hashCode

public int hashCode()
Return the hash code of this layout.
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Return true if the object is a TextLayout and this equals the object.
Overrides:
equals in class Object

equals

public boolean equals(TextLayout rhs)
Return true if the two layouts are equal. Two layouts are equal if they contain equal glyphsets in the same order.
Parameters:
layout - the layout to which to compare this layout.

toString

public String toString()
Return debugging information for the layout.
Overrides:
toString in class Object

draw

public void draw(Graphics2D g2,
                 float x,
                 float y)
Render the layout at the provided location in the graphics. The origin of the layout is placed at x, y. Rendering may touch any point within getBounds() of this position. This leaves the graphics unchanged.
Parameters:
g2 - the graphics into which to render the layout
x - the x position for the origin of the layout
y - the y position for the origin of the layout
See Also:
getBounds()

getOutline

public Shape getOutline(AffineTransform tx,
                        float x,
                        float y)

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.