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/05/12 10:58:23 UTC

svn commit: r655445 [2/4] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./ src/codegen/fonts/ src/java/org/apache/fop/apps/ src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/properties/ src/java/org/apache/fop/fonts/ src/java/org/apache/fo...

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontInfo.java Mon May 12 01:58:21 2008
@@ -39,34 +39,34 @@
  * implemented.
  */
 public class FontInfo {
-    
+
     private static final FontTriplet[] TRIPLETS_TYPE = new FontTriplet[1];
-    
+
     /** logging instance */
     protected static Log log = LogFactory.getLog(FontInfo.class);
 
     /** Map containing fonts that have been used */
     private Map/*<String,FontMetrics>*/ usedFonts = null; //(String = font key)
-    
+
     /** look up a font-triplet to find a font-name */
     private Map/*<FontTriplet,String>*/ triplets = null; //(String = font key)
-    
+
     /** look up a font-triplet to find its priority
      *  (only used inside addFontProperties()) */
     private Map/*<FontTriplet,Integer>*/ tripletPriorities = null; //Map<FontTriplet,Integer>
 
     /** look up a font-name to get a font (that implements FontMetrics at least) */
     private Map/*<String,FontMetrics>*/ fonts = null; //(String = font key)
-    
+
     /** 
-     *  a collection of missing fonts; used to make sure the user gets 
+     *  a collection of missing fonts; used to make sure the user gets
      *  a warning for a missing font only once (not every time the font is used)
      */
     private Set/*<FontTriplet>*/ loggedFontKeys = null;
 
     /** Cache for Font instances. */
     private Map/*<FontTriplet, Map>*/ fontInstanceCache = null;
-    
+
     /** Event listener for font events */
     private FontEventListener eventListener = null;
 
@@ -79,7 +79,7 @@
         this.fonts = new java.util.HashMap/*<String, FontMetrics>*/();
         this.usedFonts = new java.util.HashMap/*<String,FontMetrics>*/();
     }
-    
+
     /**
      * Sets the font event listener that can be used to receive events about particular events
      * in this class.
@@ -88,9 +88,9 @@
     public void setEventListener(FontEventListener listener) {
         this.eventListener = listener;
     }
-    
+
     /**
-     * Checks if the font setup is valid (At least the ultimate fallback font 
+     * Checks if the font setup is valid (At least the ultimate fallback font
      * must be registered.)
      * @return True if valid
      */
@@ -188,7 +188,7 @@
      * @param family font family
      * @param style font style
      * @param weight font weight
-     * @param substFont true if the font may be substituted with the 
+     * @param substFont true if the font may be substituted with the
      *                  default font if not found
      * @return internal font triplet key
      */
@@ -196,8 +196,8 @@
                              int weight, boolean substFont) {
         if (log.isTraceEnabled()) {
             log.trace("Font lookup: " + family + " " + style + " " + weight);
-        }        
-        
+        }
+
         FontTriplet startKey = createFontKey(family, style, weight);
         FontTriplet fontTriplet = startKey;
         // first try given parameters
@@ -227,7 +227,7 @@
                 return key;
             }
         }
-        
+
         // adjust weight, favouring normal or bold
         key = findAdjustWeight(family, style, weight);
         internalFontKey = getInternalFontKey(key);
@@ -235,7 +235,7 @@
         if (!substFont && internalFontKey == null) {
             return null;
         }
-        
+
         // only if the font may be substituted
         // fallback 1: try the same font-family and weight with default style
         if (internalFontKey == null && style != Font.STYLE_NORMAL) {
@@ -260,14 +260,14 @@
                 }
             }
         }
-        
+
         // fallback 2: try the same font-family with default style and weight
         /* obsolete: replaced by the loop above
         if (f == null) {
             key = createFontKey(family, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
             f = getInternalFontKey(key);
         }*/
-        
+
         // fallback 3: try any family with orig style/weight
         if (internalFontKey == null) {
             return fuzzyFontLookup("any", style, weight, startKey, false);
@@ -285,7 +285,7 @@
             return null;
         }
     }
-    
+
     /**
      * Tells this class that the font with the given internal name has been used.
      * @param internalName the internal font name (F1, F2 etc.)
@@ -293,7 +293,7 @@
     public void useFont(String internalName) {
         usedFonts.put(internalName, fonts.get(internalName));
     }
-    
+
     private Map/*<FontTriplet,Map<Integer,Font>>*/ getFontInstanceCache() {
         if (fontInstanceCache == null) {
             fontInstanceCache = new java.util.HashMap/*<FontTriplet, Map<Integer,Font>>*/();
@@ -302,7 +302,7 @@
     }
 
     /**
-     * Retrieves a (possibly cached) Font instance based on a FontTriplet and a font size. 
+     * Retrieves a (possibly cached) Font instance based on a FontTriplet and a font size.
      * @param triplet the font triplet designating the requested font
      * @param fontSize the font size
      * @return the requested Font instance
@@ -325,7 +325,7 @@
         }
         return font;
     }
-    
+
     /**
      * Lookup a font.
      * <br>
@@ -342,7 +342,7 @@
                              int weight) {
         return fontLookup(family, style, weight, true);
     }
-    
+
     /**
      * Looks up a set of fonts.
      * <br>
@@ -383,14 +383,14 @@
                     "fontLookup must return an array with at least one "
                     + "FontTriplet on the last call. Lookup: " + sb.toString());
     }
-    
+
     private Set/*<FontTriplet>*/ getLoggedFontKeys() {
         if (loggedFontKeys == null) {
             loggedFontKeys = new java.util.HashSet/*<FontTriplet>*/();
         }
         return loggedFontKeys;
     }
-    
+
     private void notifyFontReplacement(FontTriplet replacedKey, FontTriplet newKey) {
         if (!getLoggedFontKeys().contains(replacedKey)) {
             getLoggedFontKeys().add(replacedKey);
@@ -402,7 +402,7 @@
             }
         }
     }
-    
+
     /**
      * Find a font with a given family and style by trying
      * different font weights according to the spec.
@@ -476,7 +476,7 @@
     public String getInternalFontKey(FontTriplet triplet) {
         return (String)triplets.get(triplet);
     }
-    
+
     /**
      * Creates a key from the given strings.
      * @param family font family
@@ -504,7 +504,7 @@
     public Map/*<FontTriplet,String>*/ getFontTriplets() {
         return this.triplets;
     }
-    
+
     /**
      * This is used by the renderers to retrieve all the
      * fonts used in the document.
@@ -541,7 +541,7 @@
         }
         return foundTriplets;
     }
-    
+
     /**
      * Returns the first triplet matching the given font name.
      * As there may be multiple triplets matching the font name
@@ -557,7 +557,7 @@
         }
         return null;
     }
-    
+
     /**
      * Returns the font style for a particular font.
      * There may be multiple font styles matching this font. Only the first
@@ -574,7 +574,7 @@
             return "";
         }
     }
-    
+
     /**
      * Returns the font weight for a particular font.
      * There may be multiple font weights matching this font. Only the first
@@ -591,14 +591,14 @@
             return 0;
         }
     }
-    
+
     /**
-     * Diagnostic method for logging all registered fonts to System.out. 
+     * Diagnostic method for logging all registered fonts to System.out.
      */
     public void dumpAllTripletsToSystemOut() {
         System.out.print(toString());
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -608,7 +608,7 @@
         while (iter.hasNext()) {
             FontTriplet triplet = (FontTriplet)iter.next();
             String key = getInternalFontKey(triplet);
-            FontMetrics metrics = getMetricsFor(key); 
+            FontMetrics metrics = getMetricsFor(key);
             entries.add(triplet.toString() + " -> " + key + " -> " + metrics.getFontName() + "\n");
         }
         StringBuffer stringBuffer = new StringBuffer();

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts;
 
@@ -29,7 +29,7 @@
 import org.apache.fop.fonts.substitute.FontSubstitutions;
 import org.apache.fop.render.PrintRenderer;
 
-// TODO: Refactor fonts package so major font activities (autodetection etc) 
+// TODO: Refactor fonts package so major font activities (autodetection etc)
 // are all centrally managed and delegated from this class, also remove dependency on FopFactory
 // and start using POJO config/properties type classes
 
@@ -62,7 +62,7 @@
     public FontManager() {
         setUseCache(DEFAULT_USE_CACHE);
     }
-    
+
     /**
      * Sets the font base URL.
      * @param fontBase font base URL
@@ -90,7 +90,7 @@
      * @param value true if kerning should be activated
      */
     public void setBase14KerningEnabled(boolean value) {
-        this.enableBase14Kerning = value;        
+        this.enableBase14Kerning = value;
     }
 
     /**
@@ -100,7 +100,7 @@
     public void setFontSubstitutions(FontSubstitutions substitutions) {
         this.fontSubstitutions = substitutions;
     }
-    
+
     /**
      * Returns the font substitution catalog
      * @return the font substitution catalog
@@ -142,7 +142,7 @@
     public FontCache getFontCache() {
         return this.fontCache;
     }
-    
+
     /**
      * Sets up the fonts on a given PrintRenderer
      * @param renderer a print renderer
@@ -151,7 +151,7 @@
         FontInfo fontInfo = renderer.getFontInfo();
 
         int startNum = 1;
-        
+
         // Configure base 14 fonts
         org.apache.fop.fonts.base14.Base14FontCollection base14FontCollection
             = new org.apache.fop.fonts.base14.Base14FontCollection(this.enableBase14Kerning);
@@ -161,7 +161,7 @@
         org.apache.fop.fonts.CustomFontCollection customFontCollection
             = new org.apache.fop.fonts.CustomFontCollection(renderer);
         startNum = customFontCollection.setup(startNum, fontInfo);
-                
+
         // Make any defined substitutions in the font info
         getFontSubstitutions().adjustFontInfo(fontInfo);
     }
@@ -179,7 +179,7 @@
         // setup base 14 fonts
         org.apache.fop.render.java2d.Base14FontCollection base14FontCollection
             = new org.apache.fop.render.java2d.Base14FontCollection(graphics2D);
-        
+
         // setup any custom font collection
         startNum = base14FontCollection.setup(startNum, fontInfo);
 
@@ -194,7 +194,7 @@
         startNum = configuredFontCollection.setup(startNum, fontInfo);
 
         // Make any defined substitutions in the font info
-        getFontSubstitutions().adjustFontInfo(fontInfo);        
+        getFontSubstitutions().adjustFontInfo(fontInfo);
     }
 
     /** @return a new FontResolver to be used by the font subsystem */

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManagerConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManagerConfigurator.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManagerConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManagerConfigurator.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts;
 
@@ -37,12 +37,12 @@
  * Configurator of the FontManager
  */
 public class FontManagerConfigurator {
-    
+
     /** logger instance */
     private static Log log = LogFactory.getLog(FontManagerConfigurator.class);
 
     private Configuration cfg;
-    
+
     /**
      * Main constructor
      * @param cfg the font manager configuration object
@@ -58,7 +58,7 @@
      * @throws FOPException if an exception occurs while processing the configuration
      */
     public void configure(FontManager fontManager, boolean strict) throws FOPException {
-        
+
         // caching (fonts)
         if (cfg.getChild("use-cache", false) != null) {
             try {
@@ -84,12 +84,12 @@
             Configuration substitutionsCfg = fontsCfg.getChild("substitutions", false);
             if (substitutionsCfg != null) {
                 FontSubstitutionsConfigurator fontSubstitutionsConfigurator
-                    = new FontSubstitutionsConfigurator(substitutionsCfg);
+                        = new FontSubstitutionsConfigurator(substitutionsCfg);
                 FontSubstitutions substitutions = new FontSubstitutions();
                 fontSubstitutionsConfigurator.configure(substitutions);
                 fontManager.setFontSubstitutions(substitutions);
             }
-            
+
             // referenced fonts (fonts which are not to be embedded)
             Configuration referencedFontsCfg = fontsCfg.getChild("referenced-fonts", false);
             if (referencedFontsCfg != null) {
@@ -121,11 +121,11 @@
     private static class OrFontTripletMatcher implements FontTriplet.Matcher {
 
         private FontTriplet.Matcher[] matchers;
-        
+
         public OrFontTripletMatcher(FontTriplet.Matcher[] matchers) {
             this.matchers = matchers;
         }
-        
+
         /** {@inheritDoc} */
         public boolean matches(FontTriplet triplet) {
             for (int i = 0, c = matchers.length; i < c; i++) {
@@ -135,22 +135,22 @@
             }
             return false;
         }
-        
+
     }
-    
+
     private static class FontFamilyRegExFontTripletMatcher implements FontTriplet.Matcher {
 
         private Pattern regex;
-        
+
         public FontFamilyRegExFontTripletMatcher(String regex) {
             this.regex = Pattern.compile(regex);
         }
-        
+
         /** {@inheritDoc} */
         public boolean matches(FontTriplet triplet) {
             return regex.matcher(triplet.getName()).matches();
         }
-        
+
     }
-    
+
 }

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManagerConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontManagerConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontSetup.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontSetup.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontSetup.java Mon May 12 01:58:21 2008
@@ -182,7 +182,7 @@
 
         // All base 14 configured now, so any custom embedded fonts start from 15
         final int startNum = 15;
-        
+
         /* Add configured fonts */
         addConfiguredFonts(fontInfo, embedFontInfoList, startNum, resolver);
     }
@@ -204,7 +204,7 @@
             //Ensure that we have minimal font resolution capabilities
             resolver = createMinimalFontResolver1();
         }
-        
+
         String internalName = null;
 
         for (int i = 0; i < embedFontInfoList.size(); i++) {
@@ -212,7 +212,7 @@
 
             internalName = "F" + num;
             num++;
-            
+
             LazyFont font = new LazyFont(embedFontInfo, resolver);
             fontInfo.addMetrics(internalName, font);
 
@@ -234,5 +234,5 @@
                 return new StreamSource(href);
             }
         };
-    }       
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontTriplet.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontTriplet.java Mon May 12 01:58:21 2008
@@ -16,7 +16,7 @@
  */
 
 /* $Id$ */
- 
+
 package org.apache.fop.fonts;
 
 import java.io.Serializable;
@@ -25,15 +25,15 @@
  * FontTriplet contains information on name, style and weight of one font
  */
 public class FontTriplet implements Comparable, Serializable {
-    
+
     /** serial version UID */
     private static final long serialVersionUID = 1168991106658033508L;
-    
+
     private String name;
     private String style;
     private int weight;
     private int priority; // priority of this triplet/font mapping
-    
+
     //This is only a cache
     private transient String key;
 
@@ -78,7 +78,7 @@
     public String getStyle() {
         return style;
     }
-    
+
     /** @return the font weight */
     public int getWeight() {
         return weight;
@@ -96,7 +96,7 @@
         }
         return this.key;
     }
-    
+
     /** {@inheritDoc} */
     public int compareTo(Object o) {
         return getKey().compareTo(((FontTriplet)o).getKey());
@@ -117,7 +117,7 @@
             if (obj instanceof FontTriplet) {
                 FontTriplet other = (FontTriplet)obj;
                 return (getName().equals(other.getName())
-                        && getStyle().equals(other.getStyle()) 
+                        && getStyle().equals(other.getStyle())
                         && (getWeight() == other.getWeight()));
             }
         }
@@ -128,13 +128,13 @@
     public String toString() {
         return getKey();
     }
-    
-    
+
+
     /**
      * Matcher interface for {@link FontTriplet}.
      */
     public interface Matcher {
-        
+
         /**
          * Indicates whether the given {@link FontTriplet} matches a particular criterium.
          * @param triplet the font triplet
@@ -142,6 +142,6 @@
          */
         boolean matches(FontTriplet triplet);
     }
-    
+
 }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontUtil.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/FontUtil.java Mon May 12 01:58:21 2008
@@ -16,7 +16,7 @@
  */
 
 /* $Id$ */
- 
+
 package org.apache.fop.fonts;
 
 /**
@@ -25,7 +25,7 @@
 public class FontUtil {
 
     /**
-     * Parses an CSS2 (SVG and XSL-FO) font weight (normal, bold, 100-900) to 
+     * Parses an CSS2 (SVG and XSL-FO) font weight (normal, bold, 100-900) to
      * an integer.
      * See http://www.w3.org/TR/REC-CSS2/fonts.html#propdef-font-weight
      * TODO: Implement "lighter" and "bolder".
@@ -47,7 +47,7 @@
                 weight = 700;
             } else {
                 throw new IllegalArgumentException(
-                    "Illegal value for font weight: '" 
+                    "Illegal value for font weight: '"
                     + text
                     + "'. Use one of: 100, 200, 300, "
                     + "400, 500, 600, 700, 800, 900, "
@@ -90,7 +90,7 @@
     /** font constituent names which identify a font as being of "bold" weight */
     private static final String[] BOLD_WORDS = {"bold"};
     /** font constituent names which identify a font as being of "extra bold" weight */
-    private static final String[] EXTRA_BOLD_WORDS = {"extrabold", "extra bold", "black", 
+    private static final String[] EXTRA_BOLD_WORDS = {"extrabold", "extra bold", "black",
         "heavy", "ultra", "super"};
 
     /**
@@ -102,7 +102,7 @@
         if (fontName != null) {
             for (int i = 0; i < ITALIC_WORDS.length; i++) {
                 if (fontName.indexOf(ITALIC_WORDS[i]) != -1) {
-                    return Font.STYLE_ITALIC;          
+                    return Font.STYLE_ITALIC;
                 }
             }
         }
@@ -117,18 +117,18 @@
     public static int guessWeight(String fontName) {
         // weight
         int weight = Font.WEIGHT_NORMAL;
-        
+
         for (int i = 0; i < BOLD_WORDS.length; i++) {
             if (fontName.indexOf(BOLD_WORDS[i]) != -1) {
                 weight = Font.WEIGHT_BOLD;
                 break;
-            }            
+            }
         }
         for (int i = 0; i < MEDIUM_WORDS.length; i++) {
             if (fontName.indexOf(MEDIUM_WORDS[i]) != -1) {
                 weight = Font.WEIGHT_NORMAL + 100; //500
                 break;
-            }            
+            }
         }
         //Search for "semi/demi" before "light", but after "bold"
         //(normally semi/demi-bold is meant, but it can also be semi/demi-light)
@@ -136,19 +136,19 @@
             if (fontName.indexOf(DEMI_WORDS[i]) != -1) {
                 weight = Font.WEIGHT_BOLD - 100; //600
                 break;
-            }            
+            }
         }
         for (int i = 0; i < EXTRA_BOLD_WORDS.length; i++) {
             if (fontName.indexOf(EXTRA_BOLD_WORDS[i]) != -1) {
                 weight = Font.WEIGHT_EXTRA_BOLD;
                 break;
-            }            
+            }
         }
         for (int i = 0; i < LIGHT_WORDS.length; i++) {
             if (fontName.indexOf(LIGHT_WORDS[i]) != -1) {
                 weight = Font.WEIGHT_LIGHT;
                 break;
-            }            
+            }
         }
         return weight;
     }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/MultiByteFont.java Mon May 12 01:58:21 2008
@@ -30,7 +30,7 @@
 
     private static int uniqueCounter = -1;
     private static final DecimalFormat COUNTER_FORMAT = new DecimalFormat("00000");
-
+    
     private String ttcName = null;
     private String encoding = "Identity-H";
 
@@ -158,7 +158,7 @@
      */
     private int findGlyphIndex(char c) {
         int idx = (int)c;
-        int retIdx = 0; //.notdef
+        int retIdx = SingleByteEncoding.NOT_FOUND_CODE_POINT;
 
         for (int i = 0; (i < bfentries.length) && retIdx == 0; i++) {
             if (bfentries[i].getUnicodeStart() <= idx
@@ -176,17 +176,19 @@
     public char mapChar(char c) {
         notifyMapOperation();
         int glyphIndex = findGlyphIndex(c);
-
+        if (glyphIndex == SingleByteEncoding.NOT_FOUND_CODE_POINT) {
+            warnMissingGlyph(c);
+            glyphIndex = findGlyphIndex(Typeface.NOT_FOUND);
+        }
         if (isEmbeddable()) {
             glyphIndex = subset.mapSubsetChar(glyphIndex, c);
         }
-
         return (char)glyphIndex;
     }
 
     /** {@inheritDoc} */
     public boolean hasChar(char c) {
-        return (findGlyphIndex(c) > 0);
+        return (findGlyphIndex(c) != SingleByteEncoding.NOT_FOUND_CODE_POINT);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/SingleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/SingleByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/SingleByteFont.java Mon May 12 01:58:21 2008
@@ -21,21 +21,15 @@
 
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.xmlgraphics.fonts.Glyphs;
-
 /**
  * Generic SingleByte font
  */
 public class SingleByteFont extends CustomFont {
 
-    /** Code point that is used if no code point for a specific character has been found. */
-    public static final char NOT_FOUND = '#';
-
     /** logger */
     private  static Log log = LogFactory.getLog(SingleByteFont.class);
 
@@ -43,8 +37,6 @@
 
     private int[] width = null;
 
-    private Set warnedChars;
-
     private Map unencodedCharacters;
     //Map<Character, UnencodedCharacter>
     private List additionalEncodings;
@@ -115,27 +107,8 @@
         if (d != SingleByteEncoding.NOT_FOUND_CODE_POINT) {
             return d;
         }
-        
-        //Give up, character is not available
-        Character ch = new Character(c);
-        if (warnedChars == null) {
-            warnedChars = new java.util.HashSet();
-        }
-        if (warnedChars.size() < 8 && !warnedChars.contains(ch)) {
-            warnedChars.add(ch);
-            if (this.eventListener != null) {
-                this.eventListener.glyphNotAvailable(this, c, getFontName());
-            } else {
-                if (warnedChars.size() == 8) {
-                    log.warn("Many requested glyphs are not available in font " + getFontName());
-                } else {
-                    log.warn("Glyph " + (int)c + " (0x" + Integer.toHexString(c) 
-                            + ", " + Glyphs.charToGlyphName(c)
-                            + ") not available in font " + getFontName());
-                }
-            }
-        }
-        return NOT_FOUND;
+        this.warnMissingGlyph(c);
+        return Typeface.NOT_FOUND;
     }
 
     private char mapUnencodedChar(char ch) {

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Typeface.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Typeface.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Typeface.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/Typeface.java Mon May 12 01:58:21 2008
@@ -19,20 +19,38 @@
  
 package org.apache.fop.fonts;
 
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.fonts.Glyphs;
+
 /**
  * Base class for font classes
  */
 public abstract class Typeface implements FontMetrics {
 
     /**
-     * Used to identify whether a font has been used (a character map operation is used as
-     * the trigger). This could just as well be a boolean but is a long out of statistical interest.
+     * Code point that is used if no code point for a specific character has
+     * been found.
+     */
+    public static final char NOT_FOUND = '#';
+
+    /** logger */
+    private static Log log = LogFactory.getLog(Typeface.class);
+
+    /**
+     * Used to identify whether a font has been used (a character map operation
+     * is used as the trigger). This could just as well be a boolean but is a
+     * long out of statistical interest.
      */
     private long charMapOps = 0;
     
     /** An optional event listener that receives events such as missing glyphs etc. */
     protected FontEventListener eventListener;
-    
+
+    private Set warnedChars;
+
     /**
      * Get the encoding of the font.
      * @return the encoding
@@ -92,5 +110,33 @@
         this.eventListener = listener;
     }
     
+    /**
+     * Provide proper warning if a glyph is not available.
+     * 
+     * @param c
+     *            the character which is missing.
+     */
+    protected void warnMissingGlyph(char c) {
+        // Give up, character is not available
+        Character ch = new Character(c);
+        if (warnedChars == null) {
+            warnedChars = new java.util.HashSet();
+        }
+        if (warnedChars.size() < 8 && !warnedChars.contains(ch)) {
+            warnedChars.add(ch);
+            if (this.eventListener != null) {
+                this.eventListener.glyphNotAvailable(this, c, getFontName());
+            } else {
+                if (warnedChars.size() == 8) {
+                    log.warn("Many requested glyphs are not available in font "
+                            + getFontName());
+                } else {
+                    log.warn("Glyph " + (int) c + " (0x"
+                            + Integer.toHexString(c) + ", "
+                            + Glyphs.charToGlyphName(c)
+                            + ") not available in font " + getFontName());
+                }
+            }
+        }
+    }
 }
-

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java Mon May 12 01:58:21 2008
@@ -44,22 +44,22 @@
 
     /** default depth limit of recursion when searching for font files **/
     public static final int DEFAULT_DEPTH_LIMIT = -1;
-    
+
     /**
-     * Default constructor 
+     * Default constructor
      */
     public FontFileFinder() {
         super(getDirectoryFilter(), getFileFilter(), DEFAULT_DEPTH_LIMIT);
     }
 
     /**
-     * Constructor 
+     * Constructor
      * @param depthLimit recursion depth limit
      */
     public FontFileFinder(int depthLimit) {
         super(getDirectoryFilter(), getFileFilter(), depthLimit);
     }
-    
+
     /**
      * Font directory filter.  Currently ignores hidden directories.
      * @return IOFileFilter font directory filter
@@ -70,7 +70,7 @@
                 FileFilterUtils.notFileFilter(FileFilterUtils.prefixFileFilter("."))
         );
     }
-    
+
     /**
      * Font file filter.  Currently searches for files with .ttf, .ttc, .otf, and .pfb extensions.
      * @return IOFileFilter font file filter
@@ -83,13 +83,13 @@
                         IOCase.INSENSITIVE)
         );
     }
-    
+
     /**
      * @param directory directory to handle
      * @param depth recursion depth
      * @param results collection
      * @return whether directory should be handled
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     protected boolean handleDirectory(File directory, int depth, Collection results) {
         return true;
@@ -99,7 +99,7 @@
      * @param file file to handle
      * @param depth recursion depth
      * @param results collection
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     protected void handleFile(File file, int depth, Collection results) {
         try {
@@ -109,7 +109,7 @@
             log.debug("MalformedURLException" + e.getMessage());
         }
     }
-      
+
     /**
      * @param directory the directory being processed
      * @param depth the current directory level
@@ -119,10 +119,10 @@
     protected void handleDirectoryEnd(File directory, int depth, Collection results) {
         if (log.isDebugEnabled()) {
             log.debug(directory + ": found " + results.size() + " font"
-                    + ((results.size() == 1) ? "" : "s"));        
+                    + ((results.size() == 1) ? "" : "s"));
         }
-    }    
-    
+    }
+
     /**
      * Automagically finds a list of font files on local system
      * 
@@ -162,5 +162,5 @@
         List results = new java.util.ArrayList();
         super.walk(new File(dir), results);
         return results;
-    }    
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java Mon May 12 01:58:21 2008
@@ -49,12 +49,12 @@
  * Attempts to determine correct FontInfo
  */
 public class FontInfoFinder {
-    
+
     /** logging instance */
     private Log log = LogFactory.getLog(FontInfoFinder.class);
 
     private FontEventListener eventListener;
-    
+
     /**
      * Sets the font event listener that can be used to receive events about particular events
      * in this class.
@@ -63,7 +63,7 @@
     public void setEventListener(FontEventListener listener) {
         this.eventListener = listener;
     }
-    
+
     /**
      * Attempts to determine FontTriplets from a given CustomFont.
      * It seems to be fairly accurate but will probably require some tweaking over time
@@ -73,9 +73,9 @@
      */
     private void generateTripletsFromFont(CustomFont customFont, Collection triplets) {
         if (log.isTraceEnabled()) {
-            log.trace("Font: " + customFont.getFullName() 
-                    + ", family: " + customFont.getFamilyNames() 
-                    + ", PS: " + customFont.getFontName() 
+            log.trace("Font: " + customFont.getFullName()
+                    + ", family: " + customFont.getFamilyNames()
+                    + ", PS: " + customFont.getFontName()
                     + ", EmbedName: " + customFont.getEmbedFontName());
         }
 
@@ -87,7 +87,7 @@
 
         String style = guessStyle(customFont, searchName);
         int weight; //= customFont.getWeight();
-        int guessedWeight = FontUtil.guessWeight(searchName); 
+        int guessedWeight = FontUtil.guessWeight(searchName);
         //We always take the guessed weight for now since it yield much better results.
         //OpenType's OS/2 usWeightClass value proves to be unreliable.
         weight = guessedWeight;
@@ -114,9 +114,9 @@
             }
         }
     }
-    
+
     private final Pattern quotePattern = Pattern.compile("'");
-    
+
     private String stripQuotes(String name) {
         return quotePattern.matcher(name).replaceAll("");
     }
@@ -125,13 +125,13 @@
         // style
         String style = Font.STYLE_NORMAL;
         if (customFont.getItalicAngle() > 0) {
-            style = Font.STYLE_ITALIC;  
+            style = Font.STYLE_ITALIC;
         } else {
             style = FontUtil.guessStyle(fontName);
         }
         return style;
     }
-    
+
     /**
      * Attempts to determine FontInfo from a given custom font
      * @param fontUrl the font URL
@@ -151,13 +151,13 @@
         }
         EmbedFontInfo fontInfo = new EmbedFontInfo(null, customFont.isKerningEnabled(),
                 fontTripletList, embedUrl, subFontName);
-        fontInfo.setPostScriptName(customFont.getFontName());        
+        fontInfo.setPostScriptName(customFont.getFontName());
         if (fontCache != null) {
             fontCache.addFont(fontInfo);
         }
         return fontInfo;
     }
-        
+
     /**
      * Attempts to determine EmbedFontInfo from a given font file.
      * 
@@ -170,7 +170,7 @@
     public EmbedFontInfo[] find(URL fontUrl, FontResolver resolver, FontCache fontCache) {
         String embedUrl = null;
         embedUrl = fontUrl.toExternalForm();
-        
+
         long fileLastModified = -1;
         if (fontCache != null) {
             fileLastModified = FontCache.getLastModified(fontUrl);
@@ -188,8 +188,8 @@
                 return null;
             }
         }
-        
-        
+
+
         // try to determine triplet information from font file
         CustomFont customFont = null;
         if (fontUrl.toExternalForm().endsWith(".ttc")) {
@@ -241,7 +241,7 @@
                 EmbedFontInfo fi = getFontInfoFromCustomFont(fontUrl, customFont, fontCache);
                 if (fi != null) {
                     embedFontInfoList.add(fi);
-                } 
+                }
             }
             return (EmbedFontInfo[])embedFontInfoList.toArray(
                     new EmbedFontInfo[embedFontInfoList.size()]);

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts.base14;
 
@@ -27,7 +27,7 @@
  * Sets up Base 14 fonts
  */
 public class Base14FontCollection implements FontCollection {
-    
+
     private boolean kerning = false;
 
     /**
@@ -38,7 +38,7 @@
     public Base14FontCollection(boolean kerning) {
         this.kerning  = kerning;
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -143,7 +143,7 @@
         fontInfo.addFontProperties("F8", "Times Roman", Font.STYLE_ITALIC, Font.WEIGHT_BOLD);
         fontInfo.addFontProperties("F9", "Computer-Modern-Typewriter",
                                                         Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
-        
+
         return 15;
     }
 }

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/base14/Base14FontCollection.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/AttributeValue.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/AttributeValue.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/AttributeValue.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/AttributeValue.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts.substitute;
 
@@ -25,7 +25,7 @@
  * Encapsulates a font attribute value
  */
 public class AttributeValue extends java.util.ArrayList {
-    
+
     private static final long serialVersionUID = 748610847500940557L;
 
     /**
@@ -38,15 +38,15 @@
      */
     public static AttributeValue valueOf(String valuesString) {
         AttributeValue attribute = new AttributeValue();
-        StringTokenizer stringTokenzier = new StringTokenizer(valuesString, ",");
-        if (stringTokenzier.countTokens() > 1) {
-            while (stringTokenzier.hasMoreTokens()) {
-                String token = stringTokenzier.nextToken().trim();
+        StringTokenizer stringTokenizer = new StringTokenizer(valuesString, ",");
+        if (stringTokenizer.countTokens() > 1) {
+            while (stringTokenizer.hasMoreTokens()) {
+                String token = stringTokenizer.nextToken().trim();
                 AttributeValue tokenAttribute = AttributeValue.valueOf(token);
                 attribute.addAll(tokenAttribute);
             }
         } else {
-            String token = stringTokenzier.nextToken().trim();
+            String token = stringTokenizer.nextToken().trim();
             Object value = null;
             try {
                 value = Integer.valueOf(token);
@@ -60,6 +60,6 @@
                 attribute.add(value);
             }
         }
-        return attribute;      
+        return attribute;
     }
 }

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/AttributeValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/AttributeValue.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontQualifier.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontQualifier.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontQualifier.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontQualifier.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts.substitute;
 
@@ -32,7 +32,7 @@
 import org.apache.fop.fonts.FontUtil;
 
 /**
- * Encapsulates a font substitution qualifier 
+ * Encapsulates a font substitution qualifier
  */
 public class FontQualifier {
 
@@ -47,15 +47,15 @@
 
     /** font weight attribute value */
     private AttributeValue fontWeightAttributeValue = null;
-        
+
     /**
      * Default constructor
      */
     public FontQualifier() {
     }
-    
+
     /**
-     * Sets the font family 
+     * Sets the font family
      * @param fontFamily the font family
      */
     public void setFontFamily(String fontFamily) {
@@ -66,20 +66,20 @@
         }
         this.fontFamilyAttributeValue = fontFamilyAttribute;
     }
-    
+
     /**
-     * Sets the font style 
+     * Sets the font style
      * @param fontStyle the font style
      */
     public void setFontStyle(String fontStyle) {
         AttributeValue fontStyleAttribute = AttributeValue.valueOf(fontStyle);
         if (fontStyleAttribute != null) {
-            this.fontStyleAttributeValue = fontStyleAttribute; 
+            this.fontStyleAttributeValue = fontStyleAttribute;
         }
     }
 
     /**
-     * Sets the font weight 
+     * Sets the font weight
      * @param fontWeight the font weight
      */
     public void setFontWeight(String fontWeight) {
@@ -100,7 +100,7 @@
             this.fontWeightAttributeValue = fontWeightAttribute;
         }
     }
-    
+
     /**
      * @return the font family attribute
      */
@@ -117,7 +117,7 @@
         }
         return this.fontStyleAttributeValue;
     }
-    
+
     /**
      * @return the font weight attribute
      */
@@ -141,7 +141,7 @@
     public boolean hasFontStyle() {
         return this.fontStyleAttributeValue != null;
     }
-    
+
     /**
      * Returns a list of matching font triplet found in a given font info
      * 
@@ -154,7 +154,7 @@
         AttributeValue styleValue = getFontStyle();
 
         List/*<FontTriplet>*/ matchingTriplets = new java.util.ArrayList/*<FontTriplet>*/();
-        
+
         // try to find matching destination font triplet
         for (Iterator attrIt = fontFamilyValue.iterator(); attrIt.hasNext();) {
             String fontFamilyString = (String)attrIt.next();
@@ -165,7 +165,7 @@
                         tripletIt.hasNext();) {
                     FontTriplet triplet = (FontTriplet)tripletIt.next();
                     String fontName = triplet.getName();
-                    
+
                     // matched font family name
                     if (fontFamilyString.toLowerCase().equals(fontName.toLowerCase())) {
 
@@ -194,7 +194,7 @@
                                 }
                             }
                         }
-                        
+
                         // try and match font style
                         boolean styleMatched = false;
                         String fontStyleString = triplet.getStyle();
@@ -204,17 +204,17 @@
                                 styleMatched = true;
                             }
                         }
-                        
+
                         if (weightMatched && styleMatched) {
                             matchingTriplets.add(triplet);
                         }
                     }
                 }
-            }            
+            }
         }
         return matchingTriplets;
     }
-    
+
     /**
      * Returns the highest priority matching font triplet found in a given font info
      * @param fontInfo the font info
@@ -240,25 +240,25 @@
         }
         return bestTriplet;
     }
-    
+
     /**
      * @return a list of font triplets matching this qualifier
      */
     public List/*<FontTriplet>*/ getTriplets() {
         List/*<FontTriplet>*/ triplets = new java.util.ArrayList/*<FontTriplet>*/();
-        
+
         AttributeValue fontFamilyValue = getFontFamily();
         for (Iterator fontFamilyIt = fontFamilyValue.iterator(); fontFamilyIt.hasNext();) {
             String name = (String)fontFamilyIt.next();
-            
+
             AttributeValue styleValue = getFontStyle();
             for (Iterator styleIt = styleValue.iterator(); styleIt.hasNext();) {
                 String style = (String)styleIt.next();
-                
+
                 AttributeValue weightValue = getFontWeight();
                 for (Iterator weightIt = weightValue.iterator(); weightIt.hasNext();) {
                     Object weightObj = weightIt.next();
-                    
+
                     if (weightObj instanceof FontWeightRange) {
                         FontWeightRange fontWeightRange = (FontWeightRange)weightObj;
                         int[] weightRange = fontWeightRange.toArray();
@@ -292,14 +292,14 @@
             if (str.length() > 0) {
                 str += ", ";
             }
-            str += "font-style=" + fontStyleAttributeValue;            
+            str += "font-style=" + fontStyleAttributeValue;
         }
         if (fontWeightAttributeValue != null) {
             if (str.length() > 0) {
                 str += ", ";
             }
-            str += "font-weight=" + fontWeightAttributeValue;            
+            str += "font-weight=" + fontWeightAttributeValue;
         }
         return str;
     }
-}
\ No newline at end of file
+}

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontQualifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontQualifier.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts.substitute;
 
@@ -23,7 +23,7 @@
  * Encapsulates a pair of substitution qualifiers
  */
 public class FontSubstitution {
-    
+
     private FontQualifier fromQualifier;
     private FontQualifier toQualifier;
 
@@ -51,11 +51,11 @@
     public FontQualifier getToQualifier() {
         return toQualifier;
     }
-    
+
     /**
      * {@inheritDoc}
      */
     public String toString() {
         return "from=" + fromQualifier + ", to=" + toQualifier;
     }
-}
\ No newline at end of file
+}

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitution.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts.substitute;
 
@@ -44,9 +44,9 @@
     public void adjustFontInfo(FontInfo fontInfo) {
         for (Iterator/*<FontSubstitution>*/ subsIt = super.iterator(); subsIt.hasNext();) {
             FontSubstitution substitution = (FontSubstitution)subsIt.next();
-            
+
             // find the best matching font triplet
-            FontQualifier toQualifier = substitution.getToQualifier();            
+            FontQualifier toQualifier = substitution.getToQualifier();
             FontTriplet fontTriplet = toQualifier.bestMatch(fontInfo);
             if (fontTriplet == null) {
                 log.error("Unable to match font substitution for destination qualifier "
@@ -54,7 +54,7 @@
                 continue;
             }
             String internalFontKey = fontInfo.getInternalFontKey(fontTriplet);
-            
+
             FontQualifier fromQualifier = substitution.getFromQualifier();
             List/*<FontTriplet>*/ tripletList = fromQualifier.getTriplets();
             for (Iterator tripletit = tripletList.iterator(); tripletit.hasNext();) {
@@ -62,5 +62,5 @@
                 fontInfo.addFontProperties(internalFontKey, triplet);
             }
         }
-    }    
+    }
 }

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutions.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts.substitute;
 
@@ -37,7 +37,7 @@
     public FontSubstitutionsConfigurator(Configuration cfg) {
         this.cfg = cfg;
     }
-    
+
     private static FontQualifier getQualfierFromConfiguration(Configuration cfg)
     throws FOPException {
         String fontFamily = cfg.getAttribute("font-family", null);
@@ -56,7 +56,7 @@
         }
         return qualifier;
     }
-        
+
     /**
      * Configures a font substitution catalog
      * 
@@ -74,7 +74,7 @@
             if (fromCfg == null) {
                 throw new FOPException("'substitution' element without child 'to' element");
             }
-            FontQualifier fromQualifier = getQualfierFromConfiguration(fromCfg);                
+            FontQualifier fromQualifier = getQualfierFromConfiguration(fromCfg);
             FontQualifier toQualifier = getQualfierFromConfiguration(toCfg);
             FontSubstitution substitution = new FontSubstitution(fromQualifier, toQualifier);
             substitutions.add(substitution);

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontSubstitutionsConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java Mon May 12 01:58:21 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.fonts.substitute;
 
@@ -23,13 +23,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.fop.fonts.FontUtil;
 
 /**
  * Encapsulates a range of font weight values
  */
 public class FontWeightRange {
-    
+
     /** logging instance */
     protected static Log log = LogFactory.getLog("org.apache.fop.render.fonts");
 
@@ -68,7 +67,7 @@
 
     /** the start range */
     private int start;
-    
+
     /** the end range */
     private int end;
 
@@ -81,7 +80,7 @@
         this.start = start;
         this.end = end;
     }
-    
+
     /**
      * Returns true if the given integer value is within this integer range
      * @param value the integer value
@@ -90,7 +89,7 @@
     public boolean isWithinRange(int value) {
         return (value >= start && value <= end);
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -111,5 +110,5 @@
             range[i] = start + (i * 100);
         }
         return range;
-    }    
+    }
 }

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fonts/substitute/FontWeightRange.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Mon May 12 01:58:21 2008
@@ -38,7 +38,7 @@
 /**
  * The base class for most LayoutManagers.
  */
-public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager 
+public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
     implements Constants {
 
     /**
@@ -56,14 +56,14 @@
     private Map markers = null;
 
     /** True if this LayoutManager has handled all of its content. */
-    private boolean bFinished = false;
-    
+    private boolean isFinished = false;
+
     /** child LM during getNextKnuthElement phase */
     protected LayoutManager curChildLM = null;
-    
+
     /** child LM iterator during getNextKnuthElement phase */
     protected ListIterator childLMiter = null;
-    
+
     private int lastGeneratedPosition = -1;
     private int smallestPosNumberChecked = Integer.MAX_VALUE;
 
@@ -136,7 +136,7 @@
      * ie. the last one returned represents the end of the content.
      */
     public boolean isFinished() {
-        return bFinished;
+        return isFinished;
     }
 
     /**
@@ -144,18 +144,14 @@
      * @param fin the flag value to be set
      */
     public void setFinished(boolean fin) {
-        bFinished = fin;
+        isFinished = fin;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void addAreas(PositionIterator posIter, LayoutContext context) {
     }
 
-    /**
-     * {@inheritDoc} 
-     */
+    /** {@inheritDoc} */
     public LinkedList getNextKnuthElements(LayoutContext context,
                                            int alignment) {
         log.warn("null implementation of getNextKnuthElements() called!");
@@ -163,9 +159,7 @@
         return null;
     }
 
-    /**
-     * {@inheritDoc} 
-     */
+    /** {@inheritDoc} */
     public LinkedList getChangedKnuthElements(List oldList,
                                               int alignment) {
         log.warn("null implementation of getChangeKnuthElement() called!");
@@ -229,20 +223,20 @@
     public PageSequenceLayoutManager getPSLM() {
         return parentLM.getPSLM();
     }
-    
+
     /**
      * @see PageSequenceLayoutManager#getCurrentPage()
      * @return the {@link Page} instance corresponding to the current page
      */
     public Page getCurrentPage() {
         return getPSLM().getCurrentPage();
-    }  
-    
+    }
+
     /** @return the current page viewport */
     public PageViewport getCurrentPV() {
         return getPSLM().getCurrentPage().getPageViewport();
-    }  
-    
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -302,11 +296,12 @@
         if (pos.getIndex() >= 0) {
             throw new IllegalStateException("Position already got its index");
         }
+        
         lastGeneratedPosition++;
         pos.setIndex(lastGeneratedPosition);
         return pos;
     }
-    
+
     /**
      * Indicates whether the given Position is the first area-generating Position of this LM.
      * @param pos the Position (must be one with a position index)
@@ -326,7 +321,7 @@
             return false;
         }
     }
-    
+
     /**
      * Indicates whether the given Position is the last area-generating Position of this LM.
      * @param pos the Position (must be one with a position index)
@@ -349,7 +344,7 @@
         Map atts = fobj.getForeignAttributes();
         targetArea.setForeignAttributes(atts);
     }
-    
+
     /**
      * Registers the FO's markers on the current PageViewport
      *
@@ -360,9 +355,9 @@
     protected void addMarkersToPage(boolean isStarting, boolean isFirst, boolean isLast) {
         if (this.markers != null) {
             getCurrentPV().addMarkers(
-                    this.markers, 
-                    isStarting, 
-                    isFirst, 
+                    this.markers,
+                    isStarting,
+                    isFirst,
                     isLast);
         }
     }
@@ -386,9 +381,49 @@
         }
     }
 
+    /**
+     * Checks to see if the incoming {@link Position}
+     * is the last one for this LM, and if so, calls
+     * {@link #notifyEndOfLayout()} and cleans up.
+     * 
+     * @param pos   the {@link Position} to check
+     */
+    protected void checkEndOfLayout(Position pos) {
+        if (pos != null
+            && pos.getLM() == this
+            && this.isLast(pos)) {
+            
+            notifyEndOfLayout();
+            
+            /* References to the child LMs are no longer needed
+             */
+            childLMs = null;
+            curChildLM = null;
+            childLMiter = null;
+            
+            /* markers that qualify have been transferred to the page
+             */
+            markers = null;
+            
+            /* References to the FO's children can be released if the 
+             * LM is a descendant of the FlowLM. For static-content
+             * the FO may still be needed on following pages.
+             */
+            LayoutManager lm = this.parentLM;
+            while (!(lm instanceof FlowLayoutManager
+                        || lm instanceof PageSequenceLayoutManager)) {
+                lm = lm.getParent();
+            }
+            if (lm instanceof FlowLayoutManager) {
+                fobj.clearChildNodes();
+                fobjIter = null;
+            }
+        }
+    }
+    
     /** {@inheritDoc} */
     public String toString() {
         return (super.toString() + (fobj != null ? "[fobj=" + fobj.toString() + "]" : ""));
     }
-    
+
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Mon May 12 01:58:21 2008
@@ -392,8 +392,8 @@
         curBlockArea = null;
         resetSpaces();
         
-        // Notify end of block layout manager to the PSLM
-        notifyEndOfLayout();
+        //Notify end of block layout manager to the PSLM
+        checkEndOfLayout(lastPos);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java Mon May 12 01:58:21 2008
@@ -61,11 +61,8 @@
     
     /** {@inheritDoc} */
     public void initialize() {
-        Character fobj = (Character)this.fobj;
-        
-        FontInfo fi = fobj.getFOEventHandler().getFontInfo();
-        FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi);
-        font = fi.getFontInstance(fontkeys[0], fobj.getCommonFont().fontSize.getValue(this));
+        Character fobj = (Character)this.fobj;        
+        font = this.selectFontForCharacter(fobj);
         SpaceVal ls = SpaceVal.makeLetterSpacing(fobj.getLetterSpacing());
         letterSpaceIPD = ls.getSpace();
         hyphIPD = fobj.getCommonHyphenation().getHyphIPD(font);
@@ -75,6 +72,33 @@
         chArea.setBaselineOffset(font.getAscender());
         setCurrentArea(chArea);
     }
+    
+    /**
+     * Selects a font which is able to display the given character.
+     * <p>
+     * Please note: this implements the font-selection-strategy
+     * character-by-character.
+     * <p>
+     * TODO: The same function could apply to other elements as well.
+     * 
+     * @param fobj
+     *            a Character object containing the character and its
+     *            attributed.
+     * @return a Font object.
+     */
+    private Font selectFontForCharacter(Character fobj) {
+        FontInfo fi = fobj.getFOEventHandler().getFontInfo();
+        FontTriplet[] fontkeys = fobj.getCommonFont().getFontState(fi);
+        for (int i = 0; i < fontkeys.length; i++) {
+            font = fi.getFontInstance(fontkeys[i],
+                    fobj.getCommonFont().fontSize.getValue(this));
+            if (font.hasChar(fobj.getCharacter())) {
+                return font;
+            }
+        }
+        return fi.getFontInstance(fontkeys[0],
+                fobj.getCommonFont().fontSize.getValue(this));
+    }
 
     private org.apache.fop.area.inline.TextArea getCharacterInlineArea(Character node) {
         org.apache.fop.area.inline.TextArea text

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Mon May 12 01:58:21 2008
@@ -518,6 +518,7 @@
         
         context.setFlags(LayoutContext.LAST_AREA, isLast);
         areaCreated = true;
+        checkEndOfLayout(lastPos);
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java Mon May 12 01:58:21 2008
@@ -74,12 +74,7 @@
             if (parentLM instanceof BlockStackingLayoutManager
                     && !(parentLM instanceof BlockLayoutManager)) {
                 Block helperBlock = new Block();
-                LineArea helperLine = new LineArea();
-                InlineParent helperInline = new InlineParent();
-                helperInline.addChildArea(area);
-                helperLine.addInlineArea(helperInline);
-                helperLine.updateExtentsFromChildren();
-                helperBlock.addLineArea(helperLine);
+                TraitSetter.setProducerID(helperBlock, fobj.getId());
                 parentLM.addChildArea(helperBlock);
             } else {
                 parentLM.addChildArea(area);

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Mon May 12 01:58:21 2008
@@ -219,7 +219,7 @@
         curBlockArea = null;
         resetSpaces();
         
-        notifyEndOfLayout();
+        checkEndOfLayout(lastPos);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java Mon May 12 01:58:21 2008
@@ -172,7 +172,7 @@
 
         curBlockArea = null;
         
-        notifyEndOfLayout();
+        checkEndOfLayout(lastPos);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Mon May 12 01:58:21 2008
@@ -557,7 +557,7 @@
         curBlockArea = null;
         resetSpaces();
         
-        notifyEndOfLayout();
+        checkEndOfLayout(lastPos);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractRendererConfigurator.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractRendererConfigurator.java Mon May 12 01:58:21 2008
@@ -36,7 +36,7 @@
 
     /** fop factory configuration */
     protected FOUserAgent userAgent = null;
-   
+
     /**
      * Default constructor
      * @param userAgent user agent
@@ -45,7 +45,7 @@
         super();
         this.userAgent = userAgent;
     }
-    
+
     /**
      * Returns the configuration subtree for a specific renderer.
      * @param renderer the renderer
@@ -59,7 +59,7 @@
             }
             return null;
         }
-        
+
         return getRendererConfig(mimeType);
     }
 
@@ -74,11 +74,11 @@
             if (log.isDebugEnabled()) {
                 log.debug("userconfig is null");
             }
-            return null;            
+            return null;
         }
-    
+
         Configuration userRendererConfig = null;
-    
+
         Configuration[] cfgs
             = cfg.getChild("renderers").getChildren("renderer");
         for (int i = 0; i < cfgs.length; ++i) {

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRenderer.java Mon May 12 01:58:21 2008
@@ -45,7 +45,7 @@
 
     /** list of fonts */
     protected List/*<EmbedFontInfo>*/ embedFontInfoList = null;
-   
+
     /**
      * Adds a font list to current list of fonts
      * @param fontList a font info list
@@ -54,10 +54,10 @@
         if (embedFontInfoList == null) {
             setFontList(fontList);
         } else {
-            fontList.addAll(fontList);
+            embedFontInfoList.addAll(fontList);
         }
     }
-    
+
     /**
      * @param embedFontInfoList list of available fonts
      */
@@ -91,7 +91,7 @@
         FontTriplet triplet = (FontTriplet)area.getTrait(Trait.FONT);
         return fontInfo.getInternalFontKey(triplet);
     }
-    
+
     /**
      * Returns a Font object constructed based on the font traits in an area
      * @param area the area from which to retrieve the font triplet information
@@ -102,7 +102,7 @@
         int size = ((Integer)area.getTrait(Trait.FONT_SIZE)).intValue();
         return fontInfo.getFontInstance(triplet, size);
     }
-    
+
     /**
      * Lightens up a color for groove, ridge, inset and outset border effects.
      * @param col the color to lighten up
@@ -135,7 +135,7 @@
      * @param foreignAttributes a Map or foreign attributes, may be null
      * @return the RendererContext
      */
-    protected RendererContext createRendererContext(int x, int y, int width, int height, 
+    protected RendererContext createRendererContext(int x, int y, int width, int height,
             Map foreignAttributes) {
         RendererContext context;
         context = new RendererContext(this, getMimeType());
@@ -149,7 +149,7 @@
                             new Integer(x));
         context.setProperty(RendererContextConstants.YPOS,
                             new Integer(y));
-        context.setProperty(RendererContextConstants.PAGE_VIEWPORT, 
+        context.setProperty(RendererContextConstants.PAGE_VIEWPORT,
                             getCurrentPageViewport());
         if (foreignAttributes != null) {
             context.setProperty(RendererContextConstants.FOREIGN_ATTRIBUTES, foreignAttributes);
@@ -165,12 +165,12 @@
      * @param foreignAttributes the foreign attributes containing rendering hints, or null
      */
     public void renderDocument(Document doc, String ns, Rectangle2D pos, Map foreignAttributes) {
-        int x = currentIPPosition + (int) pos.getX(); 
+        int x = currentIPPosition + (int) pos.getX();
         int y = currentBPPosition + (int) pos.getY();
         int width = (int)pos.getWidth();
         int height = (int)pos.getHeight();
         RendererContext context = createRendererContext(x, y, width, height, foreignAttributes);
-        
+
         renderXML(context, doc, ns);
     }
 
@@ -185,7 +185,7 @@
         }
         return this.fontResolver;
     }
-    
+
     /**
      * @return the font info
      */

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRendererConfigurator.java?rev=655445&r1=655444&r2=655445&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/PrintRendererConfigurator.java Mon May 12 01:58:21 2008
@@ -55,7 +55,7 @@
 /**
  * Base Print renderer configurator (mostly handles font configuration)
  */
-public class PrintRendererConfigurator extends AbstractRendererConfigurator 
+public class PrintRendererConfigurator extends AbstractRendererConfigurator
             implements RendererConfigurator {
 
     /** logger instance */
@@ -94,9 +94,9 @@
         boolean strict = factory.validateUserConfigStrictly();
         FontCache fontCache = fontManager.getFontCache();
 
-        List/*<EmbedFontInfo>*/ embedFontInfoList = buildFontListFromConfiguration(cfg, 
+        List/*<EmbedFontInfo>*/ embedFontInfoList = buildFontListFromConfiguration(cfg,
                 fontResolver, strict, fontManager);
-        
+
         if (fontCache != null && fontCache.hasChanged()) {
             fontCache.save();
         }
@@ -113,13 +113,13 @@
      * @return a List of EmbedFontInfo objects.
      * @throws FOPException If an error occurs while processing the configuration
      */
-    public static List/*<EmbedFontInfo>*/ buildFontListFromConfiguration(Configuration cfg, 
-            FontResolver fontResolver, 
+    public static List/*<EmbedFontInfo>*/ buildFontListFromConfiguration(Configuration cfg,
+            FontResolver fontResolver,
             boolean strict, FontManager fontManager) throws FOPException {
         FontCache fontCache = fontManager.getFontCache();
         String fontBaseURL = fontManager.getFontBaseURL();
         List/*<EmbedFontInfo>*/ fontInfoList
-            = new java.util.ArrayList/*<EmbedFontInfo>*/();
+                = new java.util.ArrayList/*<EmbedFontInfo>*/();
 
         Configuration fonts = cfg.getChild("fonts", false);
         if (fonts != null) {
@@ -128,7 +128,7 @@
                 log.debug("Starting font configuration...");
                 start = System.currentTimeMillis();
             }
-            
+
             // native o/s search (autodetect) configuration
             boolean autodetectFonts = (fonts.getChild("auto-detect", false) != null);
             if (autodetectFonts) {
@@ -203,7 +203,7 @@
                     LogUtil.handleException(log, e, strict);
                 }
             }
-            
+
             // font file (singular) configuration
             Configuration[] font = fonts.getChildren("font");
             for (int i = 0; i < font.length; i++) {
@@ -216,9 +216,9 @@
 
             // Update referenced fonts (fonts which are not to be embedded)
             updateReferencedFonts(fontInfoList, fontManager.getReferencedFontsMatcher());
-            
+
             if (log.isDebugEnabled()) {
-                log.debug("Finished font configuration in " 
+                log.debug("Finished font configuration in "
                         + (System.currentTimeMillis() - start) + "ms");
             }
         }
@@ -243,7 +243,7 @@
         }
     }
 
-    
+
     /**
      * Iterates over font file list adding font info to list
      * @param fontFileList font file list
@@ -258,7 +258,7 @@
             // parse font to ascertain font info
             FontInfoFinder finder = new FontInfoFinder();
             //EmbedFontInfo fontInfo = finder.find(fontUrl, resolver, fontCache);
-            
+
             //List<EmbedFontInfo> embedFontInfoList = finder.find(fontUrl, resolver, fontCache);
             EmbedFontInfo[] embedFontInfos = finder.find(fontUrl, resolver, fontCache);
 
@@ -299,14 +299,14 @@
                 LogUtil.handleError(log, "font-triplet without name", strict);
                 return null;
             }
-            
+
             String weightStr = tripletCfg.getAttribute("weight");
             if (weightStr == null) {
                 LogUtil.handleError(log, "font-triplet without weight", strict);
                 return null;
             }
             int weight = FontUtil.parseCSS2FontWeight(FontUtil.stripWhiteSpace(weightStr));
-            
+
             String style = tripletCfg.getAttribute("style");
             if (style == null) {
                 LogUtil.handleError(log, "font-triplet without style", strict);
@@ -320,7 +320,7 @@
         }
         return null;
     }
-    
+
     /**
      * Returns a font info from a font node Configuration definition
      * 
@@ -337,7 +337,7 @@
         String metricsUrl = fontCfg.getAttribute("metrics-url", null);
         String embedUrl = fontCfg.getAttribute("embed-url", null);
         String subFont = fontCfg.getAttribute("sub-font", null);
-        
+
         if (metricsUrl == null && embedUrl == null) {
             LogUtil.handleError(log,
                     "Font configuration without metric-url or embed-url attribute",
@@ -366,13 +366,13 @@
                 }
             }
         }
-                        
+
         Configuration[] tripletCfg = fontCfg.getChildren("font-triplet");
-        
+
         // no font triplet info
         if (tripletCfg.length == 0) {
             LogUtil.handleError(log, "font without font-triplet", strict);
-            
+
             File fontFile = FontCache.getFileFromUrls(new String[] {embedUrl, metricsUrl});
             URL fontUrl;
             try {
@@ -384,28 +384,28 @@
             }
             if (fontFile != null) {
                 FontInfoFinder finder = new FontInfoFinder();
-                EmbedFontInfo[] infos = finder.find(fontUrl, fontResolver, fontCache); 
+                EmbedFontInfo[] infos = finder.find(fontUrl, fontResolver, fontCache);
                 return infos[0]; //When subFont is set, only one font is returned
             } else {
                 return null;
             }
         }
-        
+
         List/*<FontTriplet>*/ tripletList = new java.util.ArrayList/*<FontTriplet>*/();
         for (int j = 0; j < tripletCfg.length; j++) {
             FontTriplet fontTriplet = getFontTripletFromConfiguration(tripletCfg[j], strict);
             tripletList.add(fontTriplet);
         }
-        
+
         boolean useKerning = fontCfg.getAttributeAsBoolean("kerning", true);
         EmbedFontInfo embedFontInfo
-            = new EmbedFontInfo(metricsUrl, useKerning, tripletList, embedUrl, subFont);
+                = new EmbedFontInfo(metricsUrl, useKerning, tripletList, embedUrl, subFont);
         if (fontCache != null) {
             if (!fontCache.containsFont(embedFontInfo)) {
-                fontCache.addFont(embedFontInfo);                    
+                fontCache.addFont(embedFontInfo);
             }
         }
-        
+
         if (log.isDebugEnabled()) {
             String embedFile = embedFontInfo.getEmbedFile();
             log.debug("Adding font " + (embedFile != null ? embedFile + ", " : "")
@@ -417,8 +417,8 @@
                         + triplet.getStyle() + ", "
                         + triplet.getWeight());
             }
-        }            
+        }
         return embedFontInfo;
     }
-    
+
 }



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