From: Adrian Cumiskey Date: Thu, 17 Jul 2008 17:41:27 +0000 (+0000) Subject: An optimization and improved readability of fontLookup() call. X-Git-Tag: fop-1_0~493 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d31eccba74b58470778230167deb633083694fbf;p=xmlgraphics-fop.git 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 --- 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); }