aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-02-19 15:43:31 +0000
committerJeremias Maerki <jeremias@apache.org>2008-02-19 15:43:31 +0000
commite4cc262c1fac77fc38286b412b6293f1f1767ec8 (patch)
treeb85073061fff786aec278a84da8e9ea0d1666d3d
parent5b06b2c75f10e0be591f878b1d7a533a9b826f7c (diff)
downloadxmlgraphics-fop-e4cc262c1fac77fc38286b412b6293f1f1767ec8.tar.gz
xmlgraphics-fop-e4cc262c1fac77fc38286b412b6293f1f1767ec8.zip
Fixed NPE when no AFM is available and the PFM didn't provide a xHeight.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@629129 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/fonts/type1/Type1FontLoader.java36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java b/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
index 009a446f9..910ee82cc 100644
--- a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
+++ b/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java
@@ -216,11 +216,13 @@ public class Type1FontLoader extends FontLoader {
//(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 @@ public class Type1FontLoader extends FontLoader {
}
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 @@ public class Type1FontLoader extends FontLoader {
}
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) {