Package org.apache.fop.fonts.type1
Class AFMFile
java.lang.Object
org.apache.fop.fonts.type1.AFMFile
Represents the contents of a Type 1 AFM font metrics file.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCharMetrics
(AFMCharMetrics metrics) Adds new character metrics.void
addXKerning
(String name1, String name2, double kx) Adds a X-kerning entry.Creates and returns a kerning map for writing mode 0 (ltr) with character codes.Returns the Ascender value.Returns the CapHeight value.Returns the character metrics associated with the character name.Returns the CharacterSet value.int
Returns the number of character available for this font.Returns the list of AFMCharMetrics instances representing all the available characters.Returns the Descender value.Returns the EncodingScheme value.Returns the FamilyName value.int
Returns the first character index in the encoding that has a glyph.Returns the FontBBox value.int[]
Returns the FontBBox value as integer array.Returns the FontName value.Returns the FullName value.int
Returns the last character index in the encoding that has a glyph.getStdHW()
Returns the StdHW value.getStdVW()
Returns the StdVW value.Returns the Weight value.getWritingDirectionMetrics
(int index) Gets writing direction metrics.Returns the XHeight value.boolean
Indicates whether the font has kerning information.void
overridePrimaryEncoding
(SingleByteEncoding encoding) The character codes in an AFM cannot always be trusted to be the same values as in the font's primary encoding.void
setAscender
(Number ascender) Sets the Ascender value.void
setCapHeight
(Number capHeight) Sets the CapHeight value.void
setCharacterSet
(String characterSet) Sets the CharacterSet value.void
setDescender
(Number descender) Sets the Descender value.void
setEncodingScheme
(String encodingScheme) Sets the EncodingScheme valuevoid
setFamilyName
(String familyName) Sets the FamilyName value.void
setFontBBox
(RectangularShape fontBBox) Sets the FontBBox value.void
setFontName
(String fontName) Sets the FontName value.void
setFullName
(String fullName) Sets the FullName value.void
Sets the StdHW value.void
Sets the StdVW value.void
Sets the Weight value.void
setWritingDirectionMetrics
(int index, AFMWritingDirectionMetrics metrics) Sets writing direction metrics.void
setXHeight
(Number height) Sets the XHeight value.toString()
-
Constructor Details
-
AFMFile
public AFMFile()Default constructor.
-
-
Method Details
-
getFontName
Returns the FontName value.- Returns:
- the font name
-
setFontName
Sets the FontName value.- Parameters:
fontName
- the font name to set
-
getFullName
Returns the FullName value.- Returns:
- the full name of the font
-
setFullName
Sets the FullName value.- Parameters:
fullName
- the full name to set
-
getFamilyName
Returns the FamilyName value.- Returns:
- the family name of the font
-
setFamilyName
Sets the FamilyName value.- Parameters:
familyName
- the family name to set
-
getWeight
Returns the Weight value.- Returns:
- the weight
-
setWeight
Sets the Weight value.- Parameters:
weight
- the weight to set
-
getFontBBox
Returns the FontBBox value.- Returns:
- the font's bounding box
-
getFontBBoxAsIntArray
public int[] getFontBBoxAsIntArray()Returns the FontBBox value as integer array.- Returns:
- the font's bounding box
-
setFontBBox
Sets the FontBBox value.- Parameters:
fontBBox
- the fontBBox to set
-
getEncodingScheme
Returns the EncodingScheme value.- Returns:
- the encoding scheme
-
setEncodingScheme
Sets the EncodingScheme value- Parameters:
encodingScheme
- the encodingScheme to set
-
getCharacterSet
Returns the CharacterSet value.- Returns:
- the characterSet
-
setCharacterSet
Sets the CharacterSet value.- Parameters:
characterSet
- the characterSet to set
-
getCapHeight
Returns the CapHeight value.- Returns:
- the capHeight
-
setCapHeight
Sets the CapHeight value.- Parameters:
capHeight
- the capHeight to set
-
getXHeight
Returns the XHeight value.- Returns:
- the xHeight
-
setXHeight
Sets the XHeight value.- Parameters:
height
- the xHeight to set
-
getAscender
Returns the Ascender value.- Returns:
- the ascender
-
setAscender
Sets the Ascender value.- Parameters:
ascender
- the ascender to set
-
getDescender
Returns the Descender value.- Returns:
- the descender
-
setDescender
Sets the Descender value.- Parameters:
descender
- the descender to set
-
getStdHW
Returns the StdHW value.- Returns:
- the descender
-
setStdHW
Sets the StdHW value.- Parameters:
stdHW
- the StdHW to set
-
getStdVW
Returns the StdVW value.- Returns:
- the descender
-
setStdVW
Sets the StdVW value.- Parameters:
stdVW
- the StdVW to set
-
getWritingDirectionMetrics
Gets writing direction metrics.- Parameters:
index
- the writing direction (0, 1 or 2)- Returns:
- the writing direction metrics
-
setWritingDirectionMetrics
Sets writing direction metrics.- Parameters:
index
- the writing direction (0, 1 or 2)metrics
- the writing direction metrics
-
addCharMetrics
Adds new character metrics.- Parameters:
metrics
- the character metrics
-
getCharCount
public int getCharCount()Returns the number of character available for this font.- Returns:
- the number of character
-
getFirstChar
public int getFirstChar()Returns the first character index in the encoding that has a glyph.- Returns:
- the first character index with a glyph
-
getLastChar
public int getLastChar()Returns the last character index in the encoding that has a glyph.- Returns:
- the last character index with a glyph
-
getChar
Returns the character metrics associated with the character name.- Parameters:
name
- the character name- Returns:
- the character metrics or null if there's no such character
-
getCharMetrics
Returns the list of AFMCharMetrics instances representing all the available characters.- Returns:
- a List of AFMCharMetrics instances
-
addXKerning
Adds a X-kerning entry.- Parameters:
name1
- the name of the first charactername2
- the name of the second characterkx
- kerning value in x-direction
-
hasKerning
public boolean hasKerning()Indicates whether the font has kerning information.- Returns:
- true if there is kerning information
-
createXKerningMapEncoded
Creates and returns a kerning map for writing mode 0 (ltr) with character codes.- Returns:
- the kerning map or null if there is no kerning information.
-
overridePrimaryEncoding
The character codes in an AFM cannot always be trusted to be the same values as in the font's primary encoding. Therefore, we provide a way to override this primary encoding.- Parameters:
encoding
- the encoding to replace the one given in the AFM
-
toString
-