You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/02/19 16:43:32 UTC

svn commit: r629129 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java

Author: jeremias
Date: Tue Feb 19 07:43:31 2008
New Revision: 629129

URL: http://svn.apache.org/viewvc?rev=629129&view=rev
Log:
Fixed NPE when no AFM is available and the PFM didn't provide a xHeight.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java?rev=629129&r1=629128&r2=629129&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java Tue Feb 19 07:43:31 2008
@@ -216,11 +216,13 @@
         //(the following are all optional in AFM, but FontBBox is always available)
         if (returnFont.getXHeight(1) == 0) {
             int xHeight = 0;
-            AFMCharMetrics chm = afm.getChar("x");
-            if (chm != null) {
-                RectangularShape rect = chm.getBBox();
-                if (rect != null) {
-                    xHeight = (int)Math.round(rect.getMinX());
+            if (afm != null) {
+                AFMCharMetrics chm = afm.getChar("x");
+                if (chm != null) {
+                    RectangularShape rect = chm.getBBox();
+                    if (rect != null) {
+                        xHeight = (int)Math.round(rect.getMinX());
+                    }
                 }
             }
             if (xHeight == 0) {
@@ -230,11 +232,13 @@
         }
         if (returnFont.getAscender() == 0) {
             int asc = 0;
-            AFMCharMetrics chm = afm.getChar("d");
-            if (chm != null) {
-                RectangularShape rect = chm.getBBox();
-                if (rect != null) {
-                    asc = (int)Math.round(rect.getMinX());
+            if (afm != null) {
+                AFMCharMetrics chm = afm.getChar("d");
+                if (chm != null) {
+                    RectangularShape rect = chm.getBBox();
+                    if (rect != null) {
+                        asc = (int)Math.round(rect.getMinX());
+                    }
                 }
             }
             if (asc == 0) {
@@ -244,11 +248,13 @@
         }
         if (returnFont.getDescender() == 0) {
             int desc = 0;
-            AFMCharMetrics chm = afm.getChar("p");
-            if (chm != null) {
-                RectangularShape rect = chm.getBBox();
-                if (rect != null) {
-                    desc = (int)Math.round(rect.getMinX());
+            if (afm != null) {
+                AFMCharMetrics chm = afm.getChar("p");
+                if (chm != null) {
+                    RectangularShape rect = chm.getBBox();
+                    if (rect != null) {
+                        desc = (int)Math.round(rect.getMinX());
+                    }
                 }
             }
             if (desc == 0) {



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org