From 6e5e209265c556ab3c12262f4eb5f8071f74dd7b Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 3 Aug 2009 07:25:00 +0000 Subject: [PATCH] Fixed problem with raster font substitution when there's no smaller font available. This avoids an exception. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@800229 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/afp/fonts/RasterFont.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/fop/afp/fonts/RasterFont.java b/src/java/org/apache/fop/afp/fonts/RasterFont.java index eaac7d6df..115773214 100644 --- a/src/java/org/apache/fop/afp/fonts/RasterFont.java +++ b/src/java/org/apache/fop/afp/fonts/RasterFont.java @@ -99,9 +99,13 @@ public class RasterFont extends AFPFont { int largerSize = largerSizes.isEmpty() ? Integer.MAX_VALUE : ((Integer)largerSizes.firstKey()).intValue(); - Integer fontSize - = (size - smallerSize) <= (largerSize - size) - ? new Integer(smallerSize) : new Integer(largerSize); + Integer fontSize; + if (!smallerSizes.isEmpty() + && (size - smallerSize) <= (largerSize - size)) { + fontSize = new Integer(smallerSize); + } else { + fontSize = new Integer(largerSize); + } csm = (CharacterSet) charSets.get(fontSize); if (csm != null) { -- 2.39.5