org.apache.fop.render.awt
Class FontMetricsMapper


public class FontMetricsMapper
implements FontMetric

This class implements org.apache.fop.layout.FontMetric and is added to the hash table in FontInfo. It deferes the actual calculation of the metrics to AWTFontMetrics. It only keeps the java name and style as member varibles


Constructor Summary
FontMetricsMapper(String family, int style, Component parent)
          Constructs a new Font-metrics.

Method Summary
 intgetAscender(int size)
          Determines the font ascent of the Font described by this FontMetrics object
 intgetCapHeight(int size)
          The size of a capital letter measured from the font's baseline
 intgetDescender(int size)
          Determines the font descent of the Font described by this FontMetrics object
 intgetFirstChar()
           
 FontgetFont(int size)
          Gets a Font instance of the Font that this FontMetrics describes in the desired size.
 intgetLastChar()
           
 int[]getWidths(int size)
          return width (in 1/1000ths of point size) of all character
 intgetXHeight(int size)
          Determines the typical font height of this FontMetrics object
 intwidth(int i, int size)
          return width (in 1/1000ths of point size) of character at code point i.

Constructor Detail

FontMetricsMapper

public FontMetricsMapper(String family, int style, Component parent)
Constructs a new Font-metrics.
Parameters:
family - the family name of the font (java value)
style - the java type style value of the font
parent - an AWT component - this is needed so that we can get an instance of java.awt.FontMetrics
Method Detail

getAscender

public int getAscender(int size)
Determines the font ascent of the Font described by this FontMetrics object
Returns: ascent in milliponts

getCapHeight

public int getCapHeight(int size)
The size of a capital letter measured from the font's baseline

getDescender

public int getDescender(int size)
Determines the font descent of the Font described by this FontMetrics object
Returns: descent in milliponts

getFirstChar

public int getFirstChar()

getFont

public Font getFont(int size)
Gets a Font instance of the Font that this FontMetrics describes in the desired size.
Returns: font with the desired characeristics.

getLastChar

public int getLastChar()

getWidths

public int[] getWidths(int size)
return width (in 1/1000ths of point size) of all character

getXHeight

public int getXHeight(int size)
Determines the typical font height of this FontMetrics object
Returns: font height in milliponts

width

public int width(int i, int size)
return width (in 1/1000ths of point size) of character at code point i.

Association Links

to Class org.apache.fop.render.awt.AWTFontMetrics

This is a AWTFontMetrics that does the real calculation. It is only one class that dynamically determines the font-size.

to Class java.lang.String

The java name of the font. # Make the family name immutable.