org.apache.fop.render.java2d
Class Java2DFontMetrics
java.lang.Object
org.apache.fop.render.java2d.Java2DFontMetrics
public class Java2DFontMetrics
extends java.lang.Object
This is a FontMetrics to be used for AWT rendering.
It instanciates a font, depening on family and style
values. The java.awt.FontMetrics for this font is then
created to be used for the actual measurement.
Since layout is word by word and since it is expected that
two subsequent words often share the same style, the
Font and FontMetrics is buffered and only changed if needed.
Since FontState and FontInfo multiply all factors by
size, we assume a "standard" font of FONT_SIZE.
static int | FONT_FACTOR - This factor multiplies the calculated values to scale
to FOP internal measurements
|
static int | FONT_SIZE - Font size standard used for metric measurements
|
int | getAscender(String family, int style, int size) - Determines the font ascent of the Font described by this
FontMetrics object
|
int | getCapHeight(String family, int style, int size) - The size of a capital letter measured from the font's baseline
|
int | getDescender(String family, int style, int size) - Determines the font descent of the Font described by this
FontMetrics object
|
Font | getFont(String family, int style, int size) - Returns a java.awt.Font instance for the desired
family, style and size type.
|
int | getMaxAscent(String family, int style, int size) - Determines the font's maximum ascent of the Font described by the current
FontMetrics object
|
int[] | getWidths(String family, int style, int size) - Return widths (in 1/1000ths of point size) of all
characters
|
int | getXHeight(String family, int style, int size) - Determines the typical font height of a small cap letter
FontMetrics object
|
boolean | hasChar(String family, int style, int size, char c) - Indicates whether the font contains a particular character/glyph.
|
int | width(int i, String family, int style, int size) - Returns width (in 1/1000ths of point size) of character at
code point i
|
FONT_FACTOR
public static final int FONT_FACTOR
This factor multiplies the calculated values to scale
to FOP internal measurements
FONT_SIZE
public static final int FONT_SIZE
Font size standard used for metric measurements
Java2DFontMetrics
public Java2DFontMetrics(Graphics2D graphics)
Constructs a new Font-metrics.
graphics
- a temp graphics object - this is needed so
that we can get an instance of java.awt.FontMetrics
getAscender
public int getAscender(String family,
int style,
int size)
Determines the font ascent of the Font described by this
FontMetrics object
family
- font family (java name) to usestyle
- font style (java def.) to usesize
- font size
getCapHeight
public int getCapHeight(String family,
int style,
int size)
The size of a capital letter measured from the font's baseline
family
- font familystyle
- font stylesize
- font size
- capital height in millipoints
getDescender
public int getDescender(String family,
int style,
int size)
Determines the font descent of the Font described by this
FontMetrics object
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size
getFont
public Font getFont(String family,
int style,
int size)
Returns a java.awt.Font instance for the desired
family, style and size type.
This is here, so that the font-mapping
of FOP-defined fonts to java-fonts can be done
in one place and does not need to occur in
AWTFontRenderer.
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size
- font with the desired characeristics.
getMaxAscent
public int getMaxAscent(String family,
int style,
int size)
Determines the font's maximum ascent of the Font described by the current
FontMetrics object
family
- font family (java name) to usestyle
- font style (java def.) to usesize
- font size
getWidths
public int[] getWidths(String family,
int style,
int size)
Return widths (in 1/1000ths of point size) of all
characters
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size
- array of character widths in millipoints
getXHeight
public int getXHeight(String family,
int style,
int size)
Determines the typical font height of a small cap letter
FontMetrics object
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size
- font height in milliponts
hasChar
public boolean hasChar(String family,
int style,
int size,
char c)
Indicates whether the font contains a particular character/glyph.
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font sizec
- the glyph to check
- true if the character is supported
width
public int width(int i,
String family,
int style,
int size)
Returns width (in 1/1000ths of point size) of character at
code point i
i
- the character for which to get the widthfamily
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size
- character width in millipoints
Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.