org.apache.fontbox.afm

## Class FontMetrics

- java.lang.Object
- - org.apache.fontbox.afm.FontMetrics

    public class FontMetrics
    extends Object

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

Author:
  Ben Litchfield

### Constructor Summary

Constructors
Constructor and Description
`FontMetrics()` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addCharMetric(CharMetric metric)` This will add another character metric.
`void` `addComment(String comment)` This will add a new comment.
`void` `addComposite(Composite composite)` This will add a single composite part to the picture.
`void` `addKernPair(KernPair kernPair)` This will add a kern pair.
`void` `addKernPair0(KernPair kernPair)` This will add a kern pair.
`void` `addKernPair1(KernPair kernPair)` This will add a kern pair.
`void` `addTrackKern(TrackKern kern)` This will add another track kern.
`float` `getAFMVersion()` This will get the version of the AFM document.
`float` `getAscender()` Getter for property ascender.
`float` `getAverageCharacterWidth()` This will get the average width of a character.
`float` `getCapHeight()` Getter for property capHeight.
`float` `getCharacterHeight(String name)` This will get the width of a character.
`int` `getCharacters()` Getter for property characters.
`String` `getCharacterSet()` Getter for property characterSet.
`float` `getCharacterWidth(String name)` This will get the width of a character.
`List<CharMetric>` `getCharMetrics()` Getter for property charMetrics.
`float[]` `getCharWidth()` Getter for property charWidth.
`List<String>` `getComments()` This will get all comments.
`List<Composite>` `getComposites()` Getter for property composites.
`float` `getDescender()` Getter for property descender.
`String` `getEncodingScheme()` Getter for property encodingScheme.
`int` `getEscChar()` Getter for property escChar.
`String` `getFamilyName()` Getter for property familyName.
`BoundingBox` `getFontBBox()` Getter for property fontBBox.
`String` `getFontName()` Getter for property fontName.
`String` `getFontVersion()` Getter for property fontVersion.
`String` `getFullName()` Getter for property fullName.
`float` `getItalicAngle()` Getter for property italicAngle.
`List<KernPair>` `getKernPairs()` Getter for property kernPairs.
`List<KernPair>` `getKernPairs0()` Getter for property kernPairs0.
`List<KernPair>` `getKernPairs1()` Getter for property kernPairs1.
`int` `getMappingScheme()` Getter for property mappingScheme.
`int` `getMetricSets()` This will get the metricSets attribute.
`String` `getNotice()` Getter for property notice.
`float` `getStandardHorizontalWidth()` Getter for property standardHorizontalWidth.
`float` `getStandardVerticalWidth()` Getter for property standardVerticalWidth.
`List<TrackKern>` `getTrackKern()` Getter for property trackKern.
`float` `getUnderlinePosition()` Getter for property underlinePosition.
`float` `getUnderlineThickness()` Getter for property underlineThickness.
`float[]` `getVVector()` Getter for property vVector.
`String` `getWeight()` Getter for property weight.
`float` `getXHeight()` Getter for property xHeight.
`boolean` `isBaseFont()` Getter for property isBaseFont.
`boolean` `isFixedPitch()` Getter for property isFixedPitch.
`boolean` `isFixedV()` Getter for property isFixedV.
`void` `setAFMVersion(float afmVersionValue)` This will set the version of the AFM document.
`void` `setAscender(float ascenderValue)` Setter for property ascender.
`void` `setCapHeight(float capHeightValue)` Setter for property capHeight.
`void` `setCharacters(int charactersValue)` Setter for property characters.
`void` `setCharacterSet(String characterSetValue)` Setter for property characterSet.
`void` `setCharMetrics(List<CharMetric> charMetricsValue)` Setter for property charMetrics.
`void` `setCharWidth(float[] charWidthValue)` Setter for property charWidth.
`void` `setComposites(List<Composite> compositesList)` Setter for property composites.
`void` `setDescender(float descenderValue)` Setter for property descender.
`void` `setEncodingScheme(String encodingSchemeValue)` Setter for property encodingScheme.
`void` `setEscChar(int escCharValue)` Setter for property escChar.
`void` `setFamilyName(String familyNameValue)` Setter for property familyName.
`void` `setFixedPitch(boolean isFixedPitchValue)` Setter for property isFixedPitch.
`void` `setFontBBox(BoundingBox bBox)` Setter for property fontBBox.
`void` `setFontName(String name)` Setter for property fontName.
`void` `setFontVersion(String fontVersionValue)` Setter for property fontVersion.
`void` `setFullName(String fullNameValue)` Setter for property fullName.
`void` `setIsBaseFont(boolean isBaseFontValue)` Setter for property isBaseFont.
`void` `setIsFixedV(boolean isFixedVValue)` Setter for property isFixedV.
`void` `setItalicAngle(float italicAngleValue)` Setter for property italicAngle.
`void` `setKernPairs(List<KernPair> kernPairsList)` Setter for property kernPairs.
`void` `setKernPairs0(List<KernPair> kernPairs0List)` Setter for property kernPairs0.
`void` `setKernPairs1(List<KernPair> kernPairs1List)` Setter for property kernPairs1.
`void` `setMappingScheme(int mappingSchemeValue)` Setter for property mappingScheme.
`void` `setMetricSets(int metricSetsValue)` This will set the metricSets attribute.
`void` `setNotice(String noticeValue)` Setter for property notice.
`void` `setStandardHorizontalWidth(float standardHorizontalWidthValue)` Setter for property standardHorizontalWidth.
`void` `setStandardVerticalWidth(float standardVerticalWidthValue)` Setter for property standardVerticalWidth.
`void` `setTrackKern(List<TrackKern> trackKernValue)` Setter for property trackKern.
`void` `setUnderlinePosition(float underlinePositionValue)` Setter for property underlinePosition.
`void` `setUnderlineThickness(float underlineThicknessValue)` Setter for property underlineThickness.
`void` `setVVector(float[] vVectorValue)` Setter for property vVector.
`void` `setWeight(String weightValue)` Setter for property weight.
`void` `setXHeight(float xHeightValue)` Setter for property xHeight.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FontMetrics

    public FontMetrics()

Constructor.

### Method Detail

#### getCharacterWidth

    public float getCharacterWidth(String name)

This will get the width of a character.

Parameters:
  `name` - The character to get the width for.
Returns:
  The width of the character.

#### getCharacterHeight

    public float getCharacterHeight(String name)

This will get the width of a character.

Parameters:
  `name` - The character to get the width for.
Returns:
  The width of the character.

#### getAverageCharacterWidth

    public float getAverageCharacterWidth()

This will get the average width of a character.

Returns:
  The width of the character.

#### addComment

    public void addComment(String comment)

This will add a new comment.

Parameters:
  `comment` - The comment to add to this metric.

#### getComments

    public List<String> getComments()

This will get all comments.

Returns:
  The list of all comments.

#### getAFMVersion

    public float getAFMVersion()

This will get the version of the AFM document.

Returns:
  The version of the document.

#### getMetricSets

    public int getMetricSets()

This will get the metricSets attribute.

Returns:
  The value of the metric sets.

#### setAFMVersion

    public void setAFMVersion(float afmVersionValue)

This will set the version of the AFM document.

Parameters:
  `afmVersionValue` - The version of the document.

#### setMetricSets

    public void setMetricSets(int metricSetsValue)

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

Parameters:
  `metricSetsValue` - The new metric sets attribute.
Throws:
  `IllegalArgumentException` - If the metricSets attribute is not 0,1, or 2.

#### getFontName

    public String getFontName()

Getter for property fontName.

Returns:
  Value of property fontName.

#### setFontName

    public void setFontName(String name)

Setter for property fontName.

Parameters:
  `name` - New value of property fontName.

#### getFullName

    public String getFullName()

Getter for property fullName.

Returns:
  Value of property fullName.

#### setFullName

    public void setFullName(String fullNameValue)

Setter for property fullName.

Parameters:
  `fullNameValue` - New value of property fullName.

#### getFamilyName

    public String getFamilyName()

Getter for property familyName.

Returns:
  Value of property familyName.

#### setFamilyName

    public void setFamilyName(String familyNameValue)

Setter for property familyName.

Parameters:
  `familyNameValue` - New value of property familyName.

#### getWeight

    public String getWeight()

Getter for property weight.

Returns:
  Value of property weight.

#### setWeight

    public void setWeight(String weightValue)

Setter for property weight.

Parameters:
  `weightValue` - New value of property weight.

#### getFontBBox

    public BoundingBox getFontBBox()

Getter for property fontBBox.

Returns:
  Value of property fontBBox.

#### setFontBBox

    public void setFontBBox(BoundingBox bBox)

Setter for property fontBBox.

Parameters:
  `bBox` - New value of property fontBBox.

#### getNotice

    public String getNotice()

Getter for property notice.

Returns:
  Value of property notice.

#### setNotice

    public void setNotice(String noticeValue)

Setter for property notice.

Parameters:
  `noticeValue` - New value of property notice.

#### getEncodingScheme

    public String getEncodingScheme()

Getter for property encodingScheme.

Returns:
  Value of property encodingScheme.

#### setEncodingScheme

    public void setEncodingScheme(String encodingSchemeValue)

Setter for property encodingScheme.

Parameters:
  `encodingSchemeValue` - New value of property encodingScheme.

#### getMappingScheme

    public int getMappingScheme()

Getter for property mappingScheme.

Returns:
  Value of property mappingScheme.

#### setMappingScheme

    public void setMappingScheme(int mappingSchemeValue)

Setter for property mappingScheme.

Parameters:
  `mappingSchemeValue` - New value of property mappingScheme.

#### getEscChar

    public int getEscChar()

Getter for property escChar.

Returns:
  Value of property escChar.

#### setEscChar

    public void setEscChar(int escCharValue)

Setter for property escChar.

Parameters:
  `escCharValue` - New value of property escChar.

#### getCharacterSet

    public String getCharacterSet()

Getter for property characterSet.

Returns:
  Value of property characterSet.

#### setCharacterSet

    public void setCharacterSet(String characterSetValue)

Setter for property characterSet.

Parameters:
  `characterSetValue` - New value of property characterSet.

#### getCharacters

    public int getCharacters()

Getter for property characters.

Returns:
  Value of property characters.

#### setCharacters

    public void setCharacters(int charactersValue)

Setter for property characters.

Parameters:
  `charactersValue` - New value of property characters.

#### isBaseFont

    public boolean isBaseFont()

Getter for property isBaseFont.

Returns:
  Value of property isBaseFont.

#### setIsBaseFont

    public void setIsBaseFont(boolean isBaseFontValue)

Setter for property isBaseFont.

Parameters:
  `isBaseFontValue` - New value of property isBaseFont.

#### getVVector

    public float[] getVVector()

Getter for property vVector.

Returns:
  Value of property vVector.

#### setVVector

    public void setVVector(float[] vVectorValue)

Setter for property vVector.

Parameters:
  `vVectorValue` - New value of property vVector.

#### isFixedV

    public boolean isFixedV()

Getter for property isFixedV.

Returns:
  Value of property isFixedV.

#### setIsFixedV

    public void setIsFixedV(boolean isFixedVValue)

Setter for property isFixedV.

Parameters:
  `isFixedVValue` - New value of property isFixedV.

#### getCapHeight

    public float getCapHeight()

Getter for property capHeight.

Returns:
  Value of property capHeight.

#### setCapHeight

    public void setCapHeight(float capHeightValue)

Setter for property capHeight.

Parameters:
  `capHeightValue` - New value of property capHeight.

#### getXHeight

    public float getXHeight()

Getter for property xHeight.

Returns:
  Value of property xHeight.

#### setXHeight

    public void setXHeight(float xHeightValue)

Setter for property xHeight.

Parameters:
  `xHeightValue` - New value of property xHeight.

#### getAscender

    public float getAscender()

Getter for property ascender.

Returns:
  Value of property ascender.

#### setAscender

    public void setAscender(float ascenderValue)

Setter for property ascender.

Parameters:
  `ascenderValue` - New value of property ascender.

#### getDescender

    public float getDescender()

Getter for property descender.

Returns:
  Value of property descender.

#### setDescender

    public void setDescender(float descenderValue)

Setter for property descender.

Parameters:
  `descenderValue` - New value of property descender.

#### getFontVersion

    public String getFontVersion()

Getter for property fontVersion.

Returns:
  Value of property fontVersion.

#### setFontVersion

    public void setFontVersion(String fontVersionValue)

Setter for property fontVersion.

Parameters:
  `fontVersionValue` - New value of property fontVersion.

#### getUnderlinePosition

    public float getUnderlinePosition()

Getter for property underlinePosition.

Returns:
  Value of property underlinePosition.

#### setUnderlinePosition

    public void setUnderlinePosition(float underlinePositionValue)

Setter for property underlinePosition.

Parameters:
  `underlinePositionValue` - New value of property underlinePosition.

#### getUnderlineThickness

    public float getUnderlineThickness()

Getter for property underlineThickness.

Returns:
  Value of property underlineThickness.

#### setUnderlineThickness

    public void setUnderlineThickness(float underlineThicknessValue)

Setter for property underlineThickness.

Parameters:
  `underlineThicknessValue` - New value of property underlineThickness.

#### getItalicAngle

    public float getItalicAngle()

Getter for property italicAngle.

Returns:
  Value of property italicAngle.

#### setItalicAngle

    public void setItalicAngle(float italicAngleValue)

Setter for property italicAngle.

Parameters:
  `italicAngleValue` - New value of property italicAngle.

#### getCharWidth

    public float[] getCharWidth()

Getter for property charWidth.

Returns:
  Value of property charWidth.

#### setCharWidth

    public void setCharWidth(float[] charWidthValue)

Setter for property charWidth.

Parameters:
  `charWidthValue` - New value of property charWidth.

#### isFixedPitch

    public boolean isFixedPitch()

Getter for property isFixedPitch.

Returns:
  Value of property isFixedPitch.

#### setFixedPitch

    public void setFixedPitch(boolean isFixedPitchValue)

Setter for property isFixedPitch.

Parameters:
  `isFixedPitchValue` - New value of property isFixedPitch.

#### getCharMetrics

    public List<CharMetric> getCharMetrics()

Getter for property charMetrics.

Returns:
  Value of property charMetrics.

#### setCharMetrics

    public void setCharMetrics(List<CharMetric> charMetricsValue)

Setter for property charMetrics.

Parameters:
  `charMetricsValue` - New value of property charMetrics.

#### addCharMetric

    public void addCharMetric(CharMetric metric)

This will add another character metric.

Parameters:
  `metric` - The character metric to add.

#### getTrackKern

    public List<TrackKern> getTrackKern()

Getter for property trackKern.

Returns:
  Value of property trackKern.

#### setTrackKern

    public void setTrackKern(List<TrackKern> trackKernValue)

Setter for property trackKern.

Parameters:
  `trackKernValue` - New value of property trackKern.

#### addTrackKern

    public void addTrackKern(TrackKern kern)

This will add another track kern.

Parameters:
  `kern` - The track kerning data.

#### getComposites

    public List<Composite> getComposites()

Getter for property composites.

Returns:
  Value of property composites.

#### setComposites

    public void setComposites(List<Composite> compositesList)

Setter for property composites.

Parameters:
  `compositesList` - New value of property composites.

#### addComposite

    public void addComposite(Composite composite)

This will add a single composite part to the picture.

Parameters:
  `composite` - The composite info to add.

#### getKernPairs

    public List<KernPair> getKernPairs()

Getter for property kernPairs.

Returns:
  Value of property kernPairs.

#### addKernPair

    public void addKernPair(KernPair kernPair)

This will add a kern pair.

Parameters:
  `kernPair` - The kern pair to add.

#### setKernPairs

    public void setKernPairs(List<KernPair> kernPairsList)

Setter for property kernPairs.

Parameters:
  `kernPairsList` - New value of property kernPairs.

#### getKernPairs0

    public List<KernPair> getKernPairs0()

Getter for property kernPairs0.

Returns:
  Value of property kernPairs0.

#### addKernPair0

    public void addKernPair0(KernPair kernPair)

This will add a kern pair.

Parameters:
  `kernPair` - The kern pair to add.

#### setKernPairs0

    public void setKernPairs0(List<KernPair> kernPairs0List)

Setter for property kernPairs0.

Parameters:
  `kernPairs0List` - New value of property kernPairs0.

#### getKernPairs1

    public List<KernPair> getKernPairs1()

Getter for property kernPairs1.

Returns:
  Value of property kernPairs1.

#### addKernPair1

    public void addKernPair1(KernPair kernPair)

This will add a kern pair.

Parameters:
  `kernPair` - The kern pair to add.

#### setKernPairs1

    public void setKernPairs1(List<KernPair> kernPairs1List)

Setter for property kernPairs1.

Parameters:
  `kernPairs1List` - New value of property kernPairs1.

#### getStandardHorizontalWidth

    public float getStandardHorizontalWidth()

Getter for property standardHorizontalWidth.

Returns:
  Value of property standardHorizontalWidth.

#### setStandardHorizontalWidth

    public void setStandardHorizontalWidth(float standardHorizontalWidthValue)

Setter for property standardHorizontalWidth.

Parameters:
  `standardHorizontalWidthValue` - New value of property standardHorizontalWidth.

#### getStandardVerticalWidth

    public float getStandardVerticalWidth()

Getter for property standardVerticalWidth.

Returns:
  Value of property standardVerticalWidth.

#### setStandardVerticalWidth

    public void setStandardVerticalWidth(float standardVerticalWidthValue)

Setter for property standardVerticalWidth.

Parameters:
  `standardVerticalWidthValue` - New value of property standardVerticalWidth.