From ced8c4f0eeb7f8ad4517c6e96ffddc432851f23a Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Wed, 10 Feb 2010 09:31:42 +0000 Subject: [PATCH] Better error message if a font is missing when generating PS from IF. Tie font configuration into -ifin parameter on the command-line. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@908410 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/cli/IFInputHandler.java | 4 ++-- src/java/org/apache/fop/render/ps/PSPainter.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/fop/cli/IFInputHandler.java b/src/java/org/apache/fop/cli/IFInputHandler.java index 4a67f522f..6b4031a27 100644 --- a/src/java/org/apache/fop/cli/IFInputHandler.java +++ b/src/java/org/apache/fop/cli/IFInputHandler.java @@ -29,10 +29,10 @@ import javax.xml.transform.stream.StreamResult; import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.fonts.FontInfo; import org.apache.fop.render.intermediate.IFDocumentHandler; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFParser; +import org.apache.fop.render.intermediate.IFUtil; /** * InputHandler for the intermediate format XML as input. @@ -66,7 +66,7 @@ public class IFInputHandler extends InputHandler { userAgent, outputFormat); try { documentHandler.setResult(new StreamResult(out)); - documentHandler.setDefaultFontInfo(new FontInfo()); + IFUtil.setupFonts(documentHandler); //Create IF parser IFParser parser = new IFParser(); diff --git a/src/java/org/apache/fop/render/ps/PSPainter.java b/src/java/org/apache/fop/render/ps/PSPainter.java index 051013a63..38b76fd8a 100644 --- a/src/java/org/apache/fop/render/ps/PSPainter.java +++ b/src/java/org/apache/fop/render/ps/PSPainter.java @@ -349,6 +349,9 @@ public class PSPainter extends AbstractIFPainter { //TODO Ignored: state.getFontVariant() //TODO Opportunity for font caching if font state is more heavily used String fontKey = getFontInfo().getInternalFontKey(triplet); + if (fontKey == null) { + throw new IFException("Font not available: " + triplet, null); + } int sizeMillipoints = state.getFontSize(); // This assumes that *all* CIDFonts use a /ToUnicode mapping -- 2.39.5