Top Description Fields Constructors Methods
org.apache.fontbox.afm

public Class FontMetrics

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .HashMap, .List, .Map, org.apache.fontbox.util.BoundingBox

This is the outermost AFM type. This can be created by the afmparser with a valid AFM document.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private float
afmVersion

This is the version of the FontMetrics.

private float
private float
private int
private String
private final List<CharMetric>
private final Map<String, CharMetric>
private float[]
private final List<String>
private final List<Composite>
private float
private String
private int
private String
private BoundingBox
private String
private String
private String
private boolean
private boolean
private Boolean
private float
private final List<KernPair>
private final List<KernPair>
private final List<KernPair>
private int
private int
private String
private float
private float
private final List<TrackKern>
private float
private float
private float[]
private String
private float

Constructor Summary

AccessConstructor and Description
public
FontMetrics()

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
addCharMetric(CharMetric
The character metric to add.
metric
)

This will add another character metric.

public void
addComment(String
The comment to add to this metric.
comment
)

This will add a new comment.

public void
addComposite(Composite
The composite info to add.
composite
)

This will add a single composite part to the picture.

public void
addKernPair(KernPair
The kern pair to add.
kernPair
)

This will add a kern pair.

public void
addKernPair0(KernPair
The kern pair to add.
kernPair
)

This will add a kern pair.

public void
addKernPair1(KernPair
The kern pair to add.
kernPair
)

This will add a kern pair.

public void
addTrackKern(TrackKern
The track kerning data.
kern
)

This will add another track kern.

public float

Returns:

The version of the document.
getAFMVersion
()

This will get the version of the AFM document.

public float

Returns:

Value of property ascender.
getAscender
()

Getter for property ascender.

public float

Returns:

The width of the character.
getAverageCharacterWidth
()

This will get the average width of a character.

public float

Returns:

Value of property capHeight.
getCapHeight
()

Getter for property capHeight.

public float

Returns:

The width of the character.
getCharacterHeight
(String
The character to get the width for.
name
)

This will get the width of a character.

public int

Returns:

Value of property characters.
getCharacters
()

Getter for property characters.

public String

Returns:

Value of property characterSet.
getCharacterSet
()

Getter for property characterSet.

public float

Returns:

The width of the character.
getCharacterWidth
(String
The character to get the width for.
name
)

This will get the width of a character.

public List<CharMetric>

Returns:

Value of property charMetrics.
getCharMetrics
()

Getter for property charMetrics.

public float[]

Returns:

Value of property charWidth.
getCharWidth
()

Getter for property charWidth.

public List<String>

Returns:

The list of all comments.
getComments
()

This will get all comments.

public List<Composite>

Returns:

Value of property composites.
getComposites
()

Getter for property composites.

public float

Returns:

Value of property descender.
getDescender
()

Getter for property descender.

public String

Returns:

Value of property encodingScheme.
getEncodingScheme
()

Getter for property encodingScheme.

public int

Returns:

Value of property escChar.
getEscChar
()

Getter for property escChar.

public String

Returns:

Value of property familyName.
getFamilyName
()

Getter for property familyName.

public BoundingBox

Returns:

Value of property fontBBox.
getFontBBox
()

Getter for property fontBBox.

public String

Returns:

Value of property fontName.
getFontName
()

Getter for property fontName.

public String

Returns:

Value of property fontVersion.
getFontVersion
()

Getter for property fontVersion.

public String

Returns:

Value of property fullName.
getFullName
()

Getter for property fullName.

public boolean

Returns:

Value of property isBaseFont.
getIsBaseFont
()

Getter for property isBaseFont.

public boolean

Returns:

Value of property isFixedPitch.
getIsFixedPitch
()

Getter for property isFixedPitch.

public boolean

Returns:

Value of property isFixedV.
getIsFixedV
()

Getter for property isFixedV.

public float

Returns:

Value of property italicAngle.
getItalicAngle
()

Getter for property italicAngle.

public List<KernPair>

Returns:

Value of property kernPairs.
getKernPairs
()

Getter for property kernPairs.

public List<KernPair>

Returns:

Value of property kernPairs0.
getKernPairs0
()

Getter for property kernPairs0.

public List<KernPair>

Returns:

Value of property kernPairs1.
getKernPairs1
()

Getter for property kernPairs1.

public int

Returns:

Value of property mappingScheme.
getMappingScheme
()

Getter for property mappingScheme.

public int

Returns:

The value of the metric sets.
getMetricSets
()

This will get the metricSets attribute.

public String

Returns:

Value of property notice.
getNotice
()

Getter for property notice.

public float

Returns:

Value of property standardHorizontalWidth.
getStandardHorizontalWidth
()

Getter for property standardHorizontalWidth.

public float

Returns:

Value of property standardVerticalWidth.
getStandardVerticalWidth
()

Getter for property standardVerticalWidth.

public List<TrackKern>

Returns:

Value of property trackKern.
getTrackKern
()

Getter for property trackKern.

public float

Returns:

Value of property underlinePosition.
getUnderlinePosition
()

Getter for property underlinePosition.

public float

Returns:

Value of property underlineThickness.
getUnderlineThickness
()

Getter for property underlineThickness.

public float[]

Returns:

Value of property vVector.
getVVector
()

Getter for property vVector.

public String

Returns:

Value of property weight.
getWeight
()

Getter for property weight.

public float

Returns:

Value of property xHeight.
getXHeight
()

Getter for property xHeight.

public void
setAFMVersion(float
The version of the document.
afmVersionValue
)

This will set the version of the AFM document.

public void
setAscender(float
New value of property ascender.
ascenderValue
)

Setter for property ascender.

public void
setCapHeight(float
New value of property capHeight.
capHeightValue
)

Setter for property capHeight.

public void
setCharacters(int
New value of property characters.
charactersValue
)

Setter for property characters.

public void
setCharacterSet(String
New value of property characterSet.
characterSetValue
)

Setter for property characterSet.

public void
setCharWidth(float[]
New value of property charWidth.
charWidthValue
)

Setter for property charWidth.

public void
setDescender(float
New value of property descender.
descenderValue
)

Setter for property descender.

public void
setEncodingScheme(String
New value of property encodingScheme.
encodingSchemeValue
)

Setter for property encodingScheme.

public void
setEscChar(int
New value of property escChar.
escCharValue
)

Setter for property escChar.

public void
setFamilyName(String
New value of property familyName.
familyNameValue
)

Setter for property familyName.

public void
setFixedPitch(boolean
New value of property isFixedPitch.
isFixedPitchValue
)

Setter for property isFixedPitch.

public void
setFontBBox(BoundingBox
New value of property fontBBox.
bBox
)

Setter for property fontBBox.

public void
setFontName(String
New value of property fontName.
name
)

Setter for property fontName.

public void
setFontVersion(String
New value of property fontVersion.
fontVersionValue
)

Setter for property fontVersion.

public void
setFullName(String
New value of property fullName.
fullNameValue
)

Setter for property fullName.

public void
setIsBaseFont(boolean
New value of property isBaseFont.
isBaseFontValue
)

Setter for property isBaseFont.

public void
setIsFixedV(boolean
New value of property isFixedV.
isFixedVValue
)

Setter for property isFixedV.

public void
setItalicAngle(float
New value of property italicAngle.
italicAngleValue
)

Setter for property italicAngle.

public void
setMappingScheme(int
New value of property mappingScheme.
mappingSchemeValue
)

Setter for property mappingScheme.

public void
setMetricSets(int
The new metric sets attribute.
metricSetsValue
)

This will set the metricSets attribute.

public void
setNotice(String
New value of property notice.
noticeValue
)

Setter for property notice.

public void
setStandardHorizontalWidth(float
New value of property standardHorizontalWidth.
standardHorizontalWidthValue
)

Setter for property standardHorizontalWidth.

public void
setStandardVerticalWidth(float
New value of property standardVerticalWidth.
standardVerticalWidthValue
)

Setter for property standardVerticalWidth.

public void
setUnderlinePosition(float
New value of property underlinePosition.
underlinePositionValue
)

Setter for property underlinePosition.

public void
setUnderlineThickness(float
New value of property underlineThickness.
underlineThicknessValue
)

Setter for property underlineThickness.

public void
setVVector(float[]
New value of property vVector.
vVectorValue
)

Setter for property vVector.

public void
setWeight(String
New value of property weight.
weightValue
)

Setter for property weight.

public void
setXHeight(float
New value of property xHeight.
xHeightValue
)

Setter for property xHeight.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

afmVersionback to summary
private float afmVersion

This is the version of the FontMetrics.

ascenderback to summary
private float ascender
capHeightback to summary
private float capHeight
charactersback to summary
private int characters
characterSetback to summary
private String characterSet
charMetricsback to summary
private final List<CharMetric> charMetrics
charMetricsMapback to summary
private final Map<String, CharMetric> charMetricsMap
charWidthback to summary
private float[] charWidth
commentsback to summary
private final List<String> comments
compositesback to summary
private final List<Composite> composites
descenderback to summary
private float descender
encodingSchemeback to summary
private String encodingScheme
escCharback to summary
private int escChar
familyNameback to summary
private String familyName
fontBBoxback to summary
private BoundingBox fontBBox
fontNameback to summary
private String fontName
fontVersionback to summary
private String fontVersion
fullNameback to summary
private String fullName
isBaseFontback to summary
private boolean isBaseFont
isFixedPitchback to summary
private boolean isFixedPitch
isFixedVback to summary
private Boolean isFixedV
italicAngleback to summary
private float italicAngle
kernPairsback to summary
private final List<KernPair> kernPairs
kernPairs0back to summary
private final List<KernPair> kernPairs0
kernPairs1back to summary
private final List<KernPair> kernPairs1
mappingSchemeback to summary
private int mappingScheme
metricSetsback to summary
private int metricSets
noticeback to summary
private String notice
standardHorizontalWidthback to summary
private float standardHorizontalWidth
standardVerticalWidthback to summary
private float standardVerticalWidth
trackKernback to summary
private final List<TrackKern> trackKern
underlinePositionback to summary
private float underlinePosition
underlineThicknessback to summary
private float underlineThickness
vVectorback to summary
private float[] vVector
weightback to summary
private String weight
xHeightback to summary
private float xHeight

Constructor Detail

FontMetricsback to summary
public FontMetrics()

Constructor.

Method Detail

addCharMetricback to summary
public void addCharMetric(CharMetric metric)

This will add another character metric.

Parameters
metric:CharMetric

The character metric to add.

addCommentback to summary
public void addComment(String comment)

This will add a new comment.

Parameters
comment:String

The comment to add to this metric.

addCompositeback to summary
public void addComposite(Composite composite)

This will add a single composite part to the picture.

Parameters
composite:Composite

The composite info to add.

addKernPairback to summary
public void addKernPair(KernPair kernPair)

This will add a kern pair.

Parameters
kernPair:KernPair

The kern pair to add.

addKernPair0back to summary
public void addKernPair0(KernPair kernPair)

This will add a kern pair.

Parameters
kernPair:KernPair

The kern pair to add.

addKernPair1back to summary
public void addKernPair1(KernPair kernPair)

This will add a kern pair.

Parameters
kernPair:KernPair

The kern pair to add.

addTrackKernback to summary
public void addTrackKern(TrackKern kern)

This will add another track kern.

Parameters
kern:TrackKern

The track kerning data.

getAFMVersionback to summary
public float getAFMVersion()

This will get the version of the AFM document.

Returns:float

The version of the document.

getAscenderback to summary
public float getAscender()

Getter for property ascender.

Returns:float

Value of property ascender.

getAverageCharacterWidthback to summary
public float getAverageCharacterWidth()

This will get the average width of a character.

Returns:float

The width of the character.

getCapHeightback to summary
public float getCapHeight()

Getter for property capHeight.

Returns:float

Value of property capHeight.

getCharacterHeightback to summary
public float getCharacterHeight(String name)

This will get the width of a character.

Parameters
name:String

The character to get the width for.

Returns:float

The width of the character.

getCharactersback to summary
public int getCharacters()

Getter for property characters.

Returns:int

Value of property characters.

getCharacterSetback to summary
public String getCharacterSet()

Getter for property characterSet.

Returns:String

Value of property characterSet.

getCharacterWidthback to summary
public float getCharacterWidth(String name)

This will get the width of a character.

Parameters
name:String

The character to get the width for.

Returns:float

The width of the character.

getCharMetricsback to summary
public List<CharMetric> getCharMetrics()

Getter for property charMetrics.

Returns:List<CharMetric>

Value of property charMetrics.

getCharWidthback to summary
public float[] getCharWidth()

Getter for property charWidth.

Returns:float[]

Value of property charWidth.

getCommentsback to summary
public List<String> getComments()

This will get all comments.

Returns:List<String>

The list of all comments.

getCompositesback to summary
public List<Composite> getComposites()

Getter for property composites.

Returns:List<Composite>

Value of property composites.

getDescenderback to summary
public float getDescender()

Getter for property descender.

Returns:float

Value of property descender.

getEncodingSchemeback to summary
public String getEncodingScheme()

Getter for property encodingScheme.

Returns:String

Value of property encodingScheme.

getEscCharback to summary
public int getEscChar()

Getter for property escChar.

Returns:int

Value of property escChar.

getFamilyNameback to summary
public String getFamilyName()

Getter for property familyName.

Returns:String

Value of property familyName.

getFontBBoxback to summary
public BoundingBox getFontBBox()

Getter for property fontBBox.

Returns:BoundingBox

Value of property fontBBox.

getFontNameback to summary
public String getFontName()

Getter for property fontName.

Returns:String

Value of property fontName.

getFontVersionback to summary
public String getFontVersion()

Getter for property fontVersion.

Returns:String

Value of property fontVersion.

getFullNameback to summary
public String getFullName()

Getter for property fullName.

Returns:String

Value of property fullName.

getIsBaseFontback to summary
public boolean getIsBaseFont()

Getter for property isBaseFont.

Returns:boolean

Value of property isBaseFont.

getIsFixedPitchback to summary
public boolean getIsFixedPitch()

Getter for property isFixedPitch.

Returns:boolean

Value of property isFixedPitch.

getIsFixedVback to summary
public boolean getIsFixedV()

Getter for property isFixedV.

Returns:boolean

Value of property isFixedV.

getItalicAngleback to summary
public float getItalicAngle()

Getter for property italicAngle.

Returns:float

Value of property italicAngle.

getKernPairsback to summary
public List<KernPair> getKernPairs()

Getter for property kernPairs.

Returns:List<KernPair>

Value of property kernPairs.

getKernPairs0back to summary
public List<KernPair> getKernPairs0()

Getter for property kernPairs0.

Returns:List<KernPair>

Value of property kernPairs0.

getKernPairs1back to summary
public List<KernPair> getKernPairs1()

Getter for property kernPairs1.

Returns:List<KernPair>

Value of property kernPairs1.

getMappingSchemeback to summary
public int getMappingScheme()

Getter for property mappingScheme.

Returns:int

Value of property mappingScheme.

getMetricSetsback to summary
public int getMetricSets()

This will get the metricSets attribute.

Returns:int

The value of the metric sets.

getNoticeback to summary
public String getNotice()

Getter for property notice.

Returns:String

Value of property notice.

getStandardHorizontalWidthback to summary
public float getStandardHorizontalWidth()

Getter for property standardHorizontalWidth.

Returns:float

Value of property standardHorizontalWidth.

getStandardVerticalWidthback to summary
public float getStandardVerticalWidth()

Getter for property standardVerticalWidth.

Returns:float

Value of property standardVerticalWidth.

getTrackKernback to summary
public List<TrackKern> getTrackKern()

Getter for property trackKern.

Returns:List<TrackKern>

Value of property trackKern.

getUnderlinePositionback to summary
public float getUnderlinePosition()

Getter for property underlinePosition.

Returns:float

Value of property underlinePosition.

getUnderlineThicknessback to summary
public float getUnderlineThickness()

Getter for property underlineThickness.

Returns:float

Value of property underlineThickness.

getVVectorback to summary
public float[] getVVector()

Getter for property vVector.

Returns:float[]

Value of property vVector.

getWeightback to summary
public String getWeight()

Getter for property weight.

Returns:String

Value of property weight.

getXHeightback to summary
public float getXHeight()

Getter for property xHeight.

Returns:float

Value of property xHeight.

setAFMVersionback to summary
public void setAFMVersion(float afmVersionValue)

This will set the version of the AFM document.

Parameters
afmVersionValue:float

The version of the document.

setAscenderback to summary
public void setAscender(float ascenderValue)

Setter for property ascender.

Parameters
ascenderValue:float

New value of property ascender.

setCapHeightback to summary
public void setCapHeight(float capHeightValue)

Setter for property capHeight.

Parameters
capHeightValue:float

New value of property capHeight.

setCharactersback to summary
public void setCharacters(int charactersValue)

Setter for property characters.

Parameters
charactersValue:int

New value of property characters.

setCharacterSetback to summary
public void setCharacterSet(String characterSetValue)

Setter for property characterSet.

Parameters
characterSetValue:String

New value of property characterSet.

setCharWidthback to summary
public void setCharWidth(float[] charWidthValue)

Setter for property charWidth.

Parameters
charWidthValue:float[]

New value of property charWidth.

setDescenderback to summary
public void setDescender(float descenderValue)

Setter for property descender.

Parameters
descenderValue:float

New value of property descender.

setEncodingSchemeback to summary
public void setEncodingScheme(String encodingSchemeValue)

Setter for property encodingScheme.

Parameters
encodingSchemeValue:String

New value of property encodingScheme.

setEscCharback to summary
public void setEscChar(int escCharValue)

Setter for property escChar.

Parameters
escCharValue:int

New value of property escChar.

setFamilyNameback to summary
public void setFamilyName(String familyNameValue)

Setter for property familyName.

Parameters
familyNameValue:String

New value of property familyName.

setFixedPitchback to summary
public void setFixedPitch(boolean isFixedPitchValue)

Setter for property isFixedPitch.

Parameters
isFixedPitchValue:boolean

New value of property isFixedPitch.

setFontBBoxback to summary
public void setFontBBox(BoundingBox bBox)

Setter for property fontBBox.

Parameters
bBox:BoundingBox

New value of property fontBBox.

setFontNameback to summary
public void setFontName(String name)

Setter for property fontName.

Parameters
name:String

New value of property fontName.

setFontVersionback to summary
public void setFontVersion(String fontVersionValue)

Setter for property fontVersion.

Parameters
fontVersionValue:String

New value of property fontVersion.

setFullNameback to summary
public void setFullName(String fullNameValue)

Setter for property fullName.

Parameters
fullNameValue:String

New value of property fullName.

setIsBaseFontback to summary
public void setIsBaseFont(boolean isBaseFontValue)

Setter for property isBaseFont.

Parameters
isBaseFontValue:boolean

New value of property isBaseFont.

setIsFixedVback to summary
public void setIsFixedV(boolean isFixedVValue)

Setter for property isFixedV.

Parameters
isFixedVValue:boolean

New value of property isFixedV.

setItalicAngleback to summary
public void setItalicAngle(float italicAngleValue)

Setter for property italicAngle.

Parameters
italicAngleValue:float

New value of property italicAngle.

setMappingSchemeback to summary
public void setMappingScheme(int mappingSchemeValue)

Setter for property mappingScheme.

Parameters
mappingSchemeValue:int

New value of property mappingScheme.

setMetricSetsback to summary
public void setMetricSets(int metricSetsValue)

This will set the metricSets attribute. This value must be 0,1, or 2.

Parameters
metricSetsValue:int

The new metric sets attribute.

Exceptions
IllegalArgumentException:
If the metricSets attribute is not 0,1, or 2.
setNoticeback to summary
public void setNotice(String noticeValue)

Setter for property notice.

Parameters
noticeValue:String

New value of property notice.

setStandardHorizontalWidthback to summary
public void setStandardHorizontalWidth(float standardHorizontalWidthValue)

Setter for property standardHorizontalWidth.

Parameters
standardHorizontalWidthValue:float

New value of property standardHorizontalWidth.

setStandardVerticalWidthback to summary
public void setStandardVerticalWidth(float standardVerticalWidthValue)

Setter for property standardVerticalWidth.

Parameters
standardVerticalWidthValue:float

New value of property standardVerticalWidth.

setUnderlinePositionback to summary
public void setUnderlinePosition(float underlinePositionValue)

Setter for property underlinePosition.

Parameters
underlinePositionValue:float

New value of property underlinePosition.

setUnderlineThicknessback to summary
public void setUnderlineThickness(float underlineThicknessValue)

Setter for property underlineThickness.

Parameters
underlineThicknessValue:float

New value of property underlineThickness.

setVVectorback to summary
public void setVVector(float[] vVectorValue)

Setter for property vVector.

Parameters
vVectorValue:float[]

New value of property vVector.

setWeightback to summary
public void setWeight(String weightValue)

Setter for property weight.

Parameters
weightValue:String

New value of property weight.

setXHeightback to summary
public void setXHeight(float xHeightValue)

Setter for property xHeight.

Parameters
xHeightValue:float

New value of property xHeight.