aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-07-17 17:41:27 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-07-17 17:41:27 +0000
commitd31eccba74b58470778230167deb633083694fbf (patch)
tree400394e02af54cede85a1411b2d130b3ffc9aa69 /src/java/org
parent97f3728a5c3c860f38217cc3e09a5cf30095fcf8 (diff)
downloadxmlgraphics-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.java11
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);
}