}
public void parse(InputStream stream, ContentHandler handler,
Metadata metadata, ParseContext context)
throws IOException, SAXException, TikaException {
FontMetric fontMetrics;
AFMParser parser = new AFMParser( stream );
// Have FontBox process the file
parser.parse();
fontMetrics = parser.getResult();
// Get the comments in the file to display in xhtml
List<String> comments = fontMetrics.getComments();
// Get the creation date
extractCreationDate( metadata, comments );
metadata.set( Metadata.CONTENT_TYPE, AFM_TYPE.toString() );
metadata.set( TikaCoreProperties.TITLE, fontMetrics.getFullName() );
// Add metadata associated with the font type
addMetadataByString( metadata, MET_AVG_CHAR_WIDTH, Float.toString( fontMetrics.getAverageCharacterWidth() ) );
addMetadataByString( metadata, MET_DOC_VERSION, Float.toString( fontMetrics.getAFMVersion() ) );
addMetadataByString( metadata, MET_FONT_NAME, fontMetrics.getFontName() );
addMetadataByString( metadata, MET_FONT_FULL_NAME, fontMetrics.getFullName() );
addMetadataByString( metadata, MET_FONT_FAMILY_NAME, fontMetrics.getFamilyName() );
addMetadataByString( metadata, MET_FONT_VERSION, fontMetrics.getFontVersion() );
addMetadataByString( metadata, MET_FONT_WEIGHT, fontMetrics.getWeight() );
addMetadataByString( metadata, MET_FONT_NOTICE, fontMetrics.getNotice() );
addMetadataByString( metadata, MET_FONT_UNDERLINE_THICKNESS, Float.toString( fontMetrics.getUnderlineThickness() ) );
// Output the remaining comments as text
XHTMLContentHandler xhtml = new XHTMLContentHandler( handler, metadata );
xhtml.startDocument();