}
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, "AvgCharacterWidth", Float.toString( fontMetrics.getAverageCharacterWidth() ) );
addMetadataByString( metadata, "DocVersion", Float.toString( fontMetrics.getAFMVersion() ) );
addMetadataByString( metadata, "FontName", fontMetrics.getFontName() );
addMetadataByString( metadata, "FontFullName", fontMetrics.getFullName() );
addMetadataByString( metadata, "FontFamilyName", fontMetrics.getFamilyName() );
addMetadataByString( metadata, "FontVersion", fontMetrics.getFontVersion() );
addMetadataByString( metadata, "FontWeight", fontMetrics.getWeight() );
addMetadataByString( metadata, "FontNotice", fontMetrics.getNotice() );
addMetadataByString( metadata, "FontUnderlineThickness", Float.toString( fontMetrics.getUnderlineThickness() ) );
// Output the remaining comments as text
XHTMLContentHandler xhtml = new XHTMLContentHandler( handler, metadata );
xhtml.startDocument();