Author: mehdi
Date: Fri Nov  9 09:16:13 2012
New Revision: 1407393

URL: http://svn.apache.org/viewvc?rev=1407393&view=rev
Log:
Bugzilla#54120: Prevented NPEs when FOP asks Batik for AWT fonts for AFP output

Modified:
    
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java
    xmlgraphics/fop/trunk/status.xml

Modified: 
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java?rev=1407393&r1=1407392&r2=1407393&view=diff
==============================================================================
--- 
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java 
(original)
+++ 
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTextPainter.java 
Fri Nov  9 09:16:13 2012
@@ -336,7 +336,7 @@ public abstract class AbstractFOPTextPai
 
     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 AbstractFOPTextPai
     }
 
     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'))) {

Modified: xmlgraphics/fop/trunk/status.xml
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1407393&r1=1407392&r2=1407393&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Fri Nov  9 09:16:13 2012
@@ -59,6 +59,10 @@
       documents. Example: the fix of marks layering will be such a case when 
it's done.
     -->
     <release version="FOP Trunk" date="TBD">
+      <action context="Fonts" dev="MH" type="add" fixes-bug="54120">
+        Created a simple mechanism to avoid NPEs when AWT fonts are requested 
from Batik
+        for AFP output.
+      </action>
       <action context="Renderers" dev="VH" type="add" fixes-bug="54081">
         PDF accessibility: properly tag hyphenated words.
       </action>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to