diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2008-07-17 17:41:27 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2008-07-17 17:41:27 +0000 |
commit | d31eccba74b58470778230167deb633083694fbf (patch) | |
tree | 400394e02af54cede85a1411b2d130b3ffc9aa69 /src/java/org | |
parent | 97f3728a5c3c860f38217cc3e09a5cf30095fcf8 (diff) | |
download | xmlgraphics-fop-d31eccba74b58470778230167deb633083694fbf.tar.gz xmlgraphics-fop-d31eccba74b58470778230167deb633083694fbf.zip |
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
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/fop/fonts/FontInfo.java | 11 |
1 files 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); } |