Package org.apache.fop.afp.fonts
Class CharacterSetOrientation
- java.lang.Object
-
- org.apache.fop.afp.fonts.CharacterSetOrientation
-
public class CharacterSetOrientation 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 that you communicate this information clearly to rotate and position characters correctly on the physical or logical page.
This class provides font metric information for a particular font as by the orientation.
This information is obtained directly from the AFP font files which must be installed in the classpath under in the location specified by the path attribute in the afp-font.xml file.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
CharacterSetOrientation.CharacterMetrics
-
Field Summary
Fields Modifier and Type Field Description private int
ascender
The ascender height for the character setprivate int
capHeight
The height of capital lettersprivate IntegerKeyStore<CharacterSetOrientation.CharacterMetrics>
characterMetrics
The character widths in the character set (indexed using Unicode codepoints)private int
descender
The descender depth for the character setprivate int
emSpaceIncrement
em space incrementprivate int
nomCharIncrement
Nominal Character Incrementprivate int
orientation
The character set orientationprivate int
spaceIncrement
space incrementprivate int
underscorePosition
private int
underscoreWidth
private int
xHeight
The height of lowercase letters
-
Constructor Summary
Constructors Constructor Description CharacterSetOrientation(int orientation, int spaceIncrement, int emSpaceIncrement, int nomCharIncrement)
Constructor for the CharacterSetOrientation, the orientation is expressed as the degrees rotation (i.e 0, 90, 180, 270)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.java.awt.Rectangle
getCharacterBox(char character, int size)
Get the character box (rectangle with dimensions in 1/1000ths of a point size) of the character identified by the parameter passed.private CharacterSetOrientation.CharacterMetrics
getCharacterMetrics(char character)
int
getDescender()
Descender depth is the distance from the character baseline to the bottom of a character box.int
getEmSpaceIncrement()
Returns the em space increment.private java.awt.Rectangle
getFallbackCharacterBox()
int
getNominalCharIncrement()
Returns the nominal character increment.int
getOrientation()
The orientation for these metrics in the character setint
getSpaceIncrement()
Returns the space increment.int
getUnderscorePosition()
int
getUnderscoreWidth()
int
getWidth(char character, int size)
Get the width (in 1/1000ths of a point size) of the character identified by the parameter passed.int
getXHeight()
XHeight refers to the height of the lower case letters above the baseline.private static java.awt.Rectangle
scale(java.awt.Rectangle rectangle, int size)
void
setAscender(int ascender)
Ascender height is the distance from the character baseline to the top of the character box.void
setCapHeight(int capHeight)
Cap height is the average height of the uppercase characters in a font.void
setCharacterMetrics(char character, int width, java.awt.Rectangle characterBox)
Set the width (in 1/1000ths of a point size) of the character identified by the parameter passed.void
setDescender(int descender)
Descender depth is the distance from the character baseline to the bottom of a character box.void
setUnderscorePosition(int underscorePosition)
TODOvoid
setUnderscoreWidth(int underscoreWidth)
TODOvoid
setXHeight(int xHeight)
XHeight refers to the height of the lower case letters above the baseline.
-
-
-
Field Detail
-
ascender
private int ascender
The ascender height for the character set
-
descender
private int descender
The descender depth for the character set
-
capHeight
private int capHeight
The height of capital letters
-
characterMetrics
private IntegerKeyStore<CharacterSetOrientation.CharacterMetrics> characterMetrics
The character widths in the character set (indexed using Unicode codepoints)
-
xHeight
private int xHeight
The height of lowercase letters
-
orientation
private final int orientation
The character set orientation
-
spaceIncrement
private final int spaceIncrement
space increment
-
emSpaceIncrement
private final int emSpaceIncrement
em space increment
-
nomCharIncrement
private final int nomCharIncrement
Nominal Character Increment
-
underscoreWidth
private int underscoreWidth
-
underscorePosition
private int underscorePosition
-
-
Constructor Detail
-
CharacterSetOrientation
public CharacterSetOrientation(int orientation, int spaceIncrement, int emSpaceIncrement, int nomCharIncrement)
Constructor for the CharacterSetOrientation, the orientation is expressed as the degrees rotation (i.e 0, 90, 180, 270)- Parameters:
orientation
- the character set orientationspaceIncrement
- the space incrementemSpaceIncrement
- the em space incrementnomCharIncrement
- the nominal character increment
-
-
Method Detail
-
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
-
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
-
getUnderscoreWidth
public int getUnderscoreWidth()
- Returns:
- the underscore width
-
getUnderscorePosition
public int getUnderscorePosition()
- Returns:
- the underscore position
-
getOrientation
public int getOrientation()
The orientation for these metrics in the character set- Returns:
- the orientation
-
getXHeight
public int getXHeight()
XHeight refers to the height of the lower case letters above the baseline.- Returns:
- heightX the typical height of characters
-
getWidth
public int getWidth(char character, int size)
Get the width (in 1/1000ths of a point size) of the character identified by the parameter passed.- Parameters:
character
- the Unicode character to evaluatesize
- the font size- Returns:
- the widths of the character
-
getCharacterMetrics
private CharacterSetOrientation.CharacterMetrics getCharacterMetrics(char character)
-
getCharacterBox
public java.awt.Rectangle getCharacterBox(char character, int size)
Get the character box (rectangle with dimensions in 1/1000ths of a point size) of the character identified by the parameter passed.- Parameters:
character
- the Unicode character to evaluatesize
- the font size- Returns:
- the character box
-
scale
private static java.awt.Rectangle scale(java.awt.Rectangle rectangle, int size)
-
getFallbackCharacterBox
private java.awt.Rectangle getFallbackCharacterBox()
-
setAscender
public void setAscender(int ascender)
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.- Parameters:
ascender
- the ascender to set
-
setCapHeight
public void setCapHeight(int capHeight)
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.- Parameters:
capHeight
- the cap height to set
-
setDescender
public void setDescender(int descender)
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.- Parameters:
descender
- the descender value in millipoints
-
setUnderscoreWidth
public void setUnderscoreWidth(int underscoreWidth)
TODO- Parameters:
underscoreWidth
- the underscore width value in millipoints
-
setUnderscorePosition
public void setUnderscorePosition(int underscorePosition)
TODO- Parameters:
underscorePosition
- the underscore position value in millipoints
-
setCharacterMetrics
public void setCharacterMetrics(char character, int width, java.awt.Rectangle characterBox)
Set the width (in 1/1000ths of a point size) of the character identified by the parameter passed.- Parameters:
character
- the Unicode character for which the width is being setwidth
- the widths of the charactercharacterBox
- the character box
-
setXHeight
public void setXHeight(int xHeight)
XHeight refers to the height of the lower case letters above the baseline.- Parameters:
xHeight
- the typical height of characters
-
getSpaceIncrement
public int getSpaceIncrement()
Returns the space increment.- Returns:
- the space increment
-
getEmSpaceIncrement
public int getEmSpaceIncrement()
Returns the em space increment.- Returns:
- the em space increment
-
getNominalCharIncrement
public int getNominalCharIncrement()
Returns the nominal character increment.- Returns:
- the nominal character increment
-
-