org.apache.fontbox.afm

Class AFMParser

public class AFMParser extends Object

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

Version: $Revision: 1.1 $

Author: Ben Litchfield (ben@benlitchfield.com)

See Also: AFM Documentation

Field Summary
static StringASCENDER
This is ascender attribute.
static StringCAP_HEIGHT
This is the cap height attribute.
static StringCC
This is a composite character.
static StringCHARACTERS
This is the characters attribute.
static StringCHARACTER_SET
This is the character set.
static StringCHARMETRICS_B
The character metrics value.
static StringCHARMETRICS_C
The character metrics c value.
static StringCHARMETRICS_CH
The character metrics c value.
static StringCHARMETRICS_L
The character metrics value.
static StringCHARMETRICS_N
The character metrics value.
static StringCHARMETRICS_VV
The character metrics value.
static StringCHARMETRICS_W
The character metrics value.
static StringCHARMETRICS_W0
The character metrics value.
static StringCHARMETRICS_W0X
The character metrics value.
static StringCHARMETRICS_W0Y
The character metrics value.
static StringCHARMETRICS_W1
The character metrics value.
static StringCHARMETRICS_W1X
The character metrics value.
static StringCHARMETRICS_W1Y
The character metrics value.
static StringCHARMETRICS_WX
The character metrics value.
static StringCHARMETRICS_WY
The character metrics value.
static StringCHAR_WIDTH
This is the char width.
static StringCOMMENT
This is a comment in a AFM file.
static StringDESCENDER
This is the descender attribute.
static StringENCODING_SCHEME
This is the encoding scheme.
static StringEND_CHAR_METRICS
This is the end of character metrics.
static StringEND_COMPOSITES
This is the end compisites data section.
static StringEND_FONT_METRICS
This is the constant used in the AFM file to end a font metrics item.
static StringEND_KERN_DATA
This is the end of kern data.
static StringEND_KERN_PAIRS
This is the end of kern pairs data.
static StringEND_TRACK_KERN
This is the end of track kern data.
static StringESC_CHAR
This is the escape character.
static StringFAMILY_NAME
This is the Family name.
static StringFONT_BBOX
This is the font bounding box.
static StringFONT_NAME
This is the font name.
static StringFULL_NAME
This is the full name.
static StringIS_BASE_FONT
This will determine if this is a base font.
static StringIS_FIXED_PITCH
This will determine if this is fixed pitch.
static StringIS_FIXED_V
This will tell if the V is fixed.
static StringITALIC_ANGLE
This is the italic angle.
static StringKERN_PAIR_KP
This is a kern pair.
static StringKERN_PAIR_KPH
This is a kern pair.
static StringKERN_PAIR_KPX
This is a kern pair.
static StringKERN_PAIR_KPY
This is a kern pair.
static StringMAPPING_SCHEME
This is the mapping scheme.
static StringNOTICE
This is the notice.
static StringPCC
This is a composite charater part.
static StringSTART_CHAR_METRICS
This is the start of character metrics.
static StringSTART_COMPOSITES
This is the start compisites data section.
static StringSTART_FONT_METRICS
This is the constant used in the AFM file to start a font metrics item.
static StringSTART_KERN_DATA
This is the start of kern data.
static StringSTART_KERN_PAIRS
This is the start of kern pairs data.
static StringSTART_KERN_PAIRS0
This is the start of kern pairs data.
static StringSTART_KERN_PAIRS1
This is the start of kern pairs data.
static StringSTART_TRACK_KERN
This is the start of track kern data.
static StringSTD_HW
The character metrics value.
static StringSTD_VW
The character metrics value.
static StringUNDERLINE_POSITION
The underline position.
static StringUNDERLINE_THICKNESS
This is the Underline thickness.
static StringVERSION
This is the version of the font.
static StringV_VECTOR
This is the V Vector attribute.
static StringWEIGHT
This is the weight.
static StringX_HEIGHT
This is the X height.
Constructor Summary
AFMParser(InputStream in)
Constructor.
Method Summary
FontMetricgetResult()
This will get the result of the parsing.
static voidmain(String[] args)
A method to test parsing of all AFM documents in the resources directory.
voidparse()
This will parse the AFM document.

Field Detail

ASCENDER

public static final String ASCENDER
This is ascender attribute.

CAP_HEIGHT

public static final String CAP_HEIGHT
This is the cap height attribute.

CC

public static final String CC
This is a composite character.

CHARACTERS

public static final String CHARACTERS
This is the characters attribute.

CHARACTER_SET

public static final String CHARACTER_SET
This is the character set.

CHARMETRICS_B

public static final String CHARMETRICS_B
The character metrics value.

CHARMETRICS_C

public static final String CHARMETRICS_C
The character metrics c value.

CHARMETRICS_CH

public static final String CHARMETRICS_CH
The character metrics c value.

CHARMETRICS_L

public static final String CHARMETRICS_L
The character metrics value.

CHARMETRICS_N

public static final String CHARMETRICS_N
The character metrics value.

CHARMETRICS_VV

public static final String CHARMETRICS_VV
The character metrics value.

CHARMETRICS_W

public static final String CHARMETRICS_W
The character metrics value.

CHARMETRICS_W0

public static final String CHARMETRICS_W0
The character metrics value.

CHARMETRICS_W0X

public static final String CHARMETRICS_W0X
The character metrics value.

CHARMETRICS_W0Y

public static final String CHARMETRICS_W0Y
The character metrics value.

CHARMETRICS_W1

public static final String CHARMETRICS_W1
The character metrics value.

CHARMETRICS_W1X

public static final String CHARMETRICS_W1X
The character metrics value.

CHARMETRICS_W1Y

public static final String CHARMETRICS_W1Y
The character metrics value.

CHARMETRICS_WX

public static final String CHARMETRICS_WX
The character metrics value.

CHARMETRICS_WY

public static final String CHARMETRICS_WY
The character metrics value.

CHAR_WIDTH

public static final String CHAR_WIDTH
This is the char width.

COMMENT

public static final String COMMENT
This is a comment in a AFM file.

DESCENDER

public static final String DESCENDER
This is the descender attribute.

ENCODING_SCHEME

public static final String ENCODING_SCHEME
This is the encoding scheme.

END_CHAR_METRICS

public static final String END_CHAR_METRICS
This is the end of character metrics.

END_COMPOSITES

public static final String END_COMPOSITES
This is the end compisites data section.

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.

END_KERN_DATA

public static final String END_KERN_DATA
This is the end of kern data.

END_KERN_PAIRS

public static final String END_KERN_PAIRS
This is the end of kern pairs data.

END_TRACK_KERN

public static final String END_TRACK_KERN
This is the end of track kern data.

ESC_CHAR

public static final String ESC_CHAR
This is the escape character.

FAMILY_NAME

public static final String FAMILY_NAME
This is the Family name.

FONT_BBOX

public static final String FONT_BBOX
This is the font bounding box.

FONT_NAME

public static final String FONT_NAME
This is the font name.

FULL_NAME

public static final String FULL_NAME
This is the full name.

IS_BASE_FONT

public static final String IS_BASE_FONT
This will determine if this is a base font.

IS_FIXED_PITCH

public static final String IS_FIXED_PITCH
This will determine if this is fixed pitch.

IS_FIXED_V

public static final String IS_FIXED_V
This will tell if the V is fixed.

ITALIC_ANGLE

public static final String ITALIC_ANGLE
This is the italic angle.

KERN_PAIR_KP

public static final String KERN_PAIR_KP
This is a kern pair.

KERN_PAIR_KPH

public static final String KERN_PAIR_KPH
This is a kern pair.

KERN_PAIR_KPX

public static final String KERN_PAIR_KPX
This is a kern pair.

KERN_PAIR_KPY

public static final String KERN_PAIR_KPY
This is a kern pair.

MAPPING_SCHEME

public static final String MAPPING_SCHEME
This is the mapping scheme.

NOTICE

public static final String NOTICE
This is the notice.

PCC

public static final String PCC
This is a composite charater part.

START_CHAR_METRICS

public static final String START_CHAR_METRICS
This is the start of character metrics.

START_COMPOSITES

public static final String START_COMPOSITES
This is the start compisites data section.

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.

START_KERN_DATA

public static final String START_KERN_DATA
This is the start of kern data.

START_KERN_PAIRS

public static final String START_KERN_PAIRS
This is the start of kern pairs data.

START_KERN_PAIRS0

public static final String START_KERN_PAIRS0
This is the start of kern pairs data.

START_KERN_PAIRS1

public static final String START_KERN_PAIRS1
This is the start of kern pairs data.

START_TRACK_KERN

public static final String START_TRACK_KERN
This is the start of track kern data.

STD_HW

public static final String STD_HW
The character metrics value.

STD_VW

public static final String STD_VW
The character metrics value.

UNDERLINE_POSITION

public static final String UNDERLINE_POSITION
The underline position.

UNDERLINE_THICKNESS

public static final String UNDERLINE_THICKNESS
This is the Underline thickness.

VERSION

public static final String VERSION
This is the version of the font.

V_VECTOR

public static final String V_VECTOR
This is the V Vector attribute.

WEIGHT

public static final String WEIGHT
This is the weight.

X_HEIGHT

public static final String X_HEIGHT
This is the X height.

Constructor Detail

AFMParser

public AFMParser(InputStream in)
Constructor.

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

Method Detail

getResult

public FontMetric getResult()
This will get the result of the parsing.

Returns: The parsed java object.

main

public static void main(String[] args)
A method to test parsing of all AFM documents in the resources directory.

Parameters: args Ignored.

Throws: IOException If there is an error parsing one of the documents.

parse

public void parse()
This will parse the AFM document. This will close the Input stream when the parsing is finished.

Throws: IOException If there is an IO error reading the document.

Copyright © 2008-2011 Apache Software Foundation. All Rights Reserved.