org.apache.fop.render.java2d

Class FontMetricsMapper

Implemented Interfaces:
FontMetrics

public class FontMetricsMapper
extends Typeface
implements FontMetrics

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

Constructor Summary

FontMetricsMapper(String family, int style, Graphics2D graphics)
Constructs a new Font-metrics.

Method Summary

int
getAscender(int size)
int
getCapHeight(int size)
int
getDescender(int size)
String
getEncoding()
java.awt.Font
getFont(int size)
Gets a Font instance of the Font that this FontMetrics describes in the desired size.
String
getFontName()
FontType
getFontType()
Map
getKerningInfo()
int
getMaxAscent(int size)
int
getWidth(int i, int size)
int[]
getWidths()
int
getXHeight(int size)
boolean
hasChar(char c)
boolean
hasKerningInfo()
char
mapChar(char c)

Methods inherited from class org.apache.fop.fonts.Typeface

getEncoding, getMaxAscent, hasChar, isMultiByte, mapChar

Constructor Details

FontMetricsMapper

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

Method Details

getAscender

public int getAscender(int size)
Specified by:
getAscender in interface FontMetrics

getCapHeight

public int getCapHeight(int size)
Specified by:
getCapHeight in interface FontMetrics

getDescender

public int getDescender(int size)
Specified by:
getDescender in interface FontMetrics

getEncoding

public String getEncoding()
Overrides:
getEncoding in interface Typeface

getFont

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

getFontName

public String getFontName()
Specified by:
getFontName in interface FontMetrics

getFontType

public FontType getFontType()
Specified by:
getFontType in interface FontMetrics

getKerningInfo

public Map getKerningInfo()
Specified by:
getKerningInfo in interface FontMetrics

getMaxAscent

public int getMaxAscent(int size)
Specified by:
getMaxAscent in interface FontMetrics
Overrides:
getMaxAscent in interface Typeface

getWidth

public int getWidth(int i,
                    int size)
Specified by:
getWidth in interface FontMetrics

getWidths

public int[] getWidths()
Specified by:
getWidths in interface FontMetrics

getXHeight

public int getXHeight(int size)
Specified by:
getXHeight in interface FontMetrics

hasChar

public boolean hasChar(char c)
Overrides:
hasChar in interface Typeface

hasKerningInfo

public boolean hasKerningInfo()
Specified by:
hasKerningInfo in interface FontMetrics

mapChar

public char mapChar(char c)
Overrides:
mapChar in interface Typeface

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.