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 sp...@apache.org on 2007/11/08 22:27:35 UTC

svn commit: r593328 [2/7] - in /xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking: ./ src/codegen/fonts/ src/documentation/ src/documentation/content/xdocs/ src/documentation/content/xdocs/dev/ src/documentation/content/xdocs/trunk/ src/java...

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/maillist.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/maillist.xml?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/maillist.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/maillist.xml Thu Nov  8 13:27:19 2007
@@ -50,11 +50,13 @@
           <li><jump href="http://www.mail-archive.com/fop-users%40xmlgraphics.apache.org/">The Mail Archive</jump>.</li>
           <li>The <jump href="http://dir.gmane.org/gmane.text.xml.fop.user">GMANE archive</jump>.</li>
           <li>The <jump href="http://www.nabble.com/FOP---Users-f353.html">Nabble archive</jump> (only posts after May 2005).</li>
+          <li>The <jump href="http://fop-users.markmail.org/">MarkMail archive</jump>.</li>
         </ul>
         <note>
           If you don't like mailing lists and prefer a forum-like system, have a look at 
-          <jump href="http://dir.gmane.org/gmane.text.xml.fop.user">GMANE</jump>. GMANE
-          allows you to post to the mailing list without having to subscribe.
+          <jump href="http://dir.gmane.org/gmane.text.xml.fop.user">GMANE</jump> or
+          <jump href="http://www.nabble.com/FOP---Users-f353.html">Nabble</jump>. They
+          allow you to post to the mailing list without having to subscribe.
         </note>
       </section>
       <section id="fop-user-subscribe">

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/news.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/news.xml?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/news.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/news.xml Thu Nov  8 13:27:19 2007
@@ -26,6 +26,10 @@
   </header>
   <body>
     <section>
+      <title>15 October 2007 - New Committer</title>
+      <p>Welcome Adrian Cumiskey!</p>
+    </section>
+    <section>
       <title>24th August 2007 - Apache FOP 0.94 Released</title>
       <p>The Apache FOP team is pleased to present you the second production
         grade release of the new FOP codebase. This release contains many bug

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/site.xml?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/site.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/site.xml Thu Nov  8 13:27:19 2007
@@ -27,6 +27,8 @@
     <faqs label="FAQs" href="faq.html"/>
     <maillist label="Mailing Lists" href="maillist.html"/>
     <license label="License" href="license.html"/>
+    <asf-sponsorship label="ASF Sponsorship Program" href="http://www.apache.org/foundation/sponsorship.html"/>"
+    <asf-thanks label="ASF Thanks" href="http://www.apache.org/foundation/thanks.html"/>"
     <!--
     <all_site label="Full HTML" href="wholesite.html"/>
     <all_sitePDF label="Full PDF" href="wholesite.pdf"/>

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/team.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/team.xml?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/team.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/team.xml Thu Nov  8 13:27:19 2007
@@ -36,6 +36,8 @@
             is a Java/VB Programmer from England.</li>
         <li id="jb"><link href="mailto:jay@bryantcs.com">Jay Bryant</link> (JB) is a
             freelance information architect in Austin, TX.</li>
+        <li id="ac"><link href="mailto:acumiskey@apache.org">Adrian Cumiskey</link> (AC),
+          is a Java and Perl Programmer from St Albans, United Kingdom.</li>
         <li id="ad"><link href="mailto:adelmelle@apache.org">Andreas Delmelle</link> (AD)</li>
         <!-- Luca prefers the mail address with "AT", to stop spam, etc. -->
         <li id="lf"><link href="mailto:lfurini AT cs.unibo.it">Luca Furini</link> (LF)
@@ -87,8 +89,6 @@
           improve the DocBook to PDF tool-chain to produce high quality output, while still
           conforming to given style-guides. See his <link href="http://max.berger.name">home
             page</link> for more information.</li>
-        <li id="ac"><link href="mailto:adrian.cumiskey.at.gmail.com">Adrian Cumiskey</link> (AC),
-          is a Java and Perl Programmer from St Albans, United Kingdom.</li>
     <li id="lm">Louis Masters</li>
     <li id="mn">Manoj Nair, Currently consulting for Sony Pictures Entertainment in Los Angeles, CA USA. Previously he worked with Java &amp; related technologies specializing in developing n-tier Web applications.</li>
         <li id="rr"><link href="mailto:renaud.richardet AT gmail DOT com">Renaud Richardet</link> (RR)

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/trunk/fonts.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/trunk/fonts.xml?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/trunk/fonts.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/content/xdocs/trunk/fonts.xml Thu Nov  8 13:27:19 2007
@@ -118,7 +118,32 @@
     </section>
     <section>
       <title>Base-14 Fonts</title>
-      <p>The Adobe PDF Specification specifies a set of 14 fonts that must be available to every PDF reader: Helvetica (normal, bold, italic, bold italic), Times (normal, bold, italic, bold italic), Courier (normal, bold, italic, bold italic), Symbol and ZapfDingbats.</p>
+      <p>
+        The Adobe PDF Specification specifies a set of 14 fonts that must be
+        available to every PDF reader:
+        Helvetica (normal, bold, italic, bold italic),
+        Times (normal, bold, italic, bold italic),
+        Courier (normal, bold, italic, bold italic),
+        Symbol and ZapfDingbats.
+      </p>
+      <p>
+        Please note that recent versions of Adobe Acrobat Reader replace
+        "Helvetica" with "Arial" and "Times" with "Times New Roman" internally.
+        GhostScript replaces "Helvetica" with "Nimbus Sans L" and "Times" with 
+        "Nimbus Roman No9 L". Other document viewers may do similar font
+        substitutions. If you need to make sure that there are no such
+        substitutions, you need to specify an explicit font and embed it in
+        the target document.
+      </p>
+    </section>
+    <section>
+      <title>Missing Fonts</title>
+      <p>
+        When FOP does not have a specific font at its disposal (because it's 
+        not installed in the operating system or set up in FOP's configuration),
+        the font is replaced with "any". "any" is internally mapped to the
+        Base-14 font "Times" (see above).
+      </p>
     </section>
     <section id="awt">
       <title>AWT/Operating System Fonts</title>

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/skinconf.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/skinconf.xml?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/skinconf.xml (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/documentation/skinconf.xml Thu Nov  8 13:27:19 2007
@@ -93,11 +93,8 @@
   <!-- The following used to construct a copyright statement -->
   <year>1999-2007</year>
   <vendor>The Apache Software Foundation.</vendor>
-  <!-- The optional copyright-link URL will be used as a link in the
-    copyright statement
   <copyright-link>http://www.apache.org/licenses/</copyright-link>
-  -->
-
+  
   <!-- Some skins use this to form a 'breadcrumb trail' of links.
     Use location="alt" to move the trail to an alternate location
     (if the skin supports it).
@@ -378,27 +375,21 @@
       <width>125</width>
       <height>125</height>
     </credit>
-    <!--credit box-location="alt2">
-      <name>ApacheCon US 2006 (9-13 October 2006)</name>
-      <url>http://www.us.apachecon.com/</url>
-      <image>http://www.apache.org/ads/ApacheCon/234x60-2006-us.gif</image>
-      <width>150</width>
-      <height>39</height>
-    </credit-->
-    <!--<credit>
-      <name>Built with Cocoon</name>
-      <url>http://xml.apache.org/cocoon/</url>
-      <image>skin/images/built-with-cocoon.gif</image>
-      <width>88</width>
-      <height>31</height>
+    <credit box-location="alt2">
+      <name>OS Summit Asia 2007</name>
+      <url>http://www.ossummit.com/</url>
+      <image>http://www.ossummit.com/ads/ossummit_button_3.jpg</image>
+      <width>125</width>
+      <height>125</height>
     </credit>
-    <credit>
-      <name>Krysalis Centipede</name>
-      <url>http://www.krysalis.org/centipede/</url>
-      <image>skin/images/centipede-logo-small.gif</image>
-      <width>138</width>
-      <height>31</height>
-    </credit>-->
+    <credit box-location="alt2">
+      <name>ApacheCon Europe 2008</name>
+      <url>http://eu.apachecon.com/</url>
+      <image>http://apache.org/ads/ApacheCon/2008-europe-125x125.png</image>
+      <width>125</width>
+      <height>125</height>
+    </credit>
+    
     <credit role="pdf">
       <name>PDF created by Apache FOP</name>
       <url>http://xmlgraphics.apache.org/fop/</url>

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOElementMapping.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOElementMapping.java Thu Nov  8 13:27:19 2007
@@ -366,55 +366,55 @@
     
     static class TableAndCaptionMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.TableAndCaption(parent);
+            return new org.apache.fop.fo.flow.table.TableAndCaption(parent);
         }
     }
 
     static class TableMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.Table(parent);
+            return new org.apache.fop.fo.flow.table.Table(parent);
         }
     }
 
     static class TableColumnMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.TableColumn(parent);
+            return new org.apache.fop.fo.flow.table.TableColumn(parent);
         }
     }
 
     static class TableCaptionMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.TableCaption(parent);
+            return new org.apache.fop.fo.flow.table.TableCaption(parent);
         }
     }
 
     static class TableBodyMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.TableBody(parent);
+            return new org.apache.fop.fo.flow.table.TableBody(parent);
         }
     }
 
     static class TableHeaderMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.TableHeader(parent);
+            return new org.apache.fop.fo.flow.table.TableHeader(parent);
         }
     }
 
     static class TableFooterMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.TableFooter(parent);
+            return new org.apache.fop.fo.flow.table.TableFooter(parent);
         }
     }
 
     static class TableRowMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.TableRow(parent);
+            return new org.apache.fop.fo.flow.table.TableRow(parent);
         }
     }
 
     static class TableCellMaker extends ElementMapping.Maker {
         public FONode make(FONode parent) {
-            return new org.apache.fop.fo.flow.TableCell(parent);
+            return new org.apache.fop.fo.flow.table.TableCell(parent);
         }
     }
 

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOEventHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOEventHandler.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOEventHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOEventHandler.java Thu Nov  8 13:27:19 2007
@@ -39,11 +39,11 @@
 import org.apache.fop.fo.flow.ListBlock;
 import org.apache.fop.fo.flow.ListItem;
 import org.apache.fop.fo.flow.PageNumber;
-import org.apache.fop.fo.flow.Table;
-import org.apache.fop.fo.flow.TableBody;
-import org.apache.fop.fo.flow.TableCell;
-import org.apache.fop.fo.flow.TableColumn;
-import org.apache.fop.fo.flow.TableRow;
+import org.apache.fop.fo.flow.table.Table;
+import org.apache.fop.fo.flow.table.TableBody;
+import org.apache.fop.fo.flow.table.TableCell;
+import org.apache.fop.fo.flow.table.TableColumn;
+import org.apache.fop.fo.flow.table.TableRow;
 import org.apache.fop.fo.pagination.Flow;
 import org.apache.fop.fo.pagination.PageSequence;
 import org.apache.fop.fonts.FontInfo;

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FOPropertyMapping.java Thu Nov  8 13:27:19 2007
@@ -31,7 +31,7 @@
 import org.apache.fop.fo.properties.BoxPropShorthandParser;
 import org.apache.fop.fo.properties.CharacterProperty;
 import org.apache.fop.fo.properties.ColorProperty;
-import org.apache.fop.fo.flow.TableFObj.ColumnNumberPropertyMaker;
+import org.apache.fop.fo.flow.table.TableFObj.ColumnNumberPropertyMaker;
 import org.apache.fop.fo.properties.CondLengthProperty;
 import org.apache.fop.fo.properties.CorrespondingPropertyMaker;
 import org.apache.fop.fo.properties.DimensionPropertyMaker;

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FObj.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/FObj.java Thu Nov  8 13:27:19 2007
@@ -581,6 +581,12 @@
         }
     }
     
+    /** {@inheritDoc} */
+    public String toString() {
+        return (super.toString() + "[@id=" + this.id + "]");
+    }
+
+
     public class FObjIterator implements FONodeIterator {
         
         private static final int F_NONE_ALLOWED = 0;

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java Thu Nov  8 13:27:19 2007
@@ -23,10 +23,11 @@
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.FOPropertyMapping;
-import org.apache.fop.fo.flow.Table;
-import org.apache.fop.fo.flow.TableCell;
-import org.apache.fop.fo.flow.TableColumn;
-import org.apache.fop.fo.flow.TableFObj;
+import org.apache.fop.fo.flow.table.ColumnNumberManager;
+import org.apache.fop.fo.flow.table.Table;
+import org.apache.fop.fo.flow.table.TableCell;
+import org.apache.fop.fo.flow.table.TableColumn;
+import org.apache.fop.fo.flow.table.TableFObj;
 import org.apache.fop.fo.properties.Property;
 
 /**
@@ -61,9 +62,9 @@
      */
     public Property eval(Property[] args,
                          PropertyInfo pInfo) throws PropertyException {
-        
+
         FObj fo = pInfo.getPropertyList().getFObj();
-        
+
         /* obtain property Id for the property for which the function is being
          * evaluated */
         int propId = 0;
@@ -73,7 +74,7 @@
             String propName = args[0].getString();
             propId = FOPropertyMapping.getPropertyId(propName);
         }
-        
+
         /* make sure we have a correct property id ... */
         if (propId != -1) {
             /* obtain column number for which the function is being evaluated: */
@@ -81,7 +82,7 @@
             int span = 0;
             if (fo.getNameId() != Constants.FO_TABLE_CELL) {
                 // climb up to the nearest cell
-                do { 
+                do {
                     fo = (FObj) fo.getParent();
                 } while (fo.getNameId() != Constants.FO_TABLE_CELL
                           && fo.getNameId() != Constants.FO_PAGE_SEQUENCE);
@@ -105,19 +106,20 @@
             /* return the property from the column */
             Table t = ((TableFObj) fo).getTable();
             List cols = t.getColumns();
+            ColumnNumberManager columnIndexManager = t.getColumnNumberManager();
             if (cols == null) {
                 //no columns defined => no match: return default value
                 return pInfo.getPropertyList().get(propId, false, true);
             } else {
-                if (t.isColumnNumberUsed(columnNumber)) {
+                if (columnIndexManager.isColumnNumberUsed(columnNumber)) {
                     //easiest case: exact match
                     return ((TableColumn) cols.get(columnNumber - 1)).getProperty(propId);
                 } else {
                     //no exact match: try all spans...
-                    while (--span > 0 && !t.isColumnNumberUsed(++columnNumber)) {
+                    while (--span > 0 && !columnIndexManager.isColumnNumberUsed(++columnNumber)) {
                         //nop: just increment/decrement
                     }
-                    if (t.isColumnNumberUsed(columnNumber)) {
+                    if (columnIndexManager.isColumnNumberUsed(columnNumber)) {
                         return ((TableColumn) cols.get(columnNumber - 1)).getProperty(propId);
                     } else {
                         //no match: return default value

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java Thu Nov  8 13:27:19 2007
@@ -20,7 +20,7 @@
 package org.apache.fop.fo.expr;
 
 import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.flow.Table;
+import org.apache.fop.fo.flow.table.Table;
 import org.apache.fop.fo.properties.Property;
 import org.apache.fop.fo.properties.TableColLength;
 

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/flow/RetrieveMarker.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/flow/RetrieveMarker.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fo/flow/RetrieveMarker.java Thu Nov  8 13:27:19 2007
@@ -28,6 +28,7 @@
 import org.apache.fop.fo.FOText;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.flow.table.Table;
 import org.xml.sax.Locator;
 
 /**

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/CIDFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/CIDFont.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/CIDFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/CIDFont.java Thu Nov  8 13:27:19 2007
@@ -48,12 +48,6 @@
 
     // ---- Required ----
     /**
-     * Returns the name of the base font.
-     * @return the name of the base font
-     */
-    public abstract String getCidBaseFont();
-
-    /**
      * Returns the type of the CID font.
      * @return the type of the CID font
      */

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/CustomFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/CustomFont.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/CustomFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/CustomFont.java Thu Nov  8 13:27:19 2007
@@ -20,7 +20,10 @@
 package org.apache.fop.fonts;
 
 import java.io.IOException;
+import java.util.Collections;
 import java.util.Map;
+import java.util.Set;
+
 import javax.xml.transform.Source;
 
 /**
@@ -30,6 +33,8 @@
             implements FontDescriptor, MutableFont {
 
     private String fontName = null;
+    private String fullName = null;
+    private Set familyNames = null; //Set<String>
     private String fontSubName = null;
     private String embedFileName = null;
     private String embedResourceName = null;
@@ -52,18 +57,36 @@
 
     private boolean useKerning = true;
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public String getFontName() {
         return fontName;
     }
 
+    /** {@inheritDoc} */
+    public String getEmbedFontName() {
+        return getFontName();
+    }
+
+    /** {@inheritDoc} */
+    public String getFullName() {
+        return fullName;
+    }
+    
+    /**
+     * Returns the font family names.
+     * @return the font family names (a Set of Strings)
+     */
+    public Set getFamilyNames() {
+        return Collections.unmodifiableSet(this.familyNames);
+    }
+
     /**
+     * Returns the font family name stripped of whitespace.
+     * @return the stripped font family
      * @see FontUtil#stripWhiteSpace(String)
      */
     public String getStrippedFontName() {
-        return FontUtil.stripWhiteSpace(fontName);
+        return FontUtil.stripWhiteSpace(getFontName());
     }
 
     /**
@@ -92,7 +115,10 @@
         Source result = null;
         if (resolver != null && embedFileName != null) {
             result = resolver.resolve(embedFileName);
-            if(result == null) throw new IOException("Unable to resolve Source '" + embedFileName + "' for embedded font");
+            if (result == null) {
+                throw new IOException("Unable to resolve Source '" 
+                        + embedFileName + "' for embedded font");
+            }
         }
         return result;
     }
@@ -243,16 +269,23 @@
         }
     }
 
-
     /* ---- MutableFont interface ---- */
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void setFontName(String name) {
         this.fontName = name;
     }
 
+    /** {@inheritDoc} */
+    public void setFullName(String name) {
+        this.fullName = name;
+    }
+    
+    /** {@inheritDoc} */
+    public void setFamilyNames(Set names) {
+        this.familyNames = new java.util.HashSet(names);
+    }
+    
     /**
      * Sets the font's subfamily name.
      * @param subFamilyName the subfamily name of the font

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/Font.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/Font.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/Font.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/Font.java Thu Nov  8 13:27:19 2007
@@ -19,7 +19,6 @@
 
 package org.apache.fop.fonts;
 
-import java.util.BitSet;
 import java.util.Map;
 
 import org.apache.commons.logging.Log;
@@ -31,11 +30,17 @@
  */
 public class Font {
 
+    /** Extra Bold font weight */
+    public static final int WEIGHT_EXTRA_BOLD = 800;
+    
     /** Bold font weight */
     public static final int WEIGHT_BOLD = 700;
-
+    
     /** Normal font weight */
     public static final int WEIGHT_NORMAL = 400;
+
+    /** Light font weight */
+    public static final int WEIGHT_LIGHT = 200;
 
     /** Normal font style */
     public static final String STYLE_NORMAL = "normal";

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontInfo.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontInfo.java Thu Nov  8 13:27:19 2007
@@ -102,6 +102,9 @@
          * add the given family, style and weight as a lookup for the font
          * with the given name
          */
+        if (log.isDebugEnabled()) {
+            log.debug("Registering: " + triplet + " under " + name);
+        }
         this.triplets.put(triplet, name);
     }
 
@@ -135,55 +138,94 @@
         if (log.isTraceEnabled()) {
             log.trace("Font lookup: " + family + " " + style + " " + weight);
         }
-        FontTriplet startKey = createFontKey(family, style, weight); 
+        FontTriplet startKey = createFontKey(family, style, weight);
         FontTriplet key = startKey;
         // first try given parameters
         String f = getInternalFontKey(key);
         if (f == null) {
-            // then adjust weight, favouring normal or bold
-            key = findAdjustWeight(family, style, weight);
-            f = getInternalFontKey(key);
+            key = doAdjustedLookup(family, style, weight, startKey, substFont);
+        }
 
-            if (!substFont && f == null) {
-                return null;
-            }
-            
-            // only if the font may be substituted
-            // fallback 1: try the same font-family and weight with default style
-            if (f == null) {
-                key = createFontKey(family, Font.STYLE_NORMAL, weight);
-                f = getInternalFontKey(key);
-            }
-            
-            // fallback 2: try the same font-family with default style and weight
-            if (f == null) {
-                key = createFontKey(family, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL);
-                f = getInternalFontKey(key);
+        if (key != null) {
+            if (key != startKey) {
+                notifyFontReplacement(startKey, key);
             }
-            
-            // fallback 3: try any family with orig style/weight
-            if (f == null) {
-                key = createFontKey("any", style, weight);
-                f = getInternalFontKey(key);
+            return key;
+        } else {
+            return null;
+        }
+    }
+
+    private FontTriplet doAdjustedLookup(String family, String style,
+            int weight, FontTriplet startKey, boolean substFont) {
+        FontTriplet key;
+        String f;
+        if (!family.equals(startKey.getName())) {
+            key = createFontKey(family, style, weight);
+            f = getInternalFontKey(key);
+            if (f != null) {
+                return key;
             }
+        }
+        
+        // adjust weight, favouring normal or bold
+        key = findAdjustWeight(family, style, weight);
+        f = getInternalFontKey(key);
 
-            // last resort: use default
-            if (f == null) {
-                key = Font.DEFAULT_FONT;
+        if (!substFont && f == null) {
+            return null;
+        }
+        
+        // only if the font may be substituted
+        // fallback 1: try the same font-family and weight with default style
+        if (f == null && style != Font.STYLE_NORMAL) {
+            key = createFontKey(family, Font.STYLE_NORMAL, weight);
+            f = getInternalFontKey(key);
+        }
+
+        if (f == null && weight != Font.WEIGHT_NORMAL) {
+            int diffWeight = (Font.WEIGHT_NORMAL - weight) / 100;
+            int direction = diffWeight > 0 ? 1 : -1;
+            int tryWeight = weight;
+            while (tryWeight != Font.WEIGHT_NORMAL) {
+                tryWeight += 100 * direction;
+                key = createFontKey(family, style, weight);
                 f = getInternalFontKey(key);
+                if (f == null) {
+                    key = createFontKey(family, Font.STYLE_NORMAL, weight);
+                    f = getInternalFontKey(key);
+                }
+                if (f != null) {
+                    break;
+                }
             }
         }
+        
+        // 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 (f == null) {
+            return doAdjustedLookup("any", style, weight, startKey, false);
+        }
+
+        // last resort: use default
+        if (f == null) {
+            key = Font.DEFAULT_FONT;
+            f = getInternalFontKey(key);
+        }
 
         if (f != null) {
-            if (key != startKey) {
-                notifyFontReplacement(startKey, key);
-            }
             return key;
         } else {
             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.)
@@ -438,6 +480,24 @@
             return triplet.getWeight();
         } else {
             return 0;
+        }
+    }
+    
+    /**
+     * Diagnostic method for logging all registered fonts to System.out. 
+     */
+    public void dumpAllTripletsToSystemOut() {
+        Collection entries = new java.util.TreeSet();
+        Iterator iter = this.triplets.keySet().iterator();
+        while (iter.hasNext()) {
+            FontTriplet triplet = (FontTriplet)iter.next();
+            String key = getInternalFontKey(triplet);
+            FontMetrics metrics = getMetricsFor(key); 
+            entries.add(triplet.toString() + " -> " + key + " -> " + metrics.getFontName());
+        }
+        iter = entries.iterator();
+        while (iter.hasNext()) {
+            System.out.println(iter.next());
         }
     }
 }

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontLoader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontLoader.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontLoader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontLoader.java Thu Nov  8 13:27:19 2007
@@ -1,186 +1,198 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.fonts;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.fop.fonts.truetype.TTFFontLoader;
-import org.apache.fop.fonts.type1.Type1FontLoader;
-
-/**
- * Base class for font loaders.
- */
-public abstract class FontLoader {
-
-    /**
-     * logging instance
-     */
-    protected static Log log = LogFactory.getLog(FontLoader.class);
-
-    /** URI representing the font file */
-    protected String fontFileURI = null;
-    /** the InputStream to load the font from */
-    protected InputStream in = null;
-    /** the FontResolver to use for font URI resolution */
-    protected FontResolver resolver = null;
-    /** the loaded font */
-    protected CustomFont returnFont = null;
-
-    /** true if the font has been loaded */
-    protected boolean loaded = false;
-
-    /**
-     * Default constructor.
-     * @param fontFileURI the URI to the PFB file of a Type 1 font
-     * @param in the InputStream reading the PFM file of a Type 1 font
-     * @param resolver the font resolver used to resolve URIs
-     */
-    public FontLoader(String fontFileURI, InputStream in, FontResolver resolver) {
-        this.fontFileURI = fontFileURI;
-        this.in = in;
-        this.resolver = resolver;
-    }
-
-    private static boolean isType1(String fontURI) {
-        return fontURI.toLowerCase().endsWith(".pfb");
-    }
-
-    /**
-     * Loads a custom font from a File. In the case of Type 1 fonts, the PFB file must be specified.
-     * @param fontFile the File representation of the font
-     * @param resolver the font resolver to use when resolving URIs
-     * @return the newly loaded font
-     * @throws IOException In case of an I/O error
-     */
-    public static CustomFont loadFont(File fontFile, FontResolver resolver)
-                throws IOException {
-        return loadFont(fontFile.getAbsolutePath(), resolver);
-    }
-        
-    /**
-     * Loads a custom font from a URI. In the case of Type 1 fonts, the PFB file must be specified.
-     * @param fontFileURI the URI to the font
-     * @param resolver the font resolver to use when resolving URIs
-     * @return the newly loaded font
-     * @throws IOException In case of an I/O error
-     */
-    public static CustomFont loadFont(String fontFileURI, FontResolver resolver)
-                throws IOException {
-        fontFileURI = fontFileURI.trim();
-        String name = fontFileURI.toLowerCase();
-        String effURI;
-        boolean type1 = isType1(fontFileURI);
-        if (type1) {
-            effURI = name.substring(0, fontFileURI.length() - 4) + ".pfm";
-        } else {
-            effURI = fontFileURI;
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("opening " + effURI);
-        }
-        InputStream in = openFontFile(resolver, effURI);
-        return loadFontFromInputStream(fontFileURI, resolver, type1, in);
-    }
-
-    /**
-     * Loads and returns a font given an input stream.
-     * @param fontFileURI font file uri
-     * @param resolver font resolver
-     * @param isType1 is it a type1 font?
-     * @param in input stream
-     * @return the loaded font.
-     * @throws IOException In case of an I/O error
-     */
-    protected static CustomFont loadFontFromInputStream(
-            String fontFileURI, FontResolver resolver, boolean isType1,
-            InputStream in)
-                throws IOException {
-        FontLoader loader;
-        try {
-            if (isType1) {
-                loader = new Type1FontLoader(fontFileURI, in, resolver);
-            } else {
-                loader = new TTFFontLoader(fontFileURI, in, resolver);
-            }
-            return loader.getFont();
-        } finally {
-            IOUtils.closeQuietly(in);
-        }
-    }
-
-    /**
-     * Opens a font file and returns an input stream.
-     * @param resolver the FontResolver to use for font URI resolution
-     * @param uri the URI representing the font
-     * @return the InputStream to read the font from.
-     * @throws IOException In case of an I/O error
-     * @throws MalformedURLException If an invalid URL is built
-     */
-    private static InputStream openFontFile(FontResolver resolver, String uri) 
-                    throws IOException, MalformedURLException {
-        InputStream in = null;
-        if (resolver != null) {
-            Source source = resolver.resolve(uri);
-            if (source == null) {
-                String err = "Cannot load font: failed to create Source for font file " 
-                    + uri; 
-                throw new IOException(err);
-            }
-            if (source instanceof StreamSource) {
-                in = ((StreamSource) source).getInputStream();
-            }
-            if (in == null && source.getSystemId() != null) {
-                in = new java.net.URL(source.getSystemId()).openStream();
-            }
-            if (in == null) {
-                String err = "Cannot load font: failed to create InputStream from"
-                    + " Source for font file " + uri; 
-                throw new IOException(err);
-            }
-        } else {
-            in = new URL(uri).openStream();
-        }
-        return in;
-    }
-        
-    /**
-     * Reads/parses the font data.
-     * @throws IOException In case of an I/O error
-     */
-    protected abstract void read() throws IOException;
-
-    /** @see FontLoader#getFont() */
-    public CustomFont getFont() throws IOException {
-        if (!loaded) {
-            read();
-        }
-        return this.returnFont;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.fonts;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.fonts.truetype.TTFFontLoader;
+import org.apache.fop.fonts.type1.Type1FontLoader;
+
+/**
+ * Base class for font loaders.
+ */
+public abstract class FontLoader {
+
+    /**
+     * logging instance
+     */
+    protected static Log log = LogFactory.getLog(FontLoader.class);
+
+    /** URI representing the font file */
+    protected String fontFileURI = null;
+    /** the InputStream to load the font from */
+    protected InputStream in = null;
+    /** the FontResolver to use for font URI resolution */
+    protected FontResolver resolver = null;
+    /** the loaded font */
+    protected CustomFont returnFont = null;
+
+    /** true if the font has been loaded */
+    protected boolean loaded = false;
+
+    /**
+     * Default constructor.
+     * @param fontFileURI the URI to the PFB file of a Type 1 font
+     * @param in the InputStream reading the PFM file of a Type 1 font
+     * @param resolver the font resolver used to resolve URIs
+     */
+    public FontLoader(String fontFileURI, InputStream in, FontResolver resolver) {
+        this.fontFileURI = fontFileURI;
+        this.in = in;
+        this.resolver = resolver;
+    }
+
+    private static boolean isType1(String fontURI) {
+        return fontURI.toLowerCase().endsWith(".pfb");
+    }
+
+    /**
+     * Loads a custom font from a File. In the case of Type 1 fonts, the PFB file must be specified.
+     * @param fontFile the File representation of the font
+     * @param resolver the font resolver to use when resolving URIs
+     * @return the newly loaded font
+     * @throws IOException In case of an I/O error
+     */
+    public static CustomFont loadFont(File fontFile, FontResolver resolver)
+                throws IOException {
+        return loadFont(fontFile.getAbsolutePath(), resolver);
+    }
+
+    /**
+     * Loads a custom font from an URL. In the case of Type 1 fonts, the PFB file must be specified.
+     * @param fontUrl the URL representation of the font
+     * @param resolver the font resolver to use when resolving URIs
+     * @return the newly loaded font
+     * @throws IOException In case of an I/O error
+     */
+    public static CustomFont loadFont(URL fontUrl, FontResolver resolver)
+                throws IOException {
+        return loadFont(fontUrl.toExternalForm(), resolver);
+    }
+    
+    
+    /**
+     * Loads a custom font from a URI. In the case of Type 1 fonts, the PFB file must be specified.
+     * @param fontFileURI the URI to the font
+     * @param resolver the font resolver to use when resolving URIs
+     * @return the newly loaded font
+     * @throws IOException In case of an I/O error
+     */
+    public static CustomFont loadFont(String fontFileURI, FontResolver resolver)
+                throws IOException {
+        fontFileURI = fontFileURI.trim();
+        String effURI;
+        boolean type1 = isType1(fontFileURI);
+        if (type1) {
+            effURI = fontFileURI.substring(0, fontFileURI.length() - 4) + ".pfm";
+        } else {
+            effURI = fontFileURI;
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("opening " + effURI);
+        }
+        InputStream in = openFontUri(resolver, effURI);
+        return loadFontFromInputStream(fontFileURI, resolver, type1, in);
+    }
+
+    /**
+     * Loads and returns a font given an input stream.
+     * @param fontFileURI font file uri
+     * @param resolver font resolver
+     * @param isType1 is it a type1 font?
+     * @param in input stream
+     * @return the loaded font.
+     * @throws IOException In case of an I/O error
+     */
+    protected static CustomFont loadFontFromInputStream(
+            String fontFileURI, FontResolver resolver, boolean isType1,
+            InputStream in)
+                throws IOException {
+        FontLoader loader;
+        try {
+            if (isType1) {
+                loader = new Type1FontLoader(fontFileURI, in, resolver);
+            } else {
+                loader = new TTFFontLoader(fontFileURI, in, resolver);
+            }
+            return loader.getFont();
+        } finally {
+            IOUtils.closeQuietly(in);
+        }
+    }
+
+    /**
+     * Opens a font uri and returns an input stream.
+     * @param resolver the FontResolver to use for font URI resolution
+     * @param uri the URI representing the font
+     * @return the InputStream to read the font from.
+     * @throws IOException In case of an I/O error
+     * @throws MalformedURLException If an invalid URL is built
+     */
+    private static InputStream openFontUri(FontResolver resolver, String uri) 
+                    throws IOException, MalformedURLException {
+        InputStream in = null;
+        if (resolver != null) {
+            Source source = resolver.resolve(uri);
+            if (source == null) {
+                String err = "Cannot load font: failed to create Source for font file " 
+                    + uri; 
+                throw new IOException(err);
+            }
+            if (source instanceof StreamSource) {
+                in = ((StreamSource) source).getInputStream();
+            }
+            if (in == null && source.getSystemId() != null) {
+                in = new java.net.URL(source.getSystemId()).openStream();
+            }
+            if (in == null) {
+                String err = "Cannot load font: failed to create InputStream from"
+                    + " Source for font file " + uri; 
+                throw new IOException(err);
+            }
+        } else {
+            in = new URL(uri).openStream();
+        }
+        return in;
+    }
+        
+    /**
+     * Reads/parses the font data.
+     * @throws IOException In case of an I/O error
+     */
+    protected abstract void read() throws IOException;
+
+    /** @see FontLoader#getFont() */
+    public CustomFont getFont() throws IOException {
+        if (!loaded) {
+            read();
+        }
+        return this.returnFont;
+    }
+}

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontMetrics.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontMetrics.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontMetrics.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontMetrics.java Thu Nov  8 13:27:19 2007
@@ -20,6 +20,7 @@
 package org.apache.fop.fonts;
 
 import java.util.Map;
+import java.util.Set;
 
 
 /**
@@ -28,11 +29,28 @@
 public interface FontMetrics {
 
     /**
-     * Returns the font name.
+     * Returns the "PostScript" font name (Example: "Helvetica-BoldOblique").
      * @return the font name
      */
     String getFontName();
     
+    /**
+     * Returns the font's full name (Example: "Helvetica Bold Oblique").
+     * @return the font's full name
+     */
+    String getFullName();
+    
+    /**
+     * Returns the font's family names as a Set of Strings (Example: "Helvetica").
+     * @return the font's family names (a Set of Strings)
+     */
+    Set getFamilyNames();
+    
+    /**
+     * Returns the font name for font embedding (may include a prefix, Example: "1E28bcArialMT").
+     * @return the name for font embedding
+     */
+    String getEmbedFontName();
     
     /**
      * Returns the type of the font.

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontReader.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontReader.java Thu Nov  8 13:27:19 2007
@@ -20,23 +20,21 @@
 package org.apache.fop.fonts;
 
 //Java
+import java.io.IOException;
 import java.util.List;
 import java.util.Map;
-import java.io.IOException;
+import java.util.Set;
 
 import javax.xml.parsers.SAXParserFactory;
 
-//SAX
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.DefaultHandler;
-
-//FOP
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fonts.apps.TTFReader;
+import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
 
 /**
  * Class for reading a metric.xml file and creating a font object.
@@ -229,6 +227,12 @@
         String content = text.toString().trim();
         if ("font-name".equals(localName)) {
             returnFont.setFontName(content);
+        } else if ("full-name".equals(localName)) {
+            multiFont.setFullName(content);
+        } else if ("family-name".equals(localName)) {
+            Set s = new java.util.HashSet();
+            s.add(content);
+            multiFont.setFamilyNames(s);
         } else if ("ttc-name".equals(localName) && isCID) {
             multiFont.setTTCName(content);
         } else if ("encoding".equals(localName)) {

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontSetup.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontSetup.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontSetup.java Thu Nov  8 13:27:19 2007
@@ -20,31 +20,28 @@
 package org.apache.fop.fonts;
 
 // FOP (base 14 fonts)
+import java.util.List;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.fonts.base14.Courier;
+import org.apache.fop.fonts.base14.CourierBold;
+import org.apache.fop.fonts.base14.CourierBoldOblique;
+import org.apache.fop.fonts.base14.CourierOblique;
 import org.apache.fop.fonts.base14.Helvetica;
 import org.apache.fop.fonts.base14.HelveticaBold;
-import org.apache.fop.fonts.base14.HelveticaOblique;
 import org.apache.fop.fonts.base14.HelveticaBoldOblique;
-import org.apache.fop.fonts.base14.TimesRoman;
+import org.apache.fop.fonts.base14.HelveticaOblique;
+import org.apache.fop.fonts.base14.Symbol;
 import org.apache.fop.fonts.base14.TimesBold;
-import org.apache.fop.fonts.base14.TimesItalic;
 import org.apache.fop.fonts.base14.TimesBoldItalic;
-import org.apache.fop.fonts.base14.Courier;
-import org.apache.fop.fonts.base14.CourierBold;
-import org.apache.fop.fonts.base14.CourierOblique;
-import org.apache.fop.fonts.base14.CourierBoldOblique;
-import org.apache.fop.fonts.base14.Symbol;
+import org.apache.fop.fonts.base14.TimesItalic;
+import org.apache.fop.fonts.base14.TimesRoman;
 import org.apache.fop.fonts.base14.ZapfDingbats;
 
-// commons logging
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-// Java
-import java.util.List;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
 /**
  * Default fonts for FOP application; currently this uses PDF's fonts
  * by default.
@@ -121,6 +118,12 @@
         fontInfo.addFontProperties("F3", "sans-serif", "normal", Font.WEIGHT_BOLD);
         fontInfo.addFontProperties("F4", "sans-serif", "oblique", Font.WEIGHT_BOLD);
         fontInfo.addFontProperties("F4", "sans-serif", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F1", "SansSerif", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "SansSerif", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F2", "SansSerif", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F3", "SansSerif", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "SansSerif", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F4", "SansSerif", "italic", Font.WEIGHT_BOLD);
         fontInfo.addFontProperties("F5", "serif", "normal", Font.WEIGHT_NORMAL);
         fontInfo.addFontProperties("F6", "serif", "oblique", Font.WEIGHT_NORMAL);
         fontInfo.addFontProperties("F6", "serif", "italic", Font.WEIGHT_NORMAL);
@@ -133,6 +136,12 @@
         fontInfo.addFontProperties("F11", "monospace", "normal", Font.WEIGHT_BOLD);
         fontInfo.addFontProperties("F12", "monospace", "oblique", Font.WEIGHT_BOLD);
         fontInfo.addFontProperties("F12", "monospace", "italic", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F9", "Monospaced", "normal", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "Monospaced", "oblique", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F10", "Monospaced", "italic", Font.WEIGHT_NORMAL);
+        fontInfo.addFontProperties("F11", "Monospaced", "normal", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "Monospaced", "oblique", Font.WEIGHT_BOLD);
+        fontInfo.addFontProperties("F12", "Monospaced", "italic", Font.WEIGHT_BOLD);
 
         fontInfo.addFontProperties("F1", "Helvetica", "normal", Font.WEIGHT_NORMAL);
         fontInfo.addFontProperties("F2", "Helvetica", "oblique", Font.WEIGHT_NORMAL);
@@ -220,9 +229,6 @@
             for (int c = 0; c < triplets.size(); c++) {
                 FontTriplet triplet = (FontTriplet) triplets.get(c);
 
-                if (log.isDebugEnabled()) {
-                    log.debug("Registering: " + triplet + " under " + internalName);
-                }
                 fontInfo.addFontProperties(internalName, triplet);
             }
         }

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontUtil.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/FontUtil.java Thu Nov  8 13:27:19 2007
@@ -76,5 +76,59 @@
         return sb.toString();
     }
 
+    /** font constituent names which identify a font as being of "italic" style */
+    private static final String[] ITALIC_WORDS = {"italic", "oblique"};
+
+    /** font constituent names which identify a font as being of "light" weight */
+    private static final String[] LIGHT_WORDS = {"light"};
+    /** 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 "bold" weight */
+    private static final String[] EXTRA_BOLD_WORDS = {"extrabold", "black", 
+        "heavy", "ultra", "super"};
+
+    /**
+     * Guesses the font style of a font using its name.
+     * @param fontName the font name
+     * @return "normal" or "italic"
+     */
+    public static String guessStyle(String fontName) {
+        for (int i = 0; i < ITALIC_WORDS.length; i++) {
+            if (fontName.indexOf(ITALIC_WORDS[i]) != -1) {
+                return Font.STYLE_ITALIC;          
+            }
+        }
+        return Font.STYLE_NORMAL;
+    }
+
+    /**
+     * Guesses the font weight of a font using its name.
+     * @param fontName the font name
+     * @return an integer between 100 and 900
+     */
+    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 < 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_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/LazyFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/LazyFont.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/LazyFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/LazyFont.java Thu Nov  8 13:27:19 2007
@@ -22,6 +22,8 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.Map;
+import java.util.Set;
+
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 
@@ -166,6 +168,14 @@
     /**
      * {@inheritDoc}
      */
+    public boolean hadMappingOperations() {
+        load(true);
+        return realFont.hadMappingOperations();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasChar(char c) {
         load(true);
         return realFont.hasChar(c);
@@ -180,14 +190,30 @@
     }
 
     // ---- FontMetrics interface ----
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public String getFontName() {
         load(true);
         return realFont.getFontName();
     }
 
+    /** {@inheritDoc} */
+    public String getEmbedFontName() {
+        load(true);
+        return realFont.getEmbedFontName();
+    }
+
+    /** {@inheritDoc} */
+    public String getFullName() {
+        load(true);
+        return realFont.getFullName();
+    }
+
+    /** {@inheritDoc} */
+    public Set getFamilyNames() {
+        load(true);
+        return realFont.getFamilyNames();
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -332,5 +358,6 @@
         load(true);
         return realFontDescriptor.isEmbeddable();
     }
+
 }
 

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MultiByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MultiByteFont.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MultiByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MultiByteFont.java Thu Nov  8 13:27:19 2007
@@ -20,6 +20,7 @@
 package org.apache.fop.fonts;
 
 //Java
+import java.text.DecimalFormat;
 import java.util.Map;
 
 /**
@@ -27,8 +28,8 @@
  */
 public class MultiByteFont extends CIDFont {
 
-    private static int uniqueCounter = 1;
-
+    private static int uniqueCounter = -1;
+    private static final DecimalFormat COUNTER_FORMAT = new DecimalFormat("00000");
 
     private String ttcName = null;
     private String encoding = "Identity-H";
@@ -54,14 +55,24 @@
         usedGlyphs.put(new Integer(2), new Integer(2));
         usedGlyphsIndex.put(new Integer(2), new Integer(2));
         usedGlyphsCount++;
-
+        
         // Create a quasiunique prefix for fontname
-        int cnt = 0;
         synchronized (this.getClass()) {
-            cnt = uniqueCounter++;
+            uniqueCounter++;
+            if (uniqueCounter > 99999 || uniqueCounter < 0) {
+                uniqueCounter = 0; //We need maximum 5 character then we start again
+            }
         }
-        int ctm = (int)(System.currentTimeMillis() & 0xffff);
-        namePrefix = new String(cnt + "E" + Integer.toHexString(ctm));
+        String cntString = COUNTER_FORMAT.format(uniqueCounter);
+        
+        //Subset prefix as described in chapter 5.5.3 of PDF 1.4
+        StringBuffer sb = new StringBuffer("E");
+        for (int i = 0, c = cntString.length(); i < c; i++) {
+            //translate numbers to uppercase characters
+            sb.append((char)(cntString.charAt(i) + (65 - 48)));
+        }
+        sb.append("+");
+        namePrefix = sb.toString();
 
         setFontType(FontType.TYPE0);
     }
@@ -113,10 +124,8 @@
         return namePrefix + FontUtil.stripWhiteSpace(super.getFontName());
     }
     
-    /**
-     * {@inheritDoc}
-     */
-    public String getCidBaseFont() {
+    /** {@inheritDoc} */
+    public String getEmbedFontName() {
         if (isEmbeddable()) {
             return getPrefixedFontName();
         } else {
@@ -139,17 +148,6 @@
     }
 
     /**
-     * {@inheritDoc}
-     */
-    public String getFontName() {
-        if (isEmbeddable()) {
-            return getPrefixedFontName();
-        } else {
-            return super.getFontName();
-        }
-    }
-
-    /**
      * {@inheritDoc} 
      */
     public int getWidth(int i, int size) {
@@ -214,6 +212,7 @@
      * {@inheritDoc}
      */
     public char mapChar(char c) {
+        notifyMapOperation();
         int retIdx = findGlyphIndex(c);
 
         if (isEmbeddable()) {

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MutableFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MutableFont.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MutableFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/MutableFont.java Thu Nov  8 13:27:19 2007
@@ -20,6 +20,7 @@
 package org.apache.fop.fonts;
 
 import java.util.Map;
+import java.util.Set;
 
 
 /**
@@ -28,10 +29,23 @@
 public interface MutableFont {
 
     /**
-     * Sets the font name.
+     * Sets the "PostScript" font name (Example: "Helvetica-BoldOblique").
      * @param name font name
      */
     void setFontName(String name);
+    
+    /**
+     * Sets the font's full name (usually the one that the operating system displays). Example:
+     * "Helvetica Bold Oblique".
+     * @param name font' full name
+     */
+    void setFullName(String name);
+
+    /**
+     * Sets the font's family names (Example: "Helvetica").
+     * @param name the font's family names (a Set of Strings)
+     */
+    void setFamilyNames(Set names);
     
     /**
      * Sets the path to the embeddable font file.

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/SingleByteFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/SingleByteFont.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/SingleByteFont.java Thu Nov  8 13:27:19 2007
@@ -47,7 +47,11 @@
      * Updates the mapping variable based on the encoding.
      */
     protected void updateMapping() {
-        mapping = CodePointMapping.getMapping(getEncoding()); 
+        try {
+            mapping = CodePointMapping.getMapping(getEncoding());
+        } catch (UnsupportedOperationException e) {
+            log.error("Font '" + super.getFontName() + "': " + e.getMessage());
+        }
     }
     
     /**
@@ -94,6 +98,7 @@
      * {@inheritDoc}
      */
     public char mapChar(char c) {
+        notifyMapOperation();
         char d = mapping.mapChar(c);
         if (d != 0) {
             return d;
@@ -125,8 +130,5 @@
         this.width[index] = width;
     }
 
-    public char[] getCharsUsed() {
-        return null;
-    }
 }
 

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/Typeface.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/Typeface.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/Typeface.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/Typeface.java Thu Nov  8 13:27:19 2007
@@ -28,6 +28,12 @@
 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.
+     */
+    private long charMapOps = 0;
+    
+    /**
      * Get the encoding of the font.
      * @return the encoding
      */
@@ -39,6 +45,23 @@
      * @return the mapped character
      */
     public abstract char mapChar(char c);
+
+    /**
+     * Used for keeping track of character mapping operations in order to determine if a font
+     * was used at all or not.
+     */
+    protected void notifyMapOperation() {
+        this.charMapOps++;
+    }
+    
+    /**
+     * Indicates whether this font had to do any character mapping operations. If that was 
+     * not the case, it's an indication that the font has never actually been used.
+     * @return true if the font had to do any character mapping operations
+     */
+    public boolean hadMappingOperations() {
+        return (this.charMapOps > 0);
+    }
 
     /**
      * Determines whether this font contains a particular character/glyph.

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/apps/TTFReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/apps/TTFReader.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/apps/TTFReader.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/apps/TTFReader.java Thu Nov  8 13:27:19 2007
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
@@ -209,7 +210,7 @@
         if (!supported) {
             return null;
         }
-        log.info("Font Family: " + ttfFile.getFamilyName());
+        log.info("Font Family: " + ttfFile.getFamilyNames());
         if (ttfFile.isCFF()) {
             throw new UnsupportedOperationException(
                     "OpenType fonts with CFF data are not supported, yet");
@@ -265,6 +266,18 @@
             el.appendChild(doc.createTextNode(FontUtil.stripWhiteSpace(fontName)));
         } else {
             el.appendChild(doc.createTextNode(s));
+        }
+        if (ttf.getFullName() != null) {
+            el = doc.createElement("full-name");
+            root.appendChild(el);
+            el.appendChild(doc.createTextNode(ttf.getFullName()));
+        }
+        Set familyNames = ttf.getFamilyNames();
+        if (familyNames.size() > 0) {
+            String familyName = (String)familyNames.iterator().next(); 
+            el = doc.createElement("family-name");
+            root.appendChild(el);
+            el.appendChild(doc.createTextNode(familyName));
         }
 
         el = doc.createElement("embed");

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontFileFinder.java Thu Nov  8 13:27:19 2007
@@ -21,14 +21,16 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
 import org.apache.commons.io.DirectoryWalker;
+import org.apache.commons.io.IOCase;
 import org.apache.commons.io.filefilter.FileFilterUtils;
 import org.apache.commons.io.filefilter.IOFileFilter;
-import org.apache.commons.io.filefilter.SuffixFileFilter;
+import org.apache.commons.io.filefilter.WildcardFileFilter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -76,7 +78,7 @@
     protected static IOFileFilter getFileFilter() {
         return FileFilterUtils.andFileFilter(
                 FileFilterUtils.fileFileFilter(),
-                new SuffixFileFilter(new String[] {".ttf", ".otf", ".pfb"})
+                new WildcardFileFilter(new String[] {"*.ttf", "*.otf", "*.pfb"}, IOCase.INSENSITIVE)
                 //TODO Add *.ttc when support for it has been added to the auto-detection mech.
         );
     }
@@ -99,13 +101,18 @@
      * {@inheritDoc} 
      */
     protected void handleFile(File file, int depth, Collection results) {
-        results.add(file);
+        try {
+            // Looks Strange, but is actually recommended over just .URL()
+            results.add(file.toURI().toURL());
+        } catch (MalformedURLException e) {
+            log.debug("MalformedURLException" + e.getMessage());
+        }
     }
       
     /**
      * @param directory the directory being processed
      * @param depth the current directory level
-     * @param results the colleciton of results objects
+     * @param results the collection of results objects
      * {@inheritDoc}
      */
     protected void handleDirectoryEnd(File directory, int depth, Collection results) {
@@ -118,7 +125,7 @@
     /**
      * Automagically finds a list of font files on local system
      * 
-     * @return list of font files
+     * @return List&lt;URL&gt; of font files
      * @throws IOException io exception
      * {@inheritDoc}
      */
@@ -137,7 +144,8 @@
         List fontDirs = fontDirFinder.find();
         List results = new java.util.ArrayList();
         for (Iterator iter = fontDirs.iterator(); iter.hasNext();) {
-            super.walk((File)iter.next(), results);
+            final File dir = (File)iter.next();
+            super.walk(dir, results);
         }
         return results;
     }

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontFinder.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontFinder.java Thu Nov  8 13:27:19 2007
@@ -30,8 +30,12 @@
     
     /**
      * Finds a list of font files.
-     * @return list of font files
-     * @throws IOException In case of an I/O problem
+     * 
+     * @return list of font files. List&lt;URL&gt; in the case of the
+     *         FontFinder, and List&lt;File&gt; in the case of the
+     *         FonrDirFinders.
+     * @throws IOException
+     *             In case of an I/O problem
      */
     List find() throws IOException;
     

Modified: xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java?rev=593328&r1=593327&r2=593328&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java (original)
+++ xmlgraphics/fop/branches/Temp_Interleaved_Page_Line_Breaking/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java Thu Nov  8 13:27:19 2007
@@ -19,9 +19,12 @@
 
 package org.apache.fop.fonts.autodetect;
 
-import java.io.File;
-import java.net.MalformedURLException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -33,6 +36,7 @@
 import org.apache.fop.fonts.FontLoader;
 import org.apache.fop.fonts.FontResolver;
 import org.apache.fop.fonts.FontTriplet;
+import org.apache.fop.fonts.FontUtil;
 
 /**
  * Attempts to determine correct FontInfo
@@ -42,70 +46,73 @@
     /** logging instance */
     private Log log = LogFactory.getLog(FontInfoFinder.class);
 
-    /** font constituent names which identify a font as being of "italic" style */
-    private static final String[] ITALIC_WORDS = {"italic", "oblique"};
-
-    /** font constituent names which identify a font as being of "bold" weight */
-    private static final String[] BOLD_WORDS = {"bold", "black", "heavy", "ultra", "super"};
-
     /**
-     * Attempts to determine FontTriplet from a given CustomFont.
+     * Attempts to determine FontTriplets from a given CustomFont.
      * It seems to be fairly accurate but will probably require some tweaking over time
      * 
      * @param customFont CustomFont
-     * @return newly created font triplet
+     * @param triplet Collection that will take the generated triplets
      */
-    private FontTriplet tripletFromFont(CustomFont customFont) {
+    private void generateTripletsFromFont(CustomFont customFont, Collection triplets) {
+        if (log.isTraceEnabled()) {
+            log.trace("Font: " + customFont.getFullName() 
+                    + ", family: " + customFont.getFamilyNames() 
+                    + ", PS: " + customFont.getFontName() 
+                    + ", EmbedName: " + customFont.getEmbedFontName());
+        }
+
         // default style and weight triplet vales (fallback)
-        String name = customFont.getStrippedFontName();
+        String strippedName = customFont.getStrippedFontName();
         String subName = customFont.getFontSubName();
-        String searchName = name.toLowerCase();
+        String searchName = strippedName.toLowerCase();
         if (subName != null) {
             searchName += subName.toLowerCase();
         }
         
+        String style = guessStyle(customFont, searchName);
+        int weight = FontUtil.guessWeight(searchName);
+
+        //Full Name usually includes style/weight info so don't use these traits
+        //If we still want to use these traits, we have to make FontInfo.fontLookup() smarter
+        String fullName = customFont.getFullName();
+        triplets.add(new FontTriplet(fullName, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL));
+        if (!fullName.equals(strippedName)) {
+            triplets.add(new FontTriplet(strippedName, Font.STYLE_NORMAL, Font.WEIGHT_NORMAL));
+        }
+        Set familyNames = customFont.getFamilyNames();
+        Iterator iter = familyNames.iterator();
+        while (iter.hasNext()) {
+            String familyName = (String)iter.next();
+            if (!fullName.equals(familyName)) {
+                triplets.add(new FontTriplet(familyName, style, weight));
+            }
+        }
+    }
+
+    private String guessStyle(CustomFont customFont, String fontName) {
         // style
         String style = Font.STYLE_NORMAL;
         if (customFont.getItalicAngle() > 0) {
             style = Font.STYLE_ITALIC;  
         } else {
-            for (int i = 0; i < ITALIC_WORDS.length; i++) {
-                if (searchName.indexOf(ITALIC_WORDS[i]) != -1) {
-                    style = Font.STYLE_ITALIC;          
-                    break;
-                }
-            }
+            style = FontUtil.guessStyle(fontName);
         }
-        
-        // weight
-        int weight = Font.WEIGHT_NORMAL;
-        for (int i = 0; i < BOLD_WORDS.length; i++) {
-            if (searchName.indexOf(BOLD_WORDS[i]) != -1) {
-                weight = Font.WEIGHT_BOLD;
-                break;
-            }            
-        }
-        return new FontTriplet(name, style, weight);
+        return style;
     }
     
     /**
      * Attempts to determine FontInfo from a given custom font
-     * @param fontFile the font file
+     * @param fontUrl the font URL
      * @param customFont the custom font
      * @param fontCache font cache (may be null)
      * @return
      */
     private EmbedFontInfo fontInfoFromCustomFont(
-            File fontFile, CustomFont customFont, FontCache fontCache) {
-        FontTriplet fontTriplet = tripletFromFont(customFont);
+            URL fontUrl, CustomFont customFont, FontCache fontCache) {
         List fontTripletList = new java.util.ArrayList();
-        fontTripletList.add(fontTriplet);
+        generateTripletsFromFont(customFont, fontTripletList);
         String embedUrl;
-        try {
-            embedUrl = fontFile.toURL().toExternalForm();
-        } catch (MalformedURLException e) {
-            embedUrl = fontFile.getAbsolutePath();
-        }
+        embedUrl = fontUrl.toExternalForm();
         EmbedFontInfo fontInfo = new EmbedFontInfo(null, customFont.isKerningEnabled(),
                 fontTripletList, embedUrl);
         if (fontCache != null) {
@@ -117,23 +124,24 @@
     /**
      * Attempts to determine EmbedFontInfo from a given font file.
      * 
-     * @param fontFile font file
+     * @param fontUrl font URL. Assumed to be local.
      * @param resolver font resolver used to resolve font
      * @param fontCache font cache (may be null)
      * @return newly created embed font info
      */
-    public EmbedFontInfo find(File fontFile, FontResolver resolver, FontCache fontCache) {
+    public EmbedFontInfo find(URL fontUrl, FontResolver resolver, FontCache fontCache) {
         String embedUrl = null;
-        try {
-            embedUrl = fontFile.toURL().toExternalForm();
-        } catch (MalformedURLException mfue) {
-            // should never happen
-            log.error("Failed to convert '" + fontFile + "' to URL: " + mfue.getMessage() );
-        }
+        embedUrl = fontUrl.toExternalForm();
         
         long fileLastModified = -1;
         if (fontCache != null) {
-            fileLastModified = fontFile.lastModified();
+            try {
+                fileLastModified = fontUrl.openConnection().getLastModified();
+            } catch (IOException e) {
+                // Should never happen, because URL must be local
+                log.debug("IOError: " + e.getMessage());
+                fileLastModified = 0;
+            }
             // firstly try and fetch it from cache before loading/parsing the font file
             if (fontCache.containsFont(embedUrl)) {
                 CachedFontInfo fontInfo = fontCache.getFont(embedUrl);
@@ -155,7 +163,7 @@
         // try to determine triplet information from font file
         CustomFont customFont = null;
         try {
-            customFont = FontLoader.loadFont(fontFile, resolver);
+            customFont = FontLoader.loadFont(fontUrl, resolver);
         } catch (Exception e) {
             //TODO Too verbose (it's an error but we don't care if some fonts can't be loaded)
             if (log.isErrorEnabled()) {
@@ -166,6 +174,6 @@
             }
             return null;
         }
-        return fontInfoFromCustomFont(fontFile, customFont, fontCache);     
+        return fontInfoFromCustomFont(fontUrl, customFont, fontCache);     
     }
 }



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