|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The interface that all font delegate objects implement, irrespective of where they get their information from.
Thread Safety: All classes that implement the
FontDelegate interface must allow calling these
methods from multiple concurrent threads. The delegates are
responsible for performing the necessary synchronization.
| Method Summary | |
java.awt.font.GlyphVector |
createGlyphVector(java.awt.Font font,
java.awt.font.FontRenderContext frc,
java.text.CharacterIterator ci)
Creates a GlyphVector by mapping each character in a CharacterIterator to the corresponding glyph. |
void |
getAdvance(int glyphIndex,
float pointSize,
java.awt.geom.AffineTransform transform,
boolean antialias,
boolean fractionalMetrics,
boolean horizontal,
java.awt.geom.Point2D advance)
Determines the advance width and height for a glyph. |
float |
getAscent(float pointSize,
java.awt.geom.AffineTransform transform,
boolean antialiased,
boolean fractionalMetrics,
boolean horizontal)
Determines the distance between the base line and the highest ascender. |
float |
getDescent(float pointSize,
java.awt.geom.AffineTransform transform,
boolean antialiased,
boolean fractionalMetrics,
boolean horizontal)
Determines the distance between the base line and the lowest descender. |
java.lang.String |
getFamilyName(java.util.Locale locale)
Returns the name of the family to which this font face belongs, for example “Univers”. |
java.lang.String |
getFullName(java.util.Locale locale)
Returns the full name of this font face in the specified locale, for example “Univers Light”. |
java.lang.String |
getGlyphName(int glyphIndex)
Returns a name for the specified glyph. |
java.awt.geom.GeneralPath |
getGlyphOutline(int glyphIndex,
float pointSize,
java.awt.geom.AffineTransform transform,
boolean antialias,
boolean fractionalMetrics)
Returns the shape of a glyph. |
int |
getMissingGlyphCode()
Returns the index of the glyph which gets displayed if the font cannot map a Unicode code point to a glyph. |
int |
getNumGlyphs()
Returns the number of glyphs in this font face. |
java.lang.String |
getPostScriptName()
Returns the PostScript name of this font face, for example “Helvetica-Bold”. |
java.lang.String |
getSubFamilyName(java.util.Locale locale)
Returns the name of this font face inside the family, for example “Light”. |
| Method Detail |
public java.lang.String getFullName(java.util.Locale locale)
locale - the locale for which to localize the name.
public java.lang.String getFamilyName(java.util.Locale locale)
locale - the locale for which to localize the name.
public java.lang.String getSubFamilyName(java.util.Locale locale)
locale - the locale for which to localize the name.
public java.lang.String getPostScriptName()
null if the font
does not provide a PostScript name.public int getNumGlyphs()
public int getMissingGlyphCode()
public java.awt.font.GlyphVector createGlyphVector(java.awt.Font font,
java.awt.font.FontRenderContext frc,
java.text.CharacterIterator ci)
The mapping takes only the font’s cmap
tables into consideration. No other operations (such as glyph
re-ordering, composition, or ligature substitution) are
performed. This means that the resulting GlyphVector will not be
correct for text in languages that have complex
character-to-glyph mappings, such as Arabic, Hebrew, Hindi, or
Thai.
font - the font object that the created GlyphVector
will return when it gets asked for its font. This argument is
needed because the public API works with java.awt.Font,
not with some private delegate like OpenTypeFont.frc - the font rendering parameters that are used for
measuring glyphs. The exact placement of text slightly depends on
device-specific characteristics, for instance the device
resolution or anti-aliasing. For this reason, any measurements
will only be accurate if the passed
FontRenderContext correctly reflects the relevant
parameters. Hence, frc should be obtained from the
same Graphics2D that will be used for drawing, and
any rendering hints should be set to the desired values before
obtaining frc.ci - a CharacterIterator for iterating over the
characters to be displayed.
public void getAdvance(int glyphIndex,
float pointSize,
java.awt.geom.AffineTransform transform,
boolean antialias,
boolean fractionalMetrics,
boolean horizontal,
java.awt.geom.Point2D advance)
glyphIndex - the glyph whose advance width is to be
determined.pointSize - the point size of the font.transform - a transform that is applied in addition to
scaling to the specified point size. This is often used for
scaling according to the device resolution. Those who lack any
aesthetic sense may also use the transform to slant or stretch
glyphs.antialias - true for anti-aliased rendering,
false for normal rendering. For hinted fonts,
this parameter may indeed affect the result.fractionalMetrics - true for fractional metrics,
false for rounding the result to a pixel boundary.horizontal - true for horizontal line layout,
false for vertical line layout.advance - a point whose x and y
fields will hold the advance in each direction. It is well
possible that both values are non-zero, for example for rotated
text or for Urdu fonts.
public java.awt.geom.GeneralPath getGlyphOutline(int glyphIndex,
float pointSize,
java.awt.geom.AffineTransform transform,
boolean antialias,
boolean fractionalMetrics)
glyphIndex - the glyph whose advance width is to be
determined.pointSize - the point size of the font.transform - a transform that is applied in addition to
scaling to the specified point size. This is often used for
scaling according to the device resolution. Those who lack any
aesthetic sense may also use the transform to slant or stretch
glyphs.antialias - true for anti-aliased rendering,
false for normal rendering. For hinted fonts, this
parameter may indeed affect the result.fractionalMetrics - true for fractional
metrics, false for rounding the result to a pixel
boundary.
null for bitmap fonts.public java.lang.String getGlyphName(int glyphIndex)
Names are not unique: Under some rare circumstances, the same name can be returned for different glyphs. It is therefore recommended that printer drivers check whether the same name has already been returned for antoher glyph, and make the name unique by adding the string ".alt" followed by the glyph index.
This situation would occur for an OpenType or TrueType font
that has a post table of format 3 and provides a
mapping from glyph IDs to Unicode sequences through a
Zapf table. If the same sequence of Unicode
codepoints leads to different glyphs (depending on contextual
position, for example, or on typographic sophistication level),
the same name would get synthesized for those glyphs.
glyphIndex - the glyph whose name the caller wants to
retrieve.
public float getAscent(float pointSize,
java.awt.geom.AffineTransform transform,
boolean antialiased,
boolean fractionalMetrics,
boolean horizontal)
pointSize - the point size of the font.transform - a transform that is applied in addition to
scaling to the specified point size. This is often used for
scaling according to the device resolution. Those who lack any
aesthetic sense may also use the transform to slant or stretch
glyphs.fractionalMetrics - true for fractional metrics,
false for rounding the result to a pixel boundary.horizontal - true for horizontal line layout,
false for vertical line layout.
public float getDescent(float pointSize,
java.awt.geom.AffineTransform transform,
boolean antialiased,
boolean fractionalMetrics,
boolean horizontal)
pointSize - the point size of the font.transform - a transform that is applied in addition to
scaling to the specified point size. This is often used for
scaling according to the device resolution. Those who lack any
aesthetic sense may also use the transform to slant or stretch
glyphs.fractionalMetrics - true for fractional metrics,
false for rounding the result to a pixel boundary.horizontal - true for horizontal line layout,
false for vertical line layout.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||