Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.font.GlyphVector
gnu.java.awt.font.GNUGlyphVector
public class GNUGlyphVector
extends GlyphVector
Field Summary |
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 | |
|
Method Summary | |
boolean |
|
Font |
|
FontRenderContext |
|
int |
|
int[] |
|
GlyphJustificationInfo |
|
Shape |
|
GlyphMetrics |
|
Shape |
|
Shape |
|
Point2D |
|
float[] |
|
AffineTransform |
|
Shape |
|
int |
|
Rectangle2D | |
int |
|
Shape |
|
Shape |
|
Shape |
|
Rectangle2D | |
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public GNUGlyphVector(FontDelegate fontDelegate, Font font, FontRenderContext renderContext, int[] glyphs)
Constructs a new GNUGlyphVector.
- Parameters:
fontDelegate
- the FontDelegate that creates this vector.font
- the Font that this GlyphVector will return forgetFont()
. That object is also used to determine the point size, which affects the affine transformation used by the font scaler.renderContext
- an object with parameters for font rendering, such as whether anti-aliasing is enabled.glyphs
- the glyphs in this vector.
public boolean equals(GlyphVector other)
Determines whether another GlyphVector is for the same font and rendering context, uses the same glyphs and positions them to the same location.
- Overrides:
- equals in interface GlyphVector
- Parameters:
other
- the GlyphVector to compare with.
- Returns:
true
if the two vectors are equal,false
otherwise.
public Font getFont()
Returns the font of the glyphs in this GlyphVector.
- Overrides:
- getFont in interface GlyphVector
public FontRenderContext getFontRenderContext()
Returns the FontRenderContext that is used to calculate the extent and position of the glyphs.
- Overrides:
- getFontRenderContext in interface GlyphVector
public int getGlyphCode(int glyphIndex)
Determines the glyph number by index in this vector. Glyph numbers are specific to each font, so two fonts will likely assign different numbers to the same glyph.
- Overrides:
- getGlyphCode in interface GlyphVector
- Parameters:
glyphIndex
- the index of the glyph whose glyph number is to be retrieved.
- Throws:
IndexOutOfBoundsException
- ifglyphIndex
is not in the range.
public int[] getGlyphCodes(int firstGlyphIndex, int numEntries, int[] outCodes)
Returns a slice of this GlyphVector.
- Overrides:
- getGlyphCodes in interface GlyphVector
- Parameters:
firstGlyphIndex
- the index of the first glyph in the returned slice.numEntries
- the size of the returned slice.outCodes
- a pre-allocated array for storing the slice, ornull
to cause allocation of a new array.
- Returns:
- a slice of this GlyphVector. If
outCodes
isnull
, the slice will be stored into a freshly allocated array; otherwise, the result will be stored intooutCodes
.
public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex)
Determines the justification information for the glyph at the specified index.
- Overrides:
- getGlyphJustificationInfo in interface GlyphVector
- Parameters:
glyphIndex
- the index of the glyph whose justification information is to be retrieved.
- Throws:
IndexOutOfBoundsException
- ifglyphIndex
is not in the range.
public Shape getGlyphLogicalBounds(int glyphIndex)
- Overrides:
- getGlyphLogicalBounds in interface GlyphVector
public GlyphMetrics getGlyphMetrics(int glyphIndex)
Determines the metrics of the glyph at the specified index.
- Overrides:
- getGlyphMetrics in interface GlyphVector
- Parameters:
glyphIndex
- the index of the glyph whose metrics is to be retrieved.
- Throws:
IndexOutOfBoundsException
- ifglyphIndex
is not in the range.
public Shape getGlyphOutline(int glyphIndex)
Determines the shape of the specified glyph.
- Overrides:
- getGlyphOutline in interface GlyphVector
- Throws:
IndexOutOfBoundsException
- ifglyphIndex
is not in the range.
public Point2D getGlyphPosition(int glyphIndex)
Determines the position of the specified glyph, or the total advance width and height of the vector.
- Overrides:
- getGlyphPosition in interface GlyphVector
- Parameters:
glyphIndex
- the index of the glyph in question. If this value equalsgetNumGlyphs()
, the position after the last glyph will be returned, which is the total advance width and height of the vector.
- Throws:
IndexOutOfBoundsException
- ifglyphIndex
is not in the range.
public float[] getGlyphPositions(int firstGlyphIndex, int numGlyphs, float[] outPositions)
Returns the positions of a range of glyphs in this vector.
- Overrides:
- getGlyphPositions in interface GlyphVector
- Parameters:
firstGlyphIndex
- the index of the first glyph whose position is retrieved.numGlyphs
- the number of glyphs whose positions are retrieved.outPositions
- an array for storing the results (the length must be at least twicenumGlyphs
), ornull
for freshly allocating an array.
- Returns:
- an array with the glyph positions. The horizontal position of the
i
-th glyph is at index2 * i
, the vertical position at index2 * i + 1
.
- Throws:
IllegalArgumentException
- ifnumGlyphs
is less than zero.IndexOutOfBoundsException
- if eitherfirstGlyphIndex
or(firstGlyphIndex + numGlyphs)
is not in the range[0 .. getNumGlyphs() - 1]
.
public AffineTransform getGlyphTransform(int glyphIndex)
Returns the affine transformation that is applied to the glyph at the specified index.
- Overrides:
- getGlyphTransform in interface GlyphVector
- Parameters:
glyphIndex
- the index of the glyph whose transformation is to be retrieved.
- Returns:
- an affine transformation, or
null
for the identity transformation.
- Throws:
IndexOutOfBoundsException
- ifglyphIndex
is not in the range.
public Shape getGlyphVisualBounds(int glyphIndex)
- Overrides:
- getGlyphVisualBounds in interface GlyphVector
public int getLayoutFlags()
Returns flags that can be used for optimizing the rendering of this GlyphVector.
- Overrides:
- getLayoutFlags in interface GlyphVector
- Returns:
- a bit mask with the applicable flags set.
- Since:
- 1.4
public Rectangle2D getLogicalBounds()
- Overrides:
- getLogicalBounds in interface GlyphVector
public int getNumGlyphs()
Determines the number of glyphs in this GlyphVector.
- Overrides:
- getNumGlyphs in interface GlyphVector
public Shape getOutline()
Returns the shape of this GlyphVector.
- Overrides:
- getOutline in interface GlyphVector
public Shape getOutline(float x, float y)
Returns the shape of this GlyphVector, translated to the specified position.
- Overrides:
- getOutline in interface GlyphVector
- Parameters:
x
- the horizontal position for rendering this vector.y
- the vertical position for rendering this vector.
public Rectangle2D getVisualBounds()
- Overrides:
- getVisualBounds in interface GlyphVector
public void performDefaultLayout()
Moves each glyph in the vector to its default position.
- Overrides:
- performDefaultLayout in interface GlyphVector
public void setGlyphPosition(int glyphIndex, Point2D position)
Moves the specified glyph to a new position, or changes the advance width and height of the entire glyph vector.Note that the position of an individual glyph may also affected by its affine transformation.
- Overrides:
- setGlyphPosition in interface GlyphVector
- Parameters:
glyphIndex
- the index of the moved glyph. IfglyphIndex
equals the total number of glyphs in this vector, the advance width and height of the vector is changed.position
- the new position of the glyph.
- Throws:
IndexOutOfBoundsException
- ifglyphIndex
is not in the range.
public void setGlyphTransform(int glyphIndex, AffineTransform transform)
Applies an affine transformation to the glyph at the specified index.
- Overrides:
- setGlyphTransform in interface GlyphVector
- Parameters:
glyphIndex
- the index of the glyph to which the transformation is applied.transform
- the affine transformation for the glyph, ornull
for an identity transformation.