From 4479bd983006197215e8ca8264f7b7fa9d507535 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 17 May 2010 11:41:33 +0000 Subject: [PATCH] Don't fail on AFM just because it has a Start/EndTrackKern section. Log a warning instead of throwing an exception when an unimplemented feature is found. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@945098 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fonts/type1/AFMParser.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/fop/fonts/type1/AFMParser.java b/src/java/org/apache/fop/fonts/type1/AFMParser.java index 0479c57a7..0a035238a 100644 --- a/src/java/org/apache/fop/fonts/type1/AFMParser.java +++ b/src/java/org/apache/fop/fonts/type1/AFMParser.java @@ -30,6 +30,8 @@ import java.util.Map; import java.util.Stack; import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.fop.fonts.NamedCharacter; @@ -38,6 +40,8 @@ import org.apache.fop.fonts.NamedCharacter; */ public class AFMParser { + private static Log log = LogFactory.getLog(AFMParser.class); + private static final String START_FONT_METRICS = "StartFontMetrics"; //private static final String END_FONT_METRICS = "EndFontMetrics"; private static final String FONT_NAME = "FontName"; @@ -82,6 +86,9 @@ public class AFMParser { //private static final String START_KERN_PAIRS0 = "StartKernPairs0"; private static final String START_KERN_PAIRS1 = "StartKernPairs1"; //private static final String END_KERN_PAIRS = "EndKernPairs"; + private static final String START_COMPOSITES = "StartComposites"; + private static final String START_COMP_FONT_METRICS = "StartCompFontMetrics"; + private static final String KP = "KP"; private static final String KPH = "KPH"; private static final String KPX = "KPX"; @@ -131,8 +138,9 @@ public class AFMParser { VALUE_PARSERS.put(N, new NamedCharacterSetter("Character")); VALUE_PARSERS.put(B, new CharBBox()); VALUE_PARSERS.put(START_TRACK_KERN, new NotImplementedYet(START_TRACK_KERN)); - VALUE_PARSERS.put(END_TRACK_KERN, new NotImplementedYet(END_TRACK_KERN)); VALUE_PARSERS.put(START_KERN_PAIRS1, new NotImplementedYet(START_KERN_PAIRS1)); + VALUE_PARSERS.put(START_COMPOSITES, new NotImplementedYet(START_COMPOSITES)); + VALUE_PARSERS.put(START_COMP_FONT_METRICS, new NotImplementedYet(START_COMP_FONT_METRICS)); VALUE_PARSERS.put(KP, new NotImplementedYet(KP)); VALUE_PARSERS.put(KPH, new NotImplementedYet(KPH)); VALUE_PARSERS.put(KPX, new KPXHandler()); @@ -578,8 +586,8 @@ public class AFMParser { } public void parse(String line, int startpos, Stack stack) throws IOException { - throw new IOException("Support for '" + key - + "' has not been implemented, yet! Font is not supported."); + log.warn("Support for '" + key + "' has not been implemented, yet!" + + " Some font data in the AFM file will be ignored."); } } -- 2.39.5