From d31eccba74b58470778230167deb633083694fbf Mon Sep 17 00:00:00 2001 From: Adrian Cumiskey Date: Thu, 17 Jul 2008 17:41:27 +0000 Subject: [PATCH] An optimization and improved readability of fontLookup() call. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@677650 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fonts/FontInfo.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/fop/fonts/FontInfo.java b/src/java/org/apache/fop/fonts/FontInfo.java index 4e327c782..8e915588f 100644 --- a/src/java/org/apache/fop/fonts/FontInfo.java +++ b/src/java/org/apache/fop/fonts/FontInfo.java @@ -219,7 +219,7 @@ public class FontInfo { private FontTriplet fuzzyFontLookup(String family, String style, int weight, FontTriplet startKey, boolean substFont) { FontTriplet key; - String internalFontKey; + String internalFontKey = null; if (!family.equals(startKey.getName())) { key = createFontKey(family, style, weight); internalFontKey = getInternalFontKey(key); @@ -230,8 +230,10 @@ public class FontInfo { // adjust weight, favouring normal or bold key = findAdjustWeight(family, style, weight); - internalFontKey = getInternalFontKey(key); - + if (key != null) { + internalFontKey = getInternalFontKey(key); + } + if (!substFont && internalFontKey == null) { return null; } @@ -364,7 +366,8 @@ public class FontInfo { FontTriplet triplet; List tmpTriplets = new java.util.ArrayList(); for (int i = 0, c = families.length; i < c; i++) { - triplet = fontLookup(families[i], style, weight, (i >= families.length - 1)); + boolean substitutable = (i >= families.length - 1); + triplet = fontLookup(families[i], style, weight, substitutable); if (triplet != null) { tmpTriplets.add(triplet); } -- 2.39.5