JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.page
Class GlyphVectorBase

java.lang.Object
  |
  +--java.awt.font.GlyphVector
        |
        +--com.klg.jclass.page.GlyphVectorBase
All Implemented Interfaces:
Cloneable

public abstract class GlyphVectorBase
extends GlyphVector

Create a GlyphVector which will report metrics using underlying font system metrics.


Field Summary
protected  FontRenderContext fontRenderContext
           
protected  FontMetrics metrics
           
protected  String string
           
 
Fields inherited from class java.awt.font.GlyphVector
FLAG_COMPLEX_GLYPHS, FLAG_HAS_POSITION_ADJUSTMENTS, FLAG_HAS_TRANSFORMS, FLAG_MASK, FLAG_RUN_RTL
 
Constructor Summary
GlyphVectorBase(FontMetrics metrics, FontRenderContext fontRenderContext, String string)
          Create a GlyphVector which will report metrics using underlying afm/tfm/pcl font metrics.
 
Method Summary
 boolean equals(GlyphVector set)
          Tests if the specified GlyphVector exactly equals this GlyphVector.
 Font getFont()
          Returns the Font associated with this GlyphVector.
 FontRenderContext getFontRenderContext()
          Returns the FontRenderContext associated with this GlyphVector.
 int getGlyphCharIndex(int glyphIndex)
          Returns the character index of the specified glyph.
 int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries, int[] codeReturn)
          Returns the character indices of the specified glyphs.
 int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn)
          Returns an array of glyphcodes for the specified glyphs.
 GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex)
          Returns the justification information for the glyph at the specified index into this GlyphVector.
 Shape getGlyphLogicalBounds(int glyphIndex)
          Returns the logical bounds of the specified glyph within this GlyphVector.
 GlyphMetrics getGlyphMetrics(int glyphIndex)
          Returns the metrics of the glyph at the specified index into this GlyphVector.
 Shape getGlyphOutline(int glyphIndex)
          Returns a Shape whose interior corresponds to the visual representation of the specified glyph within this GlyphVector.
 Shape getGlyphOutline(int glyphIndex, float x, float y)
          Returns a Shape whose interior corresponds to the visual representation of the specified glyph within this GlyphVector, offset to x, y.
 Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC, float x, float y)
          Returns the pixel bounds of the glyph at index when this GlyphVector is rendered in a Graphics with the given FontRenderContext at the given location.
 Point2D getGlyphPosition(int glyphIndex)
          Returns the position of the specified glyph within this GlyphVector.
 float[] getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn)
          Returns and array of glyph positions for the specified glyphs.
 AffineTransform getGlyphTransform(int glyphIndex)
          Gets the transform of the specified glyph within this GlyphVector.
 Shape getGlyphVisualBounds(int glyphIndex)
          Returns the visual bounds of the specified glyph within the GlyphVector.
 int getLayoutFlags()
          Returns flags describing the global state of the GlyphVector.
 int getNumGlyphs()
          Returns the number of glyphs in this GlyphVector.
 Shape getOutline()
          Returns a Shape whose interior corresponds to the visual representation of this GlyphVector.
 Shape getOutline(float x, float y)
          Returns a Shape whose interior corresponds to the visual representation of this GlyphVector, offset to x, y.
 Rectangle getPixelBounds(FontRenderContext renderFRC, float x, float y)
          Returns the pixel bounds of this GlyphVector when rendered in a graphics with the given FontRenderContext at the given location.
 Rectangle2D getVisualBounds()
          Returns the visual bounds of this GlyphVector The visual bounds is the tightest rectangle enclosing all non-background pixels in the rendered representation of this GlyphVector.
 void performDefaultLayout()
          Assigns default positions to each glyph in this GlyphVector.
 void setGlyphPosition(int glyphIndex, Point2D newPos)
          Sets the position of the specified glyph within this GlyphVector.
 void setGlyphTransform(int glyphIndex, AffineTransform newTX)
          Sets the transform of the specified glyph within this GlyphVector.
 
Methods inherited from class java.awt.font.GlyphVector
getGlyphCode, getLogicalBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fontRenderContext

protected FontRenderContext fontRenderContext

string

protected String string

metrics

protected FontMetrics metrics
Constructor Detail

GlyphVectorBase

public GlyphVectorBase(FontMetrics metrics,
                       FontRenderContext fontRenderContext,
                       String string)
Create a GlyphVector which will report metrics using underlying afm/tfm/pcl font metrics.

Method Detail

getFont

public Font getFont()
Returns the Font associated with this GlyphVector.

Specified by:
getFont in class GlyphVector
Returns:
Font used to create this GlyphVector.
See Also:
Font

getFontRenderContext

public FontRenderContext getFontRenderContext()
Returns the FontRenderContext associated with this GlyphVector.

Specified by:
getFontRenderContext in class GlyphVector
Returns:
FontRenderContext used to create this GlyphVector.
See Also:
FontRenderContext, Font

performDefaultLayout

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

Specified by:
performDefaultLayout in class GlyphVector

getNumGlyphs

public int getNumGlyphs()
Returns the number of glyphs in this GlyphVector. This information is used to create arrays that are to be filled with results of other information retrieval operations.

Specified by:
getNumGlyphs in class GlyphVector
Returns:
number of glyphs in this GlyphVector.

getGlyphCodes

public int[] getGlyphCodes(int beginGlyphIndex,
                           int numEntries,
                           int[] codeReturn)
Returns an array of glyphcodes for 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. This method is used for convenience and performance when processing glyphcodes. If no array is passed in, an array is created.

Specified by:
getGlyphCodes in class GlyphVector
Parameters:
beginGlyphIndex - the index into this GlyphVector at which to start retrieving glyphcodes for the corresponding glyphs
numEntries - the offset from beginGlyphIndex at which to stop retrieving glyphcodes
codeReturn - the array that receives the glyphcodes and is then returned
Returns:
an array of glyphcodes for the specified glyphs.

getVisualBounds

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

Specified by:
getVisualBounds in class GlyphVector
Returns:
a Rectangle2D that is the tightest bounds of this GlyphVector.

getOutline

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

Specified by:
getOutline in class GlyphVector
Returns:
a Shape that is the outline of this GlyphVector.

getOutline

public Shape getOutline(float x,
                        float y)
Returns a Shape whose interior corresponds to the visual representation of this GlyphVector, offset to x, y.

Specified by:
getOutline in class GlyphVector
Returns:
a Shape that is the outline of this GlyphVector, offset to the specified coordinates.

getGlyphOutline

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

Specified by:
getGlyphOutline in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector
Returns:
a Shape that is the outline of the glyph at the specified glyphIndex of this GlyphVector.

getGlyphPosition

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

Specified by:
getGlyphPosition in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector
Returns:
a Point2D object that is the position of the glyph at the specified glyphIndex.

setGlyphPosition

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

Specified by:
setGlyphPosition in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector
newPos - the Point2D at which to position the glyph at the specified glyphIndex

getGlyphTransform

public AffineTransform getGlyphTransform(int glyphIndex)
Gets the transform of the specified glyph within this GlyphVector.

Specified by:
getGlyphTransform in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector
Returns:
an AffineTransform that is the transform of the glyph at the specified glyphIndex.

setGlyphTransform

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

Specified by:
setGlyphTransform in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector

getGlyphPositions

public float[] getGlyphPositions(int beginGlyphIndex,
                                 int numEntries,
                                 float[] positionReturn)
Returns and array of glyph positions for the specified glyphs. The position of each glyph corresponds to the leading edge of the baseline for that glyph. This method is used for convenience and performance when processing glyph positions. If no array is passed in, a new array is created. 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

Specified by:
getGlyphPositions in class GlyphVector
Parameters:
beginGlyphIndex - the index at which to begin retrieving glyph positions
numEntries - the offset from beginGlyphIndex at which to stop retrieving glyph positions
positionReturn - the array that receives the glyph positions and is then returned.
Returns:
an array of glyph positions specified by beginGlyphIndex and numEntries.

getGlyphLogicalBounds

public Shape getGlyphLogicalBounds(int glyphIndex)
Returns the logical bounds of the specified glyph within this 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. This method is 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.

Specified by:
getGlyphLogicalBounds in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector that corresponds to the glyph from which to retrieve its logical bounds
Returns:
a Shape that is the logical bounds of the glyph at the specified glyphIndex.
See Also:
getGlyphVisualBounds(int)

getGlyphVisualBounds

public Shape getGlyphVisualBounds(int glyphIndex)
Returns 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.

Specified by:
getGlyphVisualBounds in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector that corresponds to the glyph from which to retrieve its visual bounds
Returns:
a Shape that is the visual bounds of the glyph at the specified glyphIndex.
See Also:
getGlyphLogicalBounds(int)

getGlyphMetrics

public GlyphMetrics getGlyphMetrics(int glyphIndex)
Returns the metrics of the glyph at the specified index into this GlyphVector.

Specified by:
getGlyphMetrics in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector that corresponds to the glyph from which to retrieve its metrics
Returns:
a GlyphMetrics object that represents the metrics of the glyph at the specified glyphIndex into this GlyphVector.

getGlyphJustificationInfo

public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex)
Returns the justification information for the glyph at the specified index into this GlyphVector.

Specified by:
getGlyphJustificationInfo in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector that corresponds to the glyph from which to retrieve its justification properties
Returns:
a GlyphJustificationInfo object that represents the justification properties of the glyph at the specified glyphIndex into this GlyphVector.

equals

public boolean equals(GlyphVector set)
Tests if the specified GlyphVector exactly equals this GlyphVector.

Specified by:
equals in class GlyphVector
Parameters:
set - the specified GlyphVector to test
Returns:
true if the specified GlyphVector equals this GlyphVector; false otherwise.

getGlyphPixelBounds

public Rectangle getGlyphPixelBounds(int index,
                                     FontRenderContext renderFRC,
                                     float x,
                                     float y)
Returns the pixel bounds of the glyph at index when this GlyphVector is rendered in a Graphics with the given FontRenderContext at the given location. The renderFRC need not be the same as the FontRenderContext of this GlyphVector, and can be null. If it is null, the FontRenderContext of this GlyphVector is used.

Overrides:
getGlyphPixelBounds in class GlyphVector
Parameters:
index - the index of the glyph.
renderFRC - the FontRenderContext of the Graphics.
Returns:
a Rectangle bounding the pixels that would be affected.
Since:
1.4

getLayoutFlags

public int getLayoutFlags()
Returns flags describing the global state of the GlyphVector. Flags not described below are reserved.

Overrides:
getLayoutFlags in class GlyphVector
Returns:
an int containing the flags describing the state
Since:
1.4
See Also:
GlyphVector.FLAG_HAS_POSITION_ADJUSTMENTS, GlyphVector.FLAG_HAS_TRANSFORMS, GlyphVector.FLAG_RUN_RTL, GlyphVector.FLAG_COMPLEX_GLYPHS, GlyphVector.FLAG_MASK

getGlyphOutline

public Shape getGlyphOutline(int glyphIndex,
                             float x,
                             float y)
Returns a Shape whose interior corresponds to the visual representation of the specified glyph within this GlyphVector, offset to x, y. The outline returned by this method is positioned around the origin of each individual glyph.

Overrides:
getGlyphOutline in class GlyphVector
Parameters:
glyphIndex - the index into this GlyphVector
Returns:
a Shape that is the outline of the glyph at the specified glyphIndex of this GlyphVector when renderd at the specified coordinates.
Throws:
IndexOutOfBoundsException - if glyphIndex is less than 0 or greater than or equal to the number of glyphs in this GlyphVector
Since:
1.4

getPixelBounds

public Rectangle getPixelBounds(FontRenderContext renderFRC,
                                float x,
                                float y)
Returns the pixel bounds of this GlyphVector when rendered in a graphics with the given FontRenderContext at the given location. The renderFRC need not be the same as the FontRenderContext of this GlyphVector, and can be null. If it is null, the FontRenderContext of this GlyphVector is used.

Overrides:
getPixelBounds in class GlyphVector
Parameters:
renderFRC - the FontRenderContext of the Graphics.
x - the x-coordinate at which to render this GlyphVector.
y - the y-coordinate at which to render this GlyphVector.
Returns:
a Rectangle bounding the pixels that would be affected.
Since:
1.4

getGlyphCharIndex

public int getGlyphCharIndex(int glyphIndex)
Returns the character index of the specified glyph. The character index is the index of the first logical character represented by the glyph.

Overrides:
getGlyphCharIndex in class GlyphVector
Parameters:
glyphIndex - the index of the glyph
Returns:
the index of the first character represented by the glyph
Since:
1.4

getGlyphCharIndices

public int[] getGlyphCharIndices(int beginGlyphIndex,
                                 int numEntries,
                                 int[] codeReturn)
Returns the character indices of the specified glyphs. The character index is the index of the first logical character represented by the glyph. Indices are returned in glyph order. Use this method for convenience and performance in processing of glyphcodes. If no array is passed in, a new array is created.

Overrides:
getGlyphCharIndices in class GlyphVector
Parameters:
beginGlyphIndex - the index of the first glyph
numEntries - the number of glyph indices
codeReturn - the array into which to return the character indices
Returns:
an array of character indices, one per glyph.
Since:
1.4

Copyright © 2004 Quest Software Inc..
All rights reserved.