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 cb...@apache.org on 2007/07/30 14:20:17 UTC

svn commit: r560936 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp: ./ extensions/ fonts/ modca/

Author: cbowditch
Date: Mon Jul 30 05:20:15 2007
New Revision: 560936

URL: http://svn.apache.org/viewvc?view=rev&rev=560936
Log:
Bugzilla #42971 and #42956
AFP Renderer Improvements
Submitted by Adrian Cumiskey <dev.at.cumiskey.com>


Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElement.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java Mon Jul 30 05:20:15 2007
@@ -256,10 +256,10 @@
         this.fontInfo = inFontInfo;
         int num = 1;
         if (this.fontList != null && this.fontList.size() > 0) {
-            for (Iterator it = this.fontList.iterator(); it.hasNext(); ) {
+            for (Iterator it = this.fontList.iterator(); it.hasNext();) {
                 AFPFontInfo afi = (AFPFontInfo)it.next();
                 AFPFont bf = (AFPFont)afi.getAFPFont();
-                for (Iterator it2 = afi.getFontTriplets().iterator(); it2.hasNext(); ) {
+                for (Iterator it2 = afi.getFontTriplets().iterator(); it2.hasNext();) {
                     FontTriplet ft = (FontTriplet)it2.next();
                     this.fontInfo.addFontProperties("F" + num, ft.getName()
                                                     , ft.getStyle(), ft.getWeight());
@@ -271,21 +271,24 @@
             log.warn("No AFP fonts configured - using default setup");
         }
         if (this.fontInfo.fontLookup("sans-serif", "normal", 400) == null) {
-            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZH200  ", 1, new Helvetica());
+            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZH200  ",
+                    1, new Helvetica());
             AFPFont bf = new OutlineFont("Helvetica", cs);
             this.fontInfo.addFontProperties("F" + num, "sans-serif", "normal", 400);
             this.fontInfo.addMetrics("F" + num, bf);
             num++;
         }
         if (this.fontInfo.fontLookup("serif", "normal", 400) == null) {
-            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZN200  ", 1, new TimesRoman());
+            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZN200  ",
+                    1, new TimesRoman());
             AFPFont bf = new OutlineFont("Helvetica", cs);
             this.fontInfo.addFontProperties("F" + num, "serif", "normal", 400);
             this.fontInfo.addMetrics("F" + num, bf);
             num++;
         }
         if (this.fontInfo.fontLookup("monospace", "normal", 400) == null) {
-            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZ4200  ", 1, new Courier());
+            CharacterSet cs  = new FopCharacterSet("T1V10500", "Cp500", "CZ4200  ",
+                    1, new Courier());
             AFPFont bf = new OutlineFont("Helvetica", cs);
             this.fontInfo.addFontProperties("F" + num, "monospace", "normal", 400);
             this.fontInfo.addMetrics("F" + num, bf);
@@ -293,7 +296,8 @@
         }
         if (this.fontInfo.fontLookup("any", "normal", 400) == null) {
             FontTriplet ft = this.fontInfo.fontLookup("sans-serif", "normal", 400);
-            this.fontInfo.addFontProperties(this.fontInfo.getInternalFontKey(ft), "any", "normal", 400);
+            this.fontInfo.addFontProperties(
+                    this.fontInfo.getInternalFontKey(ft), "any", "normal", 400);
         }
     }
 
@@ -340,7 +344,7 @@
      *
      * {@inheritDoc}
      */
-    public void preparePage(PageViewport page) {
+    public void preparePage(PageViewport pageViewport) {
         // initializeRootExtensions(page);
 
         _currentFontFamily = "";
@@ -349,7 +353,7 @@
         _currentPageFonts.clear();
         _lineCache = new HashSet();
 
-        Rectangle2D bounds = page.getViewArea();
+        Rectangle2D bounds = pageViewport.getViewArea();
 
         _pageWidth = mpts2units(bounds.getWidth());
         _pageHeight = mpts2units(bounds.getHeight());
@@ -358,12 +362,12 @@
 
         _afpDataStream.startPage(_pageWidth, _pageHeight, 0);
 
-        renderPageObjectExtensions(page);
+        renderPageObjectExtensions(pageViewport);
 
         if (_pages == null) {
             _pages = new HashMap();
         }
-        _pages.put(page, _afpDataStream.savePage());
+        _pages.put(pageViewport, _afpDataStream.savePage());
 
     }
 
@@ -380,7 +384,7 @@
     }
 
     /**
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     public void startVParea(CTM ctm, Rectangle2D clippingRect) {
         // dummy not used
@@ -436,7 +440,7 @@
     }
 
     /**
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     protected void renderBlockViewport(BlockViewport bv, List children) {
         // clip and position viewport if necessary
@@ -548,7 +552,7 @@
     /**
      * {@inheritDoc}
      */
-    public void renderPage(PageViewport page) {
+    public void renderPage(PageViewport pageViewport) {
 
         // initializeRootExtensions(page);
 
@@ -558,27 +562,27 @@
         _currentPageFonts.clear();
         _lineCache = new HashSet();
 
-        Rectangle2D bounds = page.getViewArea();
+        Rectangle2D bounds = pageViewport.getViewArea();
 
         _pageWidth = mpts2units(bounds.getWidth());
         _pageHeight = mpts2units(bounds.getHeight());
 
-        if (_pages != null && _pages.containsKey(page)) {
+        if (_pages != null && _pages.containsKey(pageViewport)) {
 
-            _afpDataStream.restorePage((PageObject)_pages.remove(page));
+            _afpDataStream.restorePage((PageObject)_pages.remove(pageViewport));
 
         } else {
             // renderPageGroupExtensions(page);
 
             _afpDataStream.startPage(_pageWidth, _pageHeight, 0);
 
-            renderPageObjectExtensions(page);
+            renderPageObjectExtensions(pageViewport);
 
         }
 
         pushViewPortPos(new ViewPortPos());
 
-        renderPageAreas(page.getPage());
+        renderPageAreas(pageViewport.getPage());
 
         Iterator i = _currentPageFonts.values().iterator();
         while (i.hasNext()) {
@@ -609,21 +613,21 @@
     }
 
     /**
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     public void clipRect(float x, float y, float width, float height) {
         // TODO
     }
 
     /**
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     public void moveTo(float x, float y) {
         // TODO
     }
 
     /**
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     public void lineTo(float x, float y) {
         // TODO
@@ -637,7 +641,7 @@
     }
 
     /**
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     public void fillRect(float x, float y, float width, float height) {
         /*
@@ -857,13 +861,13 @@
     protected RendererContext createRendererContext(int x, int y, int width, int height, Map foreignAttributes) {
         RendererContext context;
         context = super.createRendererContext(x, y, width, height, foreignAttributes);
-        context.setProperty(AFPRendererContextConstants.AFP_GRAYSCALE, 
+        context.setProperty(AFPRendererContextConstants.AFP_GRAYSCALE,
                 new Boolean(!this.colorImages));
         return context;
     }
 
     /**
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     public void drawImage(String url, Rectangle2D pos, Map foreignAttributes) {
         String name = null;
@@ -1007,7 +1011,7 @@
             }
         }
     }
-    
+
     /**
      * Draws a BufferedImage to AFP.
      * @param bi the BufferedImage
@@ -1027,7 +1031,7 @@
             //Serialize image
             writeImage(bi, baout);
             byte[] buf = baout.toByteArray();
-            
+
             //Generate image
             ImageObject io = _afpDataStream.getImageObject(afpx, afpy, afpw, afph);
             io.setImageParameters(
@@ -1047,10 +1051,10 @@
             log.error("Error while serializing bitmap: " + ioe.getMessage(), ioe);
         }
     }
-    
+
     /**
      * Establishes a new foreground or fill color.
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     public void updateColor(Color col, boolean fill) {
         if (fill) {
@@ -1095,7 +1099,7 @@
     }
 
     /**
-     * {@inheritDoc} 
+     * {@inheritDoc}
      */
     public void renderImage(Image image, Rectangle2D pos) {
         String url = image.getURL();
@@ -1354,40 +1358,50 @@
      * Method to render the page extension.
      * <p>
      *
-     * @param page
+     * @param pageViewport
      *            the page object
      */
-    private void renderPageObjectExtensions(PageViewport page) {
+    private void renderPageObjectExtensions(PageViewport pageViewport) {
 
         _pageSegmentsMap = null;
-        if (page.getExtensionAttachments() != null
-            && page.getExtensionAttachments().size() > 0) {
+        if (pageViewport.getExtensionAttachments() != null
+            && pageViewport.getExtensionAttachments().size() > 0) {
             //Extract all AFPPageSetup instances from the attachment list on the s-p-m
-            Iterator i = page.getExtensionAttachments().iterator();
+            Iterator i = pageViewport.getExtensionAttachments().iterator();
             while (i.hasNext()) {
                 ExtensionAttachment attachment = (ExtensionAttachment)i.next();
                 if (AFPPageSetup.CATEGORY.equals(attachment.getCategory())) {
-                    AFPPageSetup aps = (AFPPageSetup)attachment;
-                    String element = aps.getElementName();
-                    if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) { 
-                        String overlay = aps.getName();
-                        if (overlay != null) {
-                            _afpDataStream.createIncludePageOverlay(overlay);
-                        }
-                    } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) { 
-                        String name = aps.getName();
-                        String source = aps.getValue();
-                        if (_pageSegmentsMap == null) {
-                            _pageSegmentsMap = new HashMap();
+                    if (attachment instanceof AFPPageSetup) {
+                        AFPPageSetup aps = (AFPPageSetup)attachment;
+                        if (log.isDebugEnabled()) {
+                            log.debug(aps);
                         }
-                        _pageSegmentsMap.put(source, name);
-                    } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) { 
-                        String name = aps.getName();
-                        String value = aps.getValue();
-                        if (_pageSegmentsMap == null) {
-                            _pageSegmentsMap = new HashMap();
+                        String element = aps.getElementName();
+                        if (AFPElementMapping.INCLUDE_PAGE_OVERLAY.equals(element)) {
+                            String overlay = aps.getName();
+                            if (overlay != null) {
+                                _afpDataStream.createIncludePageOverlay(overlay);
+                            }
+                        } else if (AFPElementMapping.INCLUDE_PAGE_SEGMENT.equals(element)) {
+                            String name = aps.getName();
+                            String source = aps.getValue();
+                            if (_pageSegmentsMap == null) {
+                                _pageSegmentsMap = new HashMap();
+                            }
+                            _pageSegmentsMap.put(source, name);
+                        } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
+                            String name = aps.getName();
+                            String value = aps.getValue();
+                            if (_pageSegmentsMap == null) {
+                                _pageSegmentsMap = new HashMap();
+                            }
+                            _afpDataStream.createTagLogicalElement(name, value);
+                        } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
+                            String content = aps.getContent();
+                            if (content != null) {
+                                _afpDataStream.createNoOperation(content);
+                            }
                         }
-                        _afpDataStream.createTagLogicalElement(name, value);
                     }
                 }
             }
@@ -1419,14 +1433,17 @@
         return (int)Math.round(mpt / DPI_CONVERSION_FACTOR_240);
     }
 
-    private void convertToGrayScaleImage(ImageObject io, byte raw[]) {
+    private void convertToGrayScaleImage(ImageObject io, byte[] raw) {
         int pixelsPerByte = 8 / bitsPerPixel;
-        byte bw[] = new byte[raw.length / (3 * pixelsPerByte)];
+        byte[] bw = new byte[raw.length / (3 * pixelsPerByte)];
         int k = 0;
         for (int i = 0, j = 0; i < raw.length; i += 3, j++) {
             if (j == pixelsPerByte) {
                 j = 0;
                 k++;
+                if (k == bw.length) {
+                    break;
+                }
             }
             // see http://www.jguru.com/faq/view.jsp?EID=221919
             double greyVal = 0.212671d * ((int) raw[i] & 0xff)

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElement.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElement.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElement.java Mon Jul 30 05:20:15 2007
@@ -18,11 +18,11 @@
 /* $Id$ */
 
 package org.apache.fop.render.afp.extensions;
+
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.XMLObj;
 
 /**
  * This class extends the org.apache.fop.extensions.ExtensionObj class. The
@@ -40,16 +40,6 @@
      */
     public AFPElement(FONode parent, String name) {
         super(parent, name);
-    }
-
-    /** {@inheritDoc} */
-    public String getNamespaceURI() {
-        return AFPElementMapping.NAMESPACE;
-    }
-
-    /** {@inheritDoc} */
-    public String getNormalNamespacePrefix() {
-        return "afp";
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPElementMapping.java Mon Jul 30 05:20:15 2007
@@ -45,6 +45,9 @@
 
     public static final String INCLUDE_PAGE_SEGMENT = "include-page-segment";
 
+    /** NOP */
+    public static final String NO_OPERATION = "no-operation";
+
     /**
      * The namespace used for AFP extensions
      */
@@ -79,6 +82,9 @@
             foObjs.put(
                 INCLUDE_PAGE_OVERLAY,
                 new AFPIncludePageOverlayMaker());
+            foObjs.put(
+                NO_OPERATION,
+                new AFPNoOperationMaker());
         }
 
     }
@@ -107,4 +113,9 @@
         }
     }
 
+    static class AFPNoOperationMaker extends ElementMapping.Maker {
+        public FONode make(FONode parent) {
+            return new AFPElement(parent, NO_OPERATION);
+        }
+    }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AFPPageSetup.java Mon Jul 30 05:20:15 2007
@@ -22,11 +22,17 @@
 import java.io.Serializable;
 
 import org.apache.fop.fo.extensions.ExtensionAttachment;
+import org.apache.fop.util.XMLizable;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
 
 /**
  * This is the pass-through value object for the PostScript extension.
  */
-public class AFPPageSetup implements ExtensionAttachment, Serializable {
+public class AFPPageSetup implements ExtensionAttachment, Serializable, XMLizable  {
+
+    private static final long serialVersionUID = 7190606822558332901L;
 
     /** The category URI for this extension attachment. */
     public static final String CATEGORY = "apache:fop:extensions:afp";
@@ -37,12 +43,15 @@
 
     private String value;
 
+    private String content;
+
     /**
      * Default constructor.
-     * @param name the name of the setup code object, may be null
+     * 
+     * @param elementName the name of the setup code object, may be null
      */
-    public AFPPageSetup(String name) {
-        this.elementName = name;
+    public AFPPageSetup(String elementName) {
+        this.elementName = elementName;
     }
 
     /** @return the name */
@@ -77,15 +86,49 @@
     public void setValue(String source) {
         this.value = source;
     }
-
+    
     /** {@inheritDoc} */
     public String getCategory() {
         return CATEGORY;
     }
 
+    /**
+     * @return the data
+     */
+    public String getContent() {
+        return content;
+    }
+
+    /**
+     * Sets the data
+     * @param content The byte data to set.
+     */
+    public void setContent(String content) {
+        this.content = content;
+    }
+
     /** {@inheritDoc} */
     public String toString() {
         return "AFPPageSetup(element-name=" + getElementName() + " name=" + getName() + ")";
     }
 
+    private static final String ATT_NAME = "name";
+    private static final String ATT_VALUE = "value";
+
+    /** {@inheritDoc} */
+    public void toSAX(ContentHandler handler) throws SAXException {
+        AttributesImpl atts = new AttributesImpl();
+        if (name != null && name.length() > 0) {
+            atts.addAttribute(null, ATT_NAME, ATT_NAME, "CDATA", name);
+        }
+        if (value != null && value.length() > 0) {
+            atts.addAttribute(null, ATT_VALUE, ATT_VALUE, "CDATA", value);
+        }
+        handler.startElement(CATEGORY, elementName, elementName, atts);
+        if (content != null && content.length() > 0) {
+            char[] chars = content.toCharArray();
+            handler.characters(chars, 0, chars.length);
+        }
+        handler.endElement(CATEGORY, elementName, elementName);
+    }
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/extensions/AbstractAFPExtensionObject.java Mon Jul 30 05:20:15 2007
@@ -33,10 +33,13 @@
  */
 public abstract class AbstractAFPExtensionObject extends FONode {
 
-    private AFPPageSetup setupCode = null;
-
-    private String _name = null;
+    /**
+     * AFP setup code
+     */
+    private AFPPageSetup setupCode;
     
+    private String name;
+            
     /**
      * @see org.apache.fop.fo.FONode#FONode(FONode)
      * @param parent the parent formatting object
@@ -44,14 +47,11 @@
      */
     public AbstractAFPExtensionObject(FONode parent, String name) {
         super(parent);
-        _name = name;
-        setupCode = new AFPPageSetup(name);
+        this.name = name;
+        this.setupCode = new AFPPageSetup(name);
     }
 
-    /**
-     * {@inheritDoc} String, String)
-     * here, blocks XSL FO's from having non-FO parents.
-     */
+    /** {@inheritDoc} */
     protected void validateChildNode(Locator loc, String nsURI, String localName)
                 throws ValidationException {
         if (FO_URI.equals(nsURI)) {
@@ -60,8 +60,9 @@
     }
 
     /** {@inheritDoc} */
-    protected void addCharacters(char[] data, int start, int length,
+    protected void addCharacters(char[] data, int start, int end,
                                  PropertyList pList, Locator locator) {
+        setupCode.setContent(new String(data, start, end - start));       
     }
 
     /** {@inheritDoc} */
@@ -69,7 +70,7 @@
         return AFPElementMapping.NAMESPACE;
     }
 
-    /**{@inheritDoc} */
+    /** {@inheritDoc} */
     public String getNormalNamespacePrefix() {
         return AFPElementMapping.NAMESPACE_PREFIX;
     }
@@ -91,8 +92,7 @@
             } else {
                 throw new FOPException(elementName + " must have a src attribute.");
             }
-        }
-        if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(elementName)) {
+        } else if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(elementName)) {
             name = attlist.getValue("value");
             if (name != null && name.length() > 0) {
                 setupCode.setValue(name);
@@ -114,8 +114,6 @@
 
     /** {@inheritDoc} */
     public String getLocalName() {
-        return _name;
+        return name;
     }
-
 }
-

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java Mon Jul 30 05:20:15 2007
@@ -111,7 +111,7 @@
     /**
      * The collection of code pages
      */
-    private static HashMap _codePages = new HashMap();
+    private HashMap _codePages = new HashMap();
 
     /**
      * Load the font details and metrics into the CharacterSetMetric object,
@@ -120,7 +120,7 @@
      *
      * @param characterSet the CharacterSetMetric object to populate
      */
-    public static void loadCharacterSetMetric(CharacterSet characterSet) {
+    public void loadCharacterSetMetric(CharacterSet characterSet) {
 
         InputStream inputStream = null;
 
@@ -275,6 +275,11 @@
         }
 
         File directory = new File(url.getPath());
+        if (!directory.canRead()) {
+            String msg = "Failed to read directory " + url.getPath();
+            log.error(msg);
+            throw new FileNotFoundException(msg);
+        }
 
         final String filterpattern = codePage.trim();
         FilenameFilter filter = new FilenameFilter() {
@@ -606,4 +611,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/CharacterSet.java Mon Jul 30 05:20:15 2007
@@ -250,7 +250,8 @@
 
         if (!_isMetricsLoaded) {
 
-            AFPFontReader.loadCharacterSetMetric(this);
+            AFPFontReader afpFontReader = new AFPFontReader();
+            afpFontReader.loadCharacterSetMetric(this);
             _isMetricsLoaded = true;
 
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java Mon Jul 30 05:20:15 2007
@@ -571,6 +571,15 @@
     }
 
     /**
+     * Creates a NoOperation item
+     * 
+     * @param content byte data
+     */
+    public void createNoOperation(String content) {
+        _currentPage.createNoOperation(content);
+    }
+
+    /**
      * Start a new page group. When processing has finished on the current page
      * group the {@link #endPageGroup()}method must be invoked to mark the page
      * group ending.

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java?view=diff&rev=560936&r1=560935&r2=560936
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/AbstractPageObject.java Mon Jul 30 05:20:15 2007
@@ -357,6 +357,18 @@
     }
 
     /**
+     * Creates a NoOperation on the page.
+     *
+     * @param content the byte data
+     */
+    public void createNoOperation(String content) {
+
+        NoOperation noOp = new NoOperation(content);
+        _objects.add(noOp);
+
+    }
+
+    /**
      * Creates an IncludePageSegment on the current page.
      *
      * @param name
@@ -410,4 +422,4 @@
         return _rotation;
     }
 
-}
\ No newline at end of file
+}



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