org.apache.fontbox.afm

## Class AFMParser

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

    public class AFMParser
    extends Object

This class is used to parse AFM(Adobe Font Metrics) documents.

Author:
  Ben Litchfield
See Also:
  AFM Documentation

### Field Summary

Fields
`static String` `ASCENDER` This is ascender attribute.
`static String` `CAP_HEIGHT` This is the cap height attribute.
`static String` `CC` This is a composite character.
`static String` `CHAR_WIDTH` This is the char width.
`static String` `CHARACTER_SET` This is the character set.
`static String` `CHARACTERS` This is the characters attribute.
`static String` `CHARMETRICS_B` The character metrics value.
`static String` `CHARMETRICS_C` The character metrics c value.
`static String` `CHARMETRICS_CH` The character metrics c value.
`static String` `CHARMETRICS_L` The character metrics value.
`static String` `CHARMETRICS_N` The character metrics value.
`static String` `CHARMETRICS_VV` The character metrics value.
`static String` `CHARMETRICS_W` The character metrics value.
`static String` `CHARMETRICS_W0` The character metrics value.
`static String` `CHARMETRICS_W0X` The character metrics value.
`static String` `CHARMETRICS_W0Y` The character metrics value.
`static String` `CHARMETRICS_W1` The character metrics value.
`static String` `CHARMETRICS_W1X` The character metrics value.
`static String` `CHARMETRICS_W1Y` The character metrics value.
`static String` `CHARMETRICS_WX` The character metrics value.
`static String` `CHARMETRICS_WY` The character metrics value.
`static String` `COMMENT` This is a comment in a AFM file.
`static String` `DESCENDER` This is the descender attribute.
`static String` `ENCODING_SCHEME` This is the encoding scheme.
`static String` `END_CHAR_METRICS` This is the end of character metrics.
`static String` `END_COMPOSITES` This is the end composites data section.
`static String` `END_FONT_METRICS` This is the constant used in the AFM file to end a font metrics item.
`static String` `END_KERN_DATA` This is the end of kern data.
`static String` `END_KERN_PAIRS` This is the end of kern pairs data.
`static String` `END_TRACK_KERN` This is the end of track kern data.
`static String` `ESC_CHAR` This is the escape character.
`static String` `FAMILY_NAME` This is the Family name.
`static String` `FONT_BBOX` This is the font bounding box.
`static String` `FONT_NAME` This is the font name.
`static String` `FULL_NAME` This is the full name.
`static String` `IS_BASE_FONT` This will determine if this is a base font.
`static String` `IS_FIXED_PITCH` This will determine if this is fixed pitch.
`static String` `IS_FIXED_V` This will tell if the V is fixed.
`static String` `ITALIC_ANGLE` This is the italic angle.
`static String` `KERN_PAIR_KP` This is a kern pair.
`static String` `KERN_PAIR_KPH` This is a kern pair.
`static String` `KERN_PAIR_KPX` This is a kern pair.
`static String` `KERN_PAIR_KPY` This is a kern pair.
`static String` `MAPPING_SCHEME` This is the mapping scheme.
`static String` `NOTICE` This is the notice.
`static String` `PCC` This is a composite character part.
`static String` `START_CHAR_METRICS` This is the start of character metrics.
`static String` `START_COMPOSITES` This is the start composites data section.
`static String` `START_FONT_METRICS` This is the constant used in the AFM file to start a font metrics item.
`static String` `START_KERN_DATA` This is the start of kern data.
`static String` `START_KERN_PAIRS` This is the start of kern pairs data.
`static String` `START_KERN_PAIRS0` This is the start of kern pairs data.
`static String` `START_KERN_PAIRS1` This is the start of kern pairs data.
`static String` `START_TRACK_KERN` This is the start of track kern data.
`static String` `STD_HW` The character metrics value.
`static String` `STD_VW` The character metrics value.
`static String` `UNDERLINE_POSITION` The underline position.
`static String` `UNDERLINE_THICKNESS` This is the Underline thickness.
`static String` `V_VECTOR` This is the V Vector attribute.
`static String` `VERSION` This is the version of the font.
`static String` `WEIGHT` This is the weight.
`static String` `X_HEIGHT` This is the X height.

### Constructor Summary

Constructors
Constructor and Description
`AFMParser(InputStream in)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`FontMetrics` `parse()` This will parse the AFM document.
`FontMetrics` `parse(boolean reducedDataset)` This will parse the AFM document.

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

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

### Field Detail

#### COMMENT

    public static final String COMMENT

This is a comment in a AFM file.

See Also:
  Constant Field Values

#### START_FONT_METRICS

    public static final String START_FONT_METRICS

This is the constant used in the AFM file to start a font metrics item.

See Also:
  Constant Field Values

#### END_FONT_METRICS

    public static final String END_FONT_METRICS

This is the constant used in the AFM file to end a font metrics item.

See Also:
  Constant Field Values

#### FONT_NAME

    public static final String FONT_NAME

This is the font name.

See Also:
  Constant Field Values

#### FULL_NAME

    public static final String FULL_NAME

This is the full name.

See Also:
  Constant Field Values

#### FAMILY_NAME

    public static final String FAMILY_NAME

This is the Family name.

See Also:
  Constant Field Values

#### WEIGHT

    public static final String WEIGHT

This is the weight.

See Also:
  Constant Field Values

#### FONT_BBOX

    public static final String FONT_BBOX

This is the font bounding box.

See Also:
  Constant Field Values

#### VERSION

    public static final String VERSION

This is the version of the font.

See Also:
  Constant Field Values

#### NOTICE

    public static final String NOTICE

This is the notice.

See Also:
  Constant Field Values

#### ENCODING_SCHEME

    public static final String ENCODING_SCHEME

This is the encoding scheme.

See Also:
  Constant Field Values

#### MAPPING_SCHEME

    public static final String MAPPING_SCHEME

This is the mapping scheme.

See Also:
  Constant Field Values

#### ESC_CHAR

    public static final String ESC_CHAR

This is the escape character.

See Also:
  Constant Field Values

#### CHARACTER_SET

    public static final String CHARACTER_SET

This is the character set.

See Also:
  Constant Field Values

#### CHARACTERS

    public static final String CHARACTERS

This is the characters attribute.

See Also:
  Constant Field Values

#### IS_BASE_FONT

    public static final String IS_BASE_FONT

This will determine if this is a base font.

See Also:
  Constant Field Values

#### V_VECTOR

    public static final String V_VECTOR

This is the V Vector attribute.

See Also:
  Constant Field Values

#### IS_FIXED_V

    public static final String IS_FIXED_V

This will tell if the V is fixed.

See Also:
  Constant Field Values

#### CAP_HEIGHT

    public static final String CAP_HEIGHT

This is the cap height attribute.

See Also:
  Constant Field Values

#### X_HEIGHT

    public static final String X_HEIGHT

This is the X height.

See Also:
  Constant Field Values

#### ASCENDER

    public static final String ASCENDER

This is ascender attribute.

See Also:
  Constant Field Values

#### DESCENDER

    public static final String DESCENDER

This is the descender attribute.

See Also:
  Constant Field Values

#### UNDERLINE_POSITION

    public static final String UNDERLINE_POSITION

The underline position.

See Also:
  Constant Field Values

#### UNDERLINE_THICKNESS

    public static final String UNDERLINE_THICKNESS

This is the Underline thickness.

See Also:
  Constant Field Values

#### ITALIC_ANGLE

    public static final String ITALIC_ANGLE

This is the italic angle.

See Also:
  Constant Field Values

#### CHAR_WIDTH

    public static final String CHAR_WIDTH

This is the char width.

See Also:
  Constant Field Values

#### IS_FIXED_PITCH

    public static final String IS_FIXED_PITCH

This will determine if this is fixed pitch.

See Also:
  Constant Field Values

#### START_CHAR_METRICS

    public static final String START_CHAR_METRICS

This is the start of character metrics.

See Also:
  Constant Field Values

#### END_CHAR_METRICS

    public static final String END_CHAR_METRICS

This is the end of character metrics.

See Also:
  Constant Field Values

#### CHARMETRICS_C

    public static final String CHARMETRICS_C

The character metrics c value.

See Also:
  Constant Field Values

#### CHARMETRICS_CH

    public static final String CHARMETRICS_CH

The character metrics c value.

See Also:
  Constant Field Values

#### CHARMETRICS_WX

    public static final String CHARMETRICS_WX

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_W0X

    public static final String CHARMETRICS_W0X

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_W1X

    public static final String CHARMETRICS_W1X

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_WY

    public static final String CHARMETRICS_WY

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_W0Y

    public static final String CHARMETRICS_W0Y

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_W1Y

    public static final String CHARMETRICS_W1Y

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_W

    public static final String CHARMETRICS_W

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_W0

    public static final String CHARMETRICS_W0

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_W1

    public static final String CHARMETRICS_W1

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_VV

    public static final String CHARMETRICS_VV

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_N

    public static final String CHARMETRICS_N

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_B

    public static final String CHARMETRICS_B

The character metrics value.

See Also:
  Constant Field Values

#### CHARMETRICS_L

    public static final String CHARMETRICS_L

The character metrics value.

See Also:
  Constant Field Values

#### STD_HW

    public static final String STD_HW

The character metrics value.

See Also:
  Constant Field Values

#### STD_VW

    public static final String STD_VW

The character metrics value.

See Also:
  Constant Field Values

#### START_TRACK_KERN

    public static final String START_TRACK_KERN

This is the start of track kern data.

See Also:
  Constant Field Values

#### END_TRACK_KERN

    public static final String END_TRACK_KERN

This is the end of track kern data.

See Also:
  Constant Field Values

#### START_KERN_DATA

    public static final String START_KERN_DATA

This is the start of kern data.

See Also:
  Constant Field Values

#### END_KERN_DATA

    public static final String END_KERN_DATA

This is the end of kern data.

See Also:
  Constant Field Values

#### START_KERN_PAIRS

    public static final String START_KERN_PAIRS

This is the start of kern pairs data.

See Also:
  Constant Field Values

#### END_KERN_PAIRS

    public static final String END_KERN_PAIRS

This is the end of kern pairs data.

See Also:
  Constant Field Values

#### START_KERN_PAIRS0

    public static final String START_KERN_PAIRS0

This is the start of kern pairs data.

See Also:
  Constant Field Values

#### START_KERN_PAIRS1

    public static final String START_KERN_PAIRS1

This is the start of kern pairs data.

See Also:
  Constant Field Values

#### START_COMPOSITES

    public static final String START_COMPOSITES

This is the start composites data section.

See Also:
  Constant Field Values

#### END_COMPOSITES

    public static final String END_COMPOSITES

This is the end composites data section.

See Also:
  Constant Field Values

#### CC

    public static final String CC

This is a composite character.

See Also:
  Constant Field Values

#### PCC

    public static final String PCC

This is a composite character part.

See Also:
  Constant Field Values

#### KERN_PAIR_KP

    public static final String KERN_PAIR_KP

This is a kern pair.

See Also:
  Constant Field Values

#### KERN_PAIR_KPH

    public static final String KERN_PAIR_KPH

This is a kern pair.

See Also:
  Constant Field Values

#### KERN_PAIR_KPX

    public static final String KERN_PAIR_KPX

This is a kern pair.

See Also:
  Constant Field Values

#### KERN_PAIR_KPY

    public static final String KERN_PAIR_KPY

This is a kern pair.

See Also:
  Constant Field Values

### Constructor Detail

#### AFMParser

    public AFMParser(InputStream in)

Constructor.

Parameters:
  `in` - The input stream to read the AFM document from.

### Method Detail

#### parse

    public FontMetrics parse()
                      throws IOException

This will parse the AFM document. The input stream is closed when the parsing is finished.

Returns:
  the parsed FontMetric
Throws:
  `IOException` - If there is an IO error reading the document.

#### parse

    public FontMetrics parse(boolean reducedDataset)
                      throws IOException

This will parse the AFM document. The input stream is closed when the parsing is finished.

Parameters:
  `reducedDataset` - parse a reduced subset of data if set to true
Returns:
  the parsed FontMetric
Throws:
  `IOException` - If there is an IO error reading the document.