Java Platform 1.2
Beta 4

Class java.awt.font.GlyphVector

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

public abstract class GlyphVector
extends Object
implements Cloneable
GlyphVector is a collection of Glyphs containing geometric information for the placement the GlyphVector and of each Glyph in a transformed coordinate space which should correspond to the device on which the GlyphVector is ultimately to be displayed. The GlyphVector does not attempt any interpretation of the sequence of Glyphs it contains. Relationships between adjacent Glyphs in sequence are solely used in determination of placement of the Glyphs in the visual coordinate space.

Instances of GlyphVector are created by a Font.

In a text processing application which can cache intermediate representations of text, creation and subsequent caching of a GlyphVector for use during rendering is the fastest method to present the visual representation of characters to a user.

A GlyphVector is associated with exactly one Font, and can provide data useful only in relation to the Font specified for the GlyphVector. In addition, metrics obtained from a GlyphVector are not generally geometrically scaleable since the pixelization and spacing are dependent on grid-fitting algorithms within a Font. To facilitate accurate measurement of a GlyphVector and its component Glyphs, you must specify a scaling transform, anti-alias mode, and fractional metrics mode at the time the GlyphVector is created. (These characteristics can be derived from the destination device.)

For each Glyph in the GlyphVector, you may obtain: 1) the position of the Glyph 2) the transform associated with the Glyph 3) the metrics of the Glyph in the context of the GlyphVector (the metrics of the Glyph may be different under different transforms, application specified rendering hints, and the specific instance of the Glyph within the GlyphVector)

GlyphVectors are immutable. There are no means provided to alter the state of the GlyphVector. Altering the data used to create the GlyphVector will not alter the state of the GlyphVector.

Methods are provided to create new GlyphVectors which are the result of editing editing operations on the GlyphVector such as Glyph insertion and deletion. These methods are most appropriate to applications which are forming combinations such as ligatures from existing Glyphs or are breaking such combinations into their component parts for visual presentation.

Methods are provided to create new GlyphVectors which are the result of specifying new positions for the Glyphs within the GlyphVector. These methods are most appropriate to applications which are performing justification operations for the presentation of the Glyphs.

Methods are provided to return both the visual and logical bounds of the entire GlyphVector or of individual Glyphs within the GlyphVector.

Methods are provided to return a Shape for the GlyphVector, and for individual Glyphs within the GlyphVector.

See Also:
Font, GlyphMetrics, TextLayout

Constructor Summary
GlyphVector()
           
 
Method Summary
abstract  boolean equals(GlyphVector set)
          Test for complete equality.
abstract  Font getFont()
          Return the Font associated with this GlyphVector.
abstract  FontRenderContext getFontRenderContext()
          Return the FontRenderContext associated with this GlyphVector.
abstract  int getGlyphCode(int glyphIndex)
          Return the glyphcode of the specified Glyph.
abstract  int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn)
          Return and array of glyphcodes for the the specified Glyphs.
abstract  GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex)
           
abstract  Shape getGlyphLogicalBounds(int glyphIndex)
          Return the logical bounds of the specified Glyph within the GlyphVector.
abstract  GlyphMetrics getGlyphMetrics(int glyphIndex)
           
abstract  Shape getGlyphOutline(int glyphIndex)
          Return a Shape whose interior corresponds to the visual representation of the specified glyph within the GlyphVector.
abstract  Point2D getGlyphPosition(int glyphIndex)
          Return the position of the specified glyph within the GlyphVector.
abstract  float[] getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn)
          Return and array of glyph positions for the the specified Glyphs.
abstract  AffineTransform getGlyphTransform(int glyphIndex)
          Get the transform of the specified glyph within the GlyphVector.
abstract  Shape getGlyphVisualBounds(int glyphIndex)
          Return the visual bounds of the specified Glyph within the GlyphVector.
abstract  Rectangle2D getLogicalBounds()
          Return the logical bounds of this GlyphVector.
abstract  int getNumGlyphs()
          Return the number of Glyphs in this GlyphVector, you should Use this information to create arrays which are to be filled with results of other information retreival operations.
abstract  Shape getOutline()
          Return a Shape whose interior corresponds to the visual representation of the GlyphVector.
abstract  Shape getOutline(float x, float y)
          Return a Shape whose interior corresponds to the visual representation of the GlyphVector.
abstract  Rectangle2D getVisualBounds()
          Return the visual bounds of this GlyphVector The visual bounds is tightest Rectangle enclosing all non-background pixels in the rendered representation of the GlyphVector.
abstract  void performDefaultLayout()
          Assigns default positions to each glyph in the GlyphVector.
abstract  void setGlyphPosition(int glyphIndex, Point2D newPos)
          Set the position of the specified glyph within the GlyphVector.
abstract  void setGlyphTransform(int glyphIndex, AffineTransform newTX)
          Set the transform of the specified glyph within the GlyphVector.
 
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

Constructor Detail

GlyphVector

public GlyphVector()
Method Detail

getFont

public abstract Font getFont()
Return the Font associated with this GlyphVector.
Returns:
Font used to create this GlyphVector
See Also:
Font

getFontRenderContext

public abstract FontRenderContext getFontRenderContext()
Return the FontRenderContext associated with this GlyphVector.
Returns:
FontRenderContext used to create this GlyphVector
See Also:
FontRenderContext, Font

performDefaultLayout

public abstract void performDefaultLayout()
Assigns default positions to each glyph in the GlyphVector. No shaping, reordering, or contextual substitution is performed.

getNumGlyphs

public abstract int getNumGlyphs()
Return the number of Glyphs in this GlyphVector, you should Use this information to create arrays which are to be filled with results of other information retreival operations.
Returns:
number of Glyphs in this GlyphVector

getGlyphCode

public abstract int getGlyphCode(int glyphIndex)
Return the glyphcode of the specified Glyph. This return value is meaningless to anything other than a Font and can be used to ask the Font about the existing of ligatures and other context sensitive information.
See Also:
Font#getLigature

getGlyphCodes

public abstract int[] getGlyphCodes(int beginGlyphIndex,
                                    int numEntries,
                                    int[] codeReturn)
Return and array of glyphcodes for the the specified Glyphs. The contents of this return value are meaningless to anything other than a Font and can be used to ask the Font about the existence of ligatures and other context sensitive information. Use this method for convenience and performance in processing of glyphcodes. If no array is passed in, one will be created for you.
See Also:
Font#getLigature

getLogicalBounds

public abstract Rectangle2D getLogicalBounds()
Return the logical bounds of this GlyphVector. Use when positioning this GlyphVector in relation to visually adjacent GlyphVectors.

getVisualBounds

public abstract Rectangle2D getVisualBounds()
Return the visual bounds of this GlyphVector The visual bounds is tightest Rectangle enclosing all non-background pixels in the rendered representation of the GlyphVector.

getOutline

public abstract Shape getOutline()
Return a Shape whose interior corresponds to the visual representation of the GlyphVector.

getOutline

public abstract Shape getOutline(float x,
                                 float y)
Return a Shape whose interior corresponds to the visual representation of the GlyphVector. Offset to x, y

getGlyphOutline

public abstract Shape getGlyphOutline(int glyphIndex)
Return a Shape whose interior corresponds to the visual representation of the specified glyph within the GlyphVector.

getGlyphPosition

public abstract Point2D getGlyphPosition(int glyphIndex)
Return the position of the specified glyph within the GlyphVector. This position corresponds to the leading edge of the baseline for the glyph.

setGlyphPosition

public abstract void setGlyphPosition(int glyphIndex,
                                      Point2D newPos)
Set the position of the specified glyph within the GlyphVector. This position corresponds to the leading edge of the baseline for the glyph.

getGlyphTransform

public abstract AffineTransform getGlyphTransform(int glyphIndex)
Get the transform of the specified glyph within the GlyphVector.

setGlyphTransform

public abstract void setGlyphTransform(int glyphIndex,
                                       AffineTransform newTX)
Set the transform of the specified glyph within the GlyphVector. This can be used to rotate, mirror, translate and scale the glyph. Adding a transform can result in signifant performance changes.

getGlyphPositions

public abstract float[] getGlyphPositions(int beginGlyphIndex,
                                          int numEntries,
                                          float[] positionReturn)
Return and array of glyph positions for the the specified Glyphs. The position of each glyph corresponds to the leading edge of the baseline for that glyph. Use this method for convenience and performance in processing of glyph positions. If no array is passed in, one will be created for you. Even numbered array entries beginning with position zero are the X coordinates of the glyph numbered beginGlyphIndex + position/2 Odd numbered array entries beginning with position one are the Y coordinates of the glyph numbered beginGlyphIndex + (position-1)/2

getGlyphLogicalBounds

public abstract Shape getGlyphLogicalBounds(int glyphIndex)
Return the logical bounds of the specified Glyph within the GlyphVector. These logical bounds have a total of four edges, with two edges parallel to the baseline under the glyph's transform and the other two edges are shared with adjacent glyphs if they are present. Useful for hit-testing of the specified glyph, positioning of a caret at the leading or trailing edge of a glyph, and for drawing a highlight region around the specified glyph.
See Also:
getGlyphVisualBounds(int)

getGlyphVisualBounds

public abstract Shape getGlyphVisualBounds(int glyphIndex)
Return the visual bounds of the specified Glyph within the GlyphVector. These visual bounds have a total of four edges, representing the tightest polygon enclosing non-background pixels in the rendered representation of the Glyph whose edges are parallel to the edges of the logical bounds. Useful for hit-testing of the specified glyph.
See Also:
getGlyphLogicalBounds(int)

getGlyphMetrics

public abstract GlyphMetrics getGlyphMetrics(int glyphIndex)

getGlyphJustificationInfo

public abstract GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex)

equals

public abstract boolean equals(GlyphVector set)
Test for complete equality.

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.