org.apache.fop.render.afp.fonts

Class CharacterSet

Known Direct Subclasses:
FopCharacterSet

public class CharacterSet
extends java.lang.Object

The IBM Font Object Content Architecture (FOCA) supports presentation of character shapes by defining their characteristics, which include font description information for identifying the characters, font metric information for positioning the characters, and character shape information for presenting the character images.

Presenting a graphic character on a presentation surface requires information on the rotation and position of character on the physical or logical page.

This class proivdes font metric information for a particular font as identified by the character set name. This information is obtained directly from the AFP font files which must be installed in the path specified in the afp-fonts xml definition file.

Field Summary

protected String
_codePage
The code page to which the character set relates
protected String
_encoding
The encoding used for the code page
protected String
_name
The character set relating to the font
protected String
_path
The path to the installed fonts
protected static Log
log
Static logging instance

Constructor Summary

CharacterSet(String codePage, String encoding, String name, String path)
Constructor for the CharacterSetMetric object, the character set is used to load the font information from the actual AFP font.

Method Summary

void
addCharacterSetOrientation(CharacterSetOrientation cso)
Add character set metric information for the different orientations
int
getAscender()
Ascender height is the distance from the character baseline to the top of the character box.
int
getCapHeight()
Cap height is the average height of the uppercase characters in a font.
String
getCodePage()
Returns the AFP code page identifier
int
getDescender()
Descender depth is the distance from the character baseline to the bottom of a character box.
String
getEncoding()
Returns the AFP code page encoding
int
getFirstChar()
The first character in the character set
int
getLastChar()
The last character in the character set
String
getName()
Returns the AFP character set identifier
byte[]
getNameBytes()
Returns the AFP character set identifier
String
getPath()
int[]
getWidths()
Get the width (in 1/1000ths of a point size) of all characters
int
getXHeight()
XHeight refers to the height of the lower case letters above the baseline.
char
mapChar(char c)
Map a Unicode character to a code point in the font.
int
width(int character)
Get the width (in 1/1000ths of a point size) of the character identified by the parameter passed.

Field Details

_codePage

protected String _codePage
The code page to which the character set relates

_encoding

protected String _encoding
The encoding used for the code page

_name

protected String _name
The character set relating to the font

_path

protected String _path
The path to the installed fonts

log

protected static final Log log
Static logging instance

Constructor Details

CharacterSet

public CharacterSet(String codePage,
                    String encoding,
                    String name,
                    String path)
Constructor for the CharacterSetMetric object, the character set is used to load the font information from the actual AFP font.
Parameters:
codePage - the code page identifier
encoding - the encoding of the font
name - the character set name
path - the path to the installed afp fonts

Method Details

addCharacterSetOrientation

public void addCharacterSetOrientation(CharacterSetOrientation cso)
Add character set metric information for the different orientations
Parameters:
cso - the metrics for the orientation

getAscender

public int getAscender()
Ascender height is the distance from the character baseline to the top of the character box. A negative ascender height signifies that all of the graphic character is below the character baseline. For a character rotation other than 0, ascender height loses its meaning when the character is lying on its side or is upside down with respect to normal viewing orientation. For the general case, Ascender Height is the character???s most positive y-axis value. For bounded character boxes, for a given character having an ascender, ascender height and baseline offset are equal.
Returns:
the ascender value in millipoints

getCapHeight

public int getCapHeight()
Cap height is the average height of the uppercase characters in a font. This value is specified by the designer of a font and is usually the height of the uppercase M.
Returns:
the cap height value in millipoints

getCodePage

public String getCodePage()
Returns the AFP code page identifier
Returns:
String

getDescender

public int getDescender()
Descender depth is the distance from the character baseline to the bottom of a character box. A negative descender depth signifies that all of the graphic character is above the character baseline.
Returns:
the descender value in millipoints

getEncoding

public String getEncoding()
Returns the AFP code page encoding
Returns:
String

getFirstChar

public int getFirstChar()
The first character in the character set
Returns:
the first character

getLastChar

public int getLastChar()
The last character in the character set
Returns:
the last character

getName

public String getName()
Returns the AFP character set identifier
Returns:
String

getNameBytes

public byte[] getNameBytes()
Returns the AFP character set identifier
Returns:
byte[]

getPath

public String getPath()
Returns:
the path where the font resources are installed

getWidths

public int[] getWidths()
Get the width (in 1/1000ths of a point size) of all characters
Returns:
the widths of all characters

getXHeight

public int getXHeight()
XHeight refers to the height of the lower case letters above the baseline.
Returns:
the typical height of characters

mapChar

public char mapChar(char c)
Map a Unicode character to a code point in the font. The code tables are already converted to Unicode therefore we can use the identity mapping.
Parameters:
c - character to map
Returns:
the mapped character

width

public int width(int character)
Get the width (in 1/1000ths of a point size) of the character identified by the parameter passed.
Parameters:
character - the character from which the width will be calculated
Returns:
the width of the character

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