]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Tidy up.
authorAdrian Cumiskey <acumiskey@apache.org>
Mon, 21 Jul 2008 09:21:11 +0000 (09:21 +0000)
committerAdrian Cumiskey <acumiskey@apache.org>
Mon, 21 Jul 2008 09:21:11 +0000 (09:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@678371 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
src/java/org/apache/fop/render/afp/fonts/AFPFontCollection.java
src/java/org/apache/fop/render/afp/fonts/AFPFontInfo.java
src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
src/java/org/apache/fop/render/afp/modca/AbstractResourceGroupContainer.java

index 30d59c4aede17bb7eed0c85a40086fdbf0ed75b4..3b3a1c522c18989c244eb37eee5712f986b8cdbe 100644 (file)
@@ -57,16 +57,17 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator {
         throws ConfigurationException {
 
         Configuration[] triple = fontCfg.getChildren("font-triplet");
-        List tripleList = new java.util.ArrayList();
+        List/*<FontTriplet>*/ tripletList = new java.util.ArrayList();
         if (triple.length == 0) {
             log.error("Mandatory font configuration element '<font-triplet...' is missing");
             return null;
         }
         for (int j = 0; j < triple.length; j++) {
             int weight = FontUtil.parseCSS2FontWeight(triple[j].getAttribute("weight"));
-            tripleList.add(new FontTriplet(triple[j].getAttribute("name"),
-                                           triple[j].getAttribute("style"),
-                                           weight));
+            FontTriplet triplet = new FontTriplet(triple[j].getAttribute("name"),
+                    triple[j].getAttribute("style"),
+                    weight);
+            tripletList.add(triplet);
         }
 
         //build the fonts
@@ -140,7 +141,7 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator {
                         codepage, encoding, characterset, path));
                 }
             }
-            return new AFPFontInfo(font, tripleList);
+            return new AFPFontInfo(font, tripletList);
 
         } else if ("outline".equalsIgnoreCase(type)) {
             String characterset = afpFontCfg.getAttribute("characterset");
@@ -174,7 +175,7 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator {
             }
             // Create a new font object
             OutlineFont font = new OutlineFont(name, characterSet);
-            return new AFPFontInfo(font, tripleList);
+            return new AFPFontInfo(font, tripletList);
         } else {
             log.error("No or incorrect type attribute");
         }
@@ -244,16 +245,6 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator {
                 afpRenderer.setResolution(rendererResolutionCfg.getValueAsInteger(240));
             }
 
-            // TODO: provide support for different MO:DCA interchange sets
-            // the MO:DCA interchange set in use (defaults to MO:DCA-L)
-//            Configuration modcaCfg = cfg.getChild("modca", false);
-//            if (modcaCfg != null) {
-//                String interchangeSetString = cfg.getAttribute(
-//                        "interchange-set", InterchangeSet.MODCA_PRESENTATION_INTERCHANGE_SET_2);
-//                InterchangeSet interchangeSet = InterchangeSet.valueOf(interchangeSetString);
-//                afpRenderer.getAFPDataStream().setInterchangeSet(interchangeSet);
-//            }
-
             // a default external resource group file setting
             Configuration resourceGroupFileCfg
                 = cfg.getChild("resource-group-file", false);
@@ -274,6 +265,16 @@ public class AFPRendererConfigurator extends PrintRendererConfigurator {
                                 + resourceGroupDest + "'");
                 }
             }
+
+            // TODO: provide support for different MO:DCA interchange sets
+            // the MO:DCA interchange set in use (defaults to MO:DCA-L)
+//            Configuration modcaCfg = cfg.getChild("modca", false);
+//            if (modcaCfg != null) {
+//                String interchangeSetString = cfg.getAttribute(
+//                        "interchange-set", InterchangeSet.MODCA_PRESENTATION_INTERCHANGE_SET_2);
+//                InterchangeSet interchangeSet = InterchangeSet.valueOf(interchangeSetString);
+//                afpRenderer.getAFPDataStream().setInterchangeSet(interchangeSet);
+//            }
         }
     }
 }
index 55953daf0c231d6f51cb109c7c4d9409658d2a04..9ee169d8013ee61393ff59ba4424e079dfe426df 100644 (file)
@@ -57,13 +57,14 @@ public class AFPFontCollection implements FontCollection {
         int num = 1;
         if (embedFontInfoList != null && embedFontInfoList.size() > 0) {
             for (Iterator it = embedFontInfoList.iterator(); it.hasNext();) {
-                AFPFontInfo afi = (AFPFontInfo)it.next();
-                AFPFont bf = (AFPFont)afi.getAFPFont();
-                for (Iterator it2 = afi.getFontTriplets().iterator(); it2.hasNext();) {
-                    FontTriplet ft = (FontTriplet)it2.next();
-                    fontInfo.addFontProperties("F" + num, ft.getName()
-                                                    , ft.getStyle(), ft.getWeight());
-                    fontInfo.addMetrics("F" + num, bf);
+                AFPFontInfo afpFontInfo = (AFPFontInfo)it.next();
+                AFPFont afpFont = (AFPFont)afpFontInfo.getAFPFont();
+                List/*<FontTriplet>*/ tripletList = afpFontInfo.getFontTriplets();
+                for (Iterator it2 = tripletList.iterator(); it2.hasNext();) {
+                    FontTriplet triplet = (FontTriplet)it2.next();
+                    fontInfo.addFontProperties("F" + num,
+                            triplet.getName(), triplet.getStyle(), triplet.getWeight());
+                    fontInfo.addMetrics("F" + num, afpFont);
                     num++;
                 }
             }
@@ -71,6 +72,8 @@ public class AFPFontCollection implements FontCollection {
             AFPEventProducer eventProducer = AFPEventProducer.Provider.get(eventBroadcaster);
             eventProducer.warnDefaultFontSetup(this);
         }
+
+        // note: these fonts may not exist on your AFP installation
         if (fontInfo.fontLookup("sans-serif", Font.STYLE_NORMAL, Font.WEIGHT_NORMAL) == null) {
             CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZH200  ",
                     1, new Helvetica());
index 42f333a66f9d0fbaa083fbaf8b4806d92408acf4..a70dce4b9cbfb1b82f0f55ee93a64fec001295e4 100644 (file)
@@ -27,20 +27,22 @@ import java.util.List;
 public class AFPFontInfo {
 
     private AFPFont font;
-    private List fontTriplets;
+    private List/*<FontTriplet>*/ tripletList;
 
     /**
      * Main constructor
+     * 
      * @param afpFont The AFP Font
-     * @param fontTriplets List of font triplets to associate with this font
+     * @param tripletList List of font triplets to associate with this font
      */
-    public AFPFontInfo(AFPFont afpFont, List fontTriplets) {
+    public AFPFontInfo(AFPFont afpFont, List/*<FontTriplet>*/ tripletList) {
         this.font = afpFont;
-        this.fontTriplets = fontTriplets;
+        this.tripletList = tripletList;
     }
 
     /**
      * Returns the afp font
+     * 
      * @return the afp font
      */
     public AFPFont getAFPFont() {
@@ -49,10 +51,11 @@ public class AFPFontInfo {
 
     /**
      * Returns the list of font triplets associated with this font.
+     * 
      * @return List of font triplets
      */
-    public List getFontTriplets() {
-        return fontTriplets;
+    public List/*<FontTriplet>*/ getFontTriplets() {
+        return tripletList;
     }
 
 }
index 73c4b6821f5c31040006740a19cf28091936269b..d3b4d10a99086977590331507b63cc9e97b02cef 100644 (file)
@@ -382,12 +382,4 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject {
         objects.add(obj);
     }
 
-//    /** {@inheritDoc} */
-//    protected void addObject(AbstractAFPObject obj) {
-//        if (obj instanceof DataObjectAccessor) {
-//            DataObjectAccessor dataObjectAccessor = (DataObjectAccessor)obj;
-//            getActiveEnvironmentGroup().createMapDataResource(dataObjectAccessor);
-//        }
-//        endPresentationObject();
-//    }    
 }
index 55f3a89b15b56926df4ff29639860db36ac524a6..b1d4980a8b38fd0344f52df51a5ad63b73551621 100644 (file)
@@ -22,12 +22,11 @@ package org.apache.fop.render.afp.modca;
 import java.io.IOException;
 import java.io.OutputStream;
 
-//import org.apache.fop.render.afp.DataObjectInfo;
-
 /**
  * An abstract container of resource objects
  */
 public abstract class AbstractResourceGroupContainer extends AbstractPageObject {
+
     /**
      * The resource group object
      */
@@ -72,6 +71,8 @@ public abstract class AbstractResourceGroupContainer extends AbstractPageObject
     }
 
     /**
+     * Return the number of resources in this container
+     * 
      * @return the number of resources in this container
      */
     protected int getResourceCount() {
@@ -82,6 +83,8 @@ public abstract class AbstractResourceGroupContainer extends AbstractPageObject
     }
     
     /**
+     * Returns true if this resource group container contains resources
+     * 
      * @return true if this resource group container contains resources
      */
     protected boolean hasResources() {
@@ -98,18 +101,7 @@ public abstract class AbstractResourceGroupContainer extends AbstractPageObject
         return resourceGroup;
     }
     
-//    /**
-//     * Creates and returns a new data object
-//     * @param dataObjectInfo the data object info
-//     * @return a newly created data object
-//     */
-//    public AbstractNamedAFPObject createObject(DataObjectInfo dataObjectInfo) {
-//        return dataObjectFactory.create(dataObjectInfo);
-//    }
-
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     protected void writeContent(OutputStream os) throws IOException {
         if (resourceGroup != null) {
             resourceGroup.write(os);