org.apache.fop.fonts.type1

## Class AFMFile

- java.lang.Object
- - org.apache.fop.fonts.type1.AFMFile

-     public class AFMFile
      extends java.lang.Object

  Represents the contents of a Type 1 AFM font metrics file.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AFMFile()` Default constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCharMetrics(AFMCharMetrics metrics)` Adds new character metrics.
    `void` | `addXKerning(java.lang.String name1, java.lang.String name2, double kx)` Adds a X-kerning entry.
    `java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>>` | `createXKerningMapEncoded()` Creates and returns a kerning map for writing mode 0 (ltr) with character codes.
    `java.lang.Number` | `getAscender()` Returns the Ascender value.
    `java.lang.Number` | `getCapHeight()` Returns the CapHeight value.
    `AFMCharMetrics` | `getChar(java.lang.String name)` Returns the character metrics associated with the character name.
    `java.lang.String` | `getCharacterSet()` Returns the CharacterSet value.
    `int` | `getCharCount()` Returns the number of character available for this font.
    `java.util.List<AFMCharMetrics>` | `getCharMetrics()` Returns the list of AFMCharMetrics instances representing all the available characters.
    `java.lang.Number` | `getDescender()` Returns the Descender value.
    `java.lang.String` | `getEncodingScheme()` Returns the EncodingScheme value.
    `java.lang.String` | `getFamilyName()` Returns the FamilyName value.
    `int` | `getFirstChar()` Returns the first character index in the encoding that has a glyph.
    `java.awt.geom.RectangularShape` | `getFontBBox()` Returns the FontBBox value.
    `int[]` | `getFontBBoxAsIntArray()` Returns the FontBBox value as integer array.
    `java.lang.String` | `getFontName()` Returns the FontName value.
    `java.lang.String` | `getFullName()` Returns the FullName value.
    `int` | `getLastChar()` Returns the last character index in the encoding that has a glyph.
    `java.lang.Number` | `getStdHW()` Returns the StdHW value.
    `java.lang.Number` | `getStdVW()` Returns the StdVW value.
    `java.lang.String` | `getWeight()` Returns the Weight value.
    `AFMWritingDirectionMetrics` | `getWritingDirectionMetrics(int index)` Gets writing direction metrics.
    `java.lang.Number` | `getXHeight()` Returns the XHeight value.
    `boolean` | `hasKerning()` 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(java.lang.Number ascender)` Sets the Ascender value.
    `void` | `setCapHeight(java.lang.Number capHeight)` Sets the CapHeight value.
    `void` | `setCharacterSet(java.lang.String characterSet)` Sets the CharacterSet value.
    `void` | `setDescender(java.lang.Number descender)` Sets the Descender value.
    `void` | `setEncodingScheme(java.lang.String encodingScheme)` Sets the EncodingScheme value
    `void` | `setFamilyName(java.lang.String familyName)` Sets the FamilyName value.
    `void` | `setFontBBox(java.awt.geom.RectangularShape fontBBox)` Sets the FontBBox value.
    `void` | `setFontName(java.lang.String fontName)` Sets the FontName value.
    `void` | `setFullName(java.lang.String fullName)` Sets the FullName value.
    `void` | `setStdHW(java.lang.Number stdHW)` Sets the StdHW value.
    `void` | `setStdVW(java.lang.Number stdVW)` Sets the StdVW value.
    `void` | `setWeight(java.lang.String weight)` Sets the Weight value.
    `void` | `setWritingDirectionMetrics(int index, AFMWritingDirectionMetrics metrics)` Sets writing direction metrics.
    `void` | `setXHeight(java.lang.Number height)` Sets the XHeight value.
    `java.lang.String` | `toString()`

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

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

- - ### Constructor Detail

    - #### AFMFile

          public AFMFile()

      Default constructor.

  - ### Method Detail

    - #### getFontName

          public java.lang.String getFontName()

      Returns the FontName value.
      Returns:
        the font name

    - #### setFontName

          public void setFontName(java.lang.String fontName)

      Sets the FontName value.
      Parameters:
        `fontName` - the font name to set

    - #### getFullName

          public java.lang.String getFullName()

      Returns the FullName value.
      Returns:
        the full name of the font

    - #### setFullName

          public void setFullName(java.lang.String fullName)

      Sets the FullName value.
      Parameters:
        `fullName` - the full name to set

    - #### getFamilyName

          public java.lang.String getFamilyName()

      Returns the FamilyName value.
      Returns:
        the family name of the font

    - #### setFamilyName

          public void setFamilyName(java.lang.String familyName)

      Sets the FamilyName value.
      Parameters:
        `familyName` - the family name to set

    - #### getWeight

          public java.lang.String getWeight()

      Returns the Weight value.
      Returns:
        the weight

    - #### setWeight

          public void setWeight(java.lang.String weight)

      Sets the Weight value.
      Parameters:
        `weight` - the weight to set

    - #### getFontBBox

          public java.awt.geom.RectangularShape 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

          public void setFontBBox(java.awt.geom.RectangularShape fontBBox)

      Sets the FontBBox value.
      Parameters:
        `fontBBox` - the fontBBox to set

    - #### getEncodingScheme

          public java.lang.String getEncodingScheme()

      Returns the EncodingScheme value.
      Returns:
        the encoding scheme

    - #### setEncodingScheme

          public void setEncodingScheme(java.lang.String encodingScheme)

      Sets the EncodingScheme value
      Parameters:
        `encodingScheme` - the encodingScheme to set

    - #### getCharacterSet

          public java.lang.String getCharacterSet()

      Returns the CharacterSet value.
      Returns:
        the characterSet

    - #### setCharacterSet

          public void setCharacterSet(java.lang.String characterSet)

      Sets the CharacterSet value.
      Parameters:
        `characterSet` - the characterSet to set

    - #### getCapHeight

          public java.lang.Number getCapHeight()

      Returns the CapHeight value.
      Returns:
        the capHeight

    - #### setCapHeight

          public void setCapHeight(java.lang.Number capHeight)

      Sets the CapHeight value.
      Parameters:
        `capHeight` - the capHeight to set

    - #### getXHeight

          public java.lang.Number getXHeight()

      Returns the XHeight value.
      Returns:
        the xHeight

    - #### setXHeight

          public void setXHeight(java.lang.Number height)

      Sets the XHeight value.
      Parameters:
        `height` - the xHeight to set

    - #### getAscender

          public java.lang.Number getAscender()

      Returns the Ascender value.
      Returns:
        the ascender

    - #### setAscender

          public void setAscender(java.lang.Number ascender)

      Sets the Ascender value.
      Parameters:
        `ascender` - the ascender to set

    - #### getDescender

          public java.lang.Number getDescender()

      Returns the Descender value.
      Returns:
        the descender

    - #### setDescender

          public void setDescender(java.lang.Number descender)

      Sets the Descender value.
      Parameters:
        `descender` - the descender to set

    - #### getStdHW

          public java.lang.Number getStdHW()

      Returns the StdHW value.
      Returns:
        the descender

    - #### setStdHW

          public void setStdHW(java.lang.Number stdHW)

      Sets the StdHW value.
      Parameters:
        `stdHW` - the StdHW to set

    - #### getStdVW

          public java.lang.Number getStdVW()

      Returns the StdVW value.
      Returns:
        the descender

    - #### setStdVW

          public void setStdVW(java.lang.Number stdVW)

      Sets the StdVW value.
      Parameters:
        `stdVW` - the StdVW to set

    - #### getWritingDirectionMetrics

          public AFMWritingDirectionMetrics getWritingDirectionMetrics(int index)

      Gets writing direction metrics.
      Parameters:
        `index` - the writing direction (0, 1 or 2)
      Returns:
        the writing direction metrics

    - #### setWritingDirectionMetrics

          public void setWritingDirectionMetrics(int index,
                                                 AFMWritingDirectionMetrics metrics)

      Sets writing direction metrics.
      Parameters:
        `index` - the writing direction (0, 1 or 2)
        `metrics` - the writing direction metrics

    - #### addCharMetrics

          public void addCharMetrics(AFMCharMetrics metrics)

      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

          public AFMCharMetrics getChar(java.lang.String name)

      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

          public java.util.List<AFMCharMetrics> getCharMetrics()

      Returns the list of AFMCharMetrics instances representing all the available characters.
      Returns:
        a List of AFMCharMetrics instances

    - #### addXKerning

          public void addXKerning(java.lang.String name1,
                                  java.lang.String name2,
                                  double kx)

      Adds a X-kerning entry.
      Parameters:
        `name1` - the name of the first character
        `name2` - the name of the second character
        `kx` - kerning value in x-direction

    - #### hasKerning

          public boolean hasKerning()

      Indicates whether the font has kerning information.
      Returns:
        true if there is kerning information

    - #### createXKerningMapEncoded

          public java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> 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

          public 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. Therefore, we provide a way to override this primary encoding.
      Parameters:
        `encoding` - the encoding to replace the one given in the AFM

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

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