xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r1002550 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/svg: AbstractFOPTranscoder.java PDFDocumentGraphics2DConfigurator.java PDFTranscoder.java
Date Wed, 29 Sep 2010 10:01:21 GMT
Author: jeremias
Date: Wed Sep 29 10:01:21 2010
New Revision: 1002550

URL: http://svn.apache.org/viewvc?rev=1002550&view=rev
Log:
Added support for font substitutions on PDF/PSTranscoder by configuring the FontManager.
Restored configuration support for the (E)PSTranscoder.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java?rev=1002550&r1=1002549&r2=1002550&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/AbstractFOPTranscoder.java Wed Sep 29
10:01:21 2010
@@ -29,6 +29,7 @@ import org.w3c.dom.DOMImplementation;
 
 import org.xml.sax.EntityResolver;
 
+import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
@@ -55,7 +56,7 @@ import org.apache.xmlgraphics.image.load
 /**
  * This is the common base class of all of FOP's transcoders.
  */
-public abstract class AbstractFOPTranscoder extends SVGAbstractTranscoder {
+public abstract class AbstractFOPTranscoder extends SVGAbstractTranscoder implements Configurable
{
 
     /**
      * The key is used to specify the resolution for on-the-fly images generated

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java?rev=1002550&r1=1002549&r2=1002550&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
(original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java
Wed Sep 29 10:01:21 2010
@@ -25,12 +25,15 @@ import org.apache.avalon.framework.confi
 import org.apache.avalon.framework.configuration.ConfigurationException;
 
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.fonts.CustomFontCollection;
+import org.apache.fop.fonts.FontCollection;
 import org.apache.fop.fonts.FontEventListener;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.fonts.FontInfoConfigurator;
 import org.apache.fop.fonts.FontManager;
+import org.apache.fop.fonts.FontManagerConfigurator;
 import org.apache.fop.fonts.FontResolver;
-import org.apache.fop.fonts.FontSetup;
+import org.apache.fop.fonts.base14.Base14FontCollection;
 import org.apache.fop.pdf.PDFDocument;
 import org.apache.fop.render.pdf.PDFRendererConfigurator;
 
@@ -70,29 +73,30 @@ public class PDFDocumentGraphics2DConfig
      */
     public static FontInfo createFontInfo(Configuration cfg) throws FOPException {
         FontInfo fontInfo = new FontInfo();
+        final boolean strict = false;
+        FontResolver fontResolver = FontManager.createMinimalFontResolver();
+        //TODO The following could be optimized by retaining the FontManager somewhere
+        FontManager fontManager = new FontManager();
         if (cfg != null) {
-            FontResolver fontResolver = FontManager.createMinimalFontResolver();
-            //TODO The following could be optimized by retaining the FontManager somewhere
-            FontManager fontManager = new FontManager();
+            FontManagerConfigurator fmConfigurator = new FontManagerConfigurator(cfg);
+            fmConfigurator.configure(fontManager, strict);
+        }
 
-            //TODO Make use of fontBaseURL, font substitution and referencing configuration
-            //Requires a change to the expected configuration layout
+        List fontCollections = new java.util.ArrayList();
+        fontCollections.add(new Base14FontCollection(fontManager.isBase14KerningEnabled()));
 
+        if (cfg != null) {
             //TODO Wire in the FontEventListener
-            final FontEventListener listener = null;
-            final boolean strict = false;
+            FontEventListener listener = null; //new FontEventAdapter(eventBroadcaster);
             FontInfoConfigurator fontInfoConfigurator
                 = new FontInfoConfigurator(cfg, fontManager, fontResolver, listener, strict);
             List/*<EmbedFontInfo>*/ fontInfoList = new java.util.ArrayList/*<EmbedFontInfo>*/();
             fontInfoConfigurator.configure(fontInfoList);
-
-            if (fontManager.useCache()) {
-                fontManager.getFontCache().save();
-            }
-            FontSetup.setup(fontInfo, fontInfoList, fontResolver);
-        } else {
-            FontSetup.setup(fontInfo);
+            fontCollections.add(new CustomFontCollection(fontResolver, fontInfoList));
         }
+        fontManager.setup(fontInfo,
+                (FontCollection[])fontCollections.toArray(
+                        new FontCollection[fontCollections.size()]));
         return fontInfo;
     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java?rev=1002550&r1=1002549&r2=1002550&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFTranscoder.java Wed Sep 29 10:01:21
2010
@@ -27,7 +27,6 @@ import java.io.OutputStream;
 import org.w3c.dom.Document;
 import org.w3c.dom.svg.SVGLength;
 
-import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.batik.bridge.BridgeContext;
 import org.apache.batik.bridge.UnitProcessor;
@@ -73,8 +72,7 @@ import org.apache.fop.fonts.FontInfo;
  * @author <a href="mailto:keiron@aftexsw.com">Keiron Liddle</a>
  * @version $Id$
  */
-public class PDFTranscoder extends AbstractFOPTranscoder
-        implements Configurable {
+public class PDFTranscoder extends AbstractFOPTranscoder {
 
     /** Graphics2D instance that is used to paint to */
     protected PDFDocumentGraphics2D graphics = null;



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


Mime
View raw message