You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/07/17 19:41:27 UTC

svn commit: r677650 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java

Author: acumiskey
Date: Thu Jul 17 10:41:27 2008
New Revision: 677650

URL: http://svn.apache.org/viewvc?rev=677650&view=rev
Log:
An optimization and improved readability of fontLookup() call.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java?rev=677650&r1=677649&r2=677650&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontInfo.java Thu Jul 17 10:41:27 2008
@@ -219,7 +219,7 @@
     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 @@
 
         // 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 @@
         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);
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org