From e79feb700fcf7112e67f511785487f91d7f13376 Mon Sep 17 00:00:00 2001 From: Mehdi Houshmand Date: Fri, 9 Nov 2012 09:16:13 +0000 Subject: [PATCH] Bugzilla#54120: Prevented NPEs when FOP asks Batik for AWT fonts for AFP output git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1407393 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/svg/AbstractFOPTextPainter.java | 5 ++++- status.xml | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java b/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java index 49f5a1b75..c41271caa 100644 --- a/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java +++ b/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java @@ -336,7 +336,7 @@ public abstract class AbstractFOPTextPainter implements TextPainter { private Font getFont(AttributedCharacterIterator aci) { Font[] fonts = ACIUtils.findFontsForBatikACI(aci, nativeTextHandler.getFontInfo()); - return fonts[0]; + return fonts == null ? null : fonts[0]; } private float getStringWidth(String str, Font font) { @@ -360,6 +360,9 @@ public abstract class AbstractFOPTextPainter implements TextPainter { } private boolean hasUnsupportedGlyphs(String str, Font font) { + if (font == null) { + return true; + } for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (!((c == ' ') || (c == '\n') || (c == '\r') || (c == '\t'))) { diff --git a/status.xml b/status.xml index bcf8c2475..990a15f5e 100644 --- a/status.xml +++ b/status.xml @@ -59,6 +59,10 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Created a simple mechanism to avoid NPEs when AWT fonts are requested from Batik + for AFP output. + PDF accessibility: properly tag hyphenated words. -- 2.39.5