fi.hut.tml.xsmiles.mlfc.xslfo.render
Class FontMetricsMapper

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.xslfo.render.FontMetricsMapper
All Implemented Interfaces:
org.apache.fop.layout.FontMetric

public class FontMetricsMapper
extends java.lang.Object
implements org.apache.fop.layout.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 org.apache.fop.layout.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 org.apache.fop.layout.FontMetric

getDescender

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

Specified by:
getDescender in interface org.apache.fop.layout.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 org.apache.fop.layout.FontMetric
Returns:
font height in milliponts

getFirstChar

public int getFirstChar()
Specified by:
getFirstChar in interface org.apache.fop.layout.FontMetric

getLastChar

public int getLastChar()
Specified by:
getLastChar in interface org.apache.fop.layout.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 org.apache.fop.layout.FontMetric

getWidths

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

Specified by:
getWidths in interface org.apache.fop.layout.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.


X-Smiles 1.2