Package org.apache.fop.render.java2d
Class Java2DFontMetrics
java.lang.Object
org.apache.fop.render.java2d.Java2DFontMetrics
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.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
This factor multiplies the calculated values to scale to FOP internal measurementsstatic final int
Font size standard used for metric measurements -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getAscender
(String family, int style, int size) Determines the font ascent of the Font described by this FontMetrics objectint
getCapHeight
(String family, int style, int size) The size of a capital letter measured from the font's baselineint
getDescender
(String family, int style, int size) Determines the font descent of the Font described by this FontMetrics objectReturns 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 objectint
getStrikeoutPosition
(String family, int style, int size) int
getStrikeoutThickness
(String family, int style, int size) int
getUnderlinePosition
(String family, int style, int size) int
getUnderlineThickness
(String family, int style, int size) int[]
Return widths (in 1/1000ths of point size) of all charactersint
getXHeight
(String family, int style, int size) Determines the typical font height of a small cap letter FontMetrics objectboolean
Indicates whether the font contains a particular character/glyph.int
Returns width (in 1/1000ths of point size) of character at code point i
-
Field Details
-
FONT_SIZE
public static final int FONT_SIZEFont size standard used for metric measurements- See Also:
-
FONT_FACTOR
public static final int FONT_FACTORThis factor multiplies the calculated values to scale to FOP internal measurements- See Also:
-
-
Constructor Details
-
Java2DFontMetrics
public Java2DFontMetrics()Constructs a new Font-metrics.
-
-
Method Details
-
getMaxAscent
Determines the font's maximum ascent of the Font described by the current FontMetrics object- Parameters:
family
- font family (java name) to usestyle
- font style (java def.) to usesize
- font size- Returns:
- ascent in milliponts
-
getAscender
Determines the font ascent of the Font described by this FontMetrics object- Parameters:
family
- font family (java name) to usestyle
- font style (java def.) to usesize
- font size- Returns:
- ascent in milliponts
-
getCapHeight
The size of a capital letter measured from the font's baseline- Parameters:
family
- font familystyle
- font stylesize
- font size- Returns:
- capital height in millipoints
-
getDescender
Determines the font descent of the Font described by this FontMetrics object- Parameters:
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size- Returns:
- descent in milliponts
-
getXHeight
Determines the typical font height of a small cap letter FontMetrics object- Parameters:
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size- Returns:
- font height in milliponts
-
getUnderlinePosition
-
getUnderlineThickness
-
getStrikeoutPosition
-
getStrikeoutThickness
-
width
Returns width (in 1/1000ths of point size) of character at code point i- Parameters:
i
- the character for which to get the widthfamily
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size- Returns:
- character width in millipoints
-
getWidths
Return widths (in 1/1000ths of point size) of all characters- Parameters:
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size- Returns:
- array of character widths in millipoints
-
getFont
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.- Parameters:
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font size- Returns:
- font with the desired characeristics.
-
hasChar
Indicates whether the font contains a particular character/glyph.- Parameters:
family
- font family (jave name) to usestyle
- font style (jave def.) to usesize
- font sizec
- the glyph to check- Returns:
- true if the character is supported
-