From: Tore Engvig Date: Wed, 6 Jun 2001 20:13:21 +0000 (+0000) Subject: Some fonts contains malformed composite glyphs which used to make fop crash. This... X-Git-Tag: PRE_CODEFORMATTING~103 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b68fb9a202870ee128ee1d9948af055f543ca4fe;p=xmlgraphics-fop.git Some fonts contains malformed composite glyphs which used to make fop crash. This adds an errormessage and tries to embed the font without the composite glyph. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194276 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/fonts/TTFSubSetFile.java b/src/org/apache/fop/fonts/TTFSubSetFile.java index 7f349b4b8..d8f03af0b 100644 --- a/src/org/apache/fop/fonts/TTFSubSetFile.java +++ b/src/org/apache/fop/fonts/TTFSubSetFile.java @@ -462,6 +462,17 @@ public class TTFSubSetFile extends TTFFile { flags = in.readTTFUShort(offset); compositeIdx = new Integer(in.readTTFUShort(offset+2)); Integer newIdx = (Integer)glyphs.get(compositeIdx); + if (newIdx == null) { + // This errormessage would look much better + // if the fontname was printed to + MessageHandler.error("An embedded font " + + "contains bad glyph data. " + + "Characters might not display " + + "correctly."); + moreComposites = false; + continue; + } + in.writeTTFUShort(offset+2, newIdx.intValue()); offset+=4;