org.apache.fop.render.awt
Class FontMetricsMapper

java.lang.Object
  |
  +--org.apache.fop.render.awt.FontMetricsMapper

public class FontMetricsMapper
extends java.lang.Object
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(java.lang.String family, int style, java.awt.Component parent)
          Constructs a new Font-metrics.
 
Method Summary
 int getAscender(int size)
          Determines the font ascent of the Font described by this FontMetrics object
 int getCapHeight(int size)
          The size of a capital letter measured from the font's baseline
 int getDescender(int size)
          Determines the font descent of the Font described by this FontMetrics object
 int getFirstChar()
           
 java.awt.Font getFont(int size)
          Gets a Font instance of the Font that this FontMetrics describes in the desired size.
 int getLastChar()
           
 int[] getWidths(int size)
          return width (in 1/1000ths of point size) of all character
 int getXHeight(int size)
          Determines the typical font height of this FontMetrics object
 int width(int i, int size)
          return width (in 1/1000ths of point size) of character at code point i.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontMetricsMapper

public FontMetricsMapper(java.lang.String family,
                         int style,
                         java.awt.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
Specified by:
getAscender in interface FontMetric
Returns:
ascent in milliponts

getCapHeight

public int getCapHeight(int size)
The size of a capital letter measured from the font's baseline
Specified by:
getCapHeight in interface FontMetric

getDescender

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

getXHeight

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

getFirstChar

public int getFirstChar()
Specified by:
getFirstChar in interface FontMetric

getLastChar

public int getLastChar()
Specified by:
getLastChar in interface FontMetric

width

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

getWidths

public int[] getWidths(int size)
return width (in 1/1000ths of point size) of all character
Specified by:
getWidths in interface FontMetric

getFont

public java.awt.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.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.