xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r634267 [11/39] - in /xmlgraphics/fop/branches/Temp_ProcessingFeedback: ./ examples/embedding/ examples/embedding/java/embedding/ examples/embedding/java/embedding/intermediate/ examples/embedding/xml/xml/ examples/fo/ examples/fo/advanced/...
Date Thu, 06 Mar 2008 13:34:59 GMT
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFont.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFont.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFont.java Thu Mar  6 05:33:44 2008
@@ -19,6 +19,9 @@
  
 package org.apache.fop.pdf;
 
+import java.io.IOException;
+import java.io.OutputStream;
+
 import org.apache.fop.fonts.FontType;
 
 /**
@@ -30,38 +33,11 @@
  * <p>
  * Fonts are specified on page 198 and onwards of the PDF 1.3 spec.
  */
-public class PDFFont extends PDFObject {
-
-    /**
-     * the internal name for the font (eg "F1")
-     */
-    protected String fontname;
-
-    /**
-     * the font's subtype
-     * (as defined by the constants FontType: TYPE0, TYPE1, MMTYPE1, TYPE3, TRUETYPE)
-     */
-    protected FontType subtype;
-
-    /**
-     * the base font name (eg "Helvetica")
-     */
-    protected String basefont;
-
-    /**
-     * the character encoding scheme used by the font.
-     * It can be a String for standard encodings, or
-     * a PDFEncoding for a more complex scheme, or
-     * a PDFStream containing a CMap in a Type0 font.
-     * If <code>null</code> then not written out in the PDF.
-     */
-    protected Object encoding;
-
-    /**
-     * the Unicode mapping mechanism
-     */
-    // protected PDFToUnicode mapping;
+public class PDFFont extends PDFDictionary {
 
+    /** Internal F-number for each font (it is not written to the font dict) */
+    private String fontname;
+    
     /**
      * create the /Font object
      *
@@ -72,20 +48,46 @@
      */
     public PDFFont(String fontname, FontType subtype,
                    String basefont,
-                   Object encoding /* , PDFToUnicode mapping */) {
+                   Object encoding) {
 
         /* generic creation of PDF object */
         super();
 
-        /* set fields using paramaters */
         this.fontname = fontname;
-        this.subtype = subtype;
-        this.basefont = basefont;
-        this.encoding = encoding;
-        // this.mapping = mapping;
+        put("Type", new PDFName("Font"));
+        put("Subtype", getPDFNameForFontType(subtype));
+        //put("Name", new PDFName(fontname));
+        put("BaseFont", new PDFName(basefont));
+        if (encoding instanceof PDFEncoding) {
+            setEncoding((PDFEncoding)encoding);
+        } else if (encoding instanceof String) {
+            setEncoding((String)encoding);
+        } else {
+            throw new IllegalArgumentException("Illegal value for encoding");
+        }
     }
 
     /**
+     * Sets the Encoding value of the font.
+     * @param encoding the encoding
+     */
+    public void setEncoding(String encoding) {
+        if (encoding != null) {
+            put("Encoding", new PDFName(encoding));
+        }
+    }
+    
+    /**
+     * Sets the Encoding value of the font.
+     * @param encoding the encoding
+     */
+    public void setEncoding(PDFEncoding encoding) {
+        if (encoding != null) {
+            put("Encoding", encoding);
+        }
+    }
+    
+    /**
      * factory method with the basic parameters
      *
      * @param fontname the internal name for the font
@@ -111,80 +113,42 @@
             return new PDFFontTrueType(fontname, basefont,
                                        encoding);
         } else {
-            return null;    // should not happend
+            return null;    // should not happen
         }
     }
 
     /**
-     * factory method with the extended parameters
-     * for Type1, MMType1 and TrueType
-     *
-     * @param fontname the internal name for the font
-     * @param subtype the font's subtype
-     * @param basefont the base font name
-     * @param encoding the character encoding schema used by the font
-     * @param firstChar the first character code in the font
-     * @param lastChar the last character code in the font
-     * @param widths an array of size (lastChar - firstChar +1)
-     * @param descriptor the descriptor for other font's metrics
-     * @return the generated PDFFont object
-     */
-    public static PDFFont createFont(String fontname,
-                                     FontType subtype, String basefont,
-                                     Object encoding, int firstChar,
-                                     int lastChar, PDFArray widths,
-                                     PDFFontDescriptor descriptor) {
-
-        PDFFontNonBase14 font;
-        if (subtype == FontType.TYPE0) {
-            font = new PDFFontType0(fontname, basefont,
-                                    encoding);
-            font.setDescriptor(descriptor);
-            return font;
-        } else if ((subtype == FontType.TYPE1) 
-                || (subtype == FontType.MMTYPE1)) {
-            font = new PDFFontType1(fontname, basefont,
-                                    encoding);
-            font.setWidthMetrics(firstChar, lastChar, widths);
-            font.setDescriptor(descriptor);
-            return font;
-        } else if (subtype == FontType.TYPE3) {
-            return null; //NYI, should not happend
-        } else if (subtype == FontType.TRUETYPE) {
-            font = new PDFFontTrueType(fontname, basefont,
-                                       encoding);
-            font.setWidthMetrics(firstChar, lastChar, widths);
-            font.setDescriptor(descriptor);
-            return font;
-        } else {
-            return null;    // should not happend
-        }
-    }
-
-    /**
-     * get the internal name used for this font
+     * Get the internal name used for this font.
      * @return the internal name
      */
     public String getName() {
         return this.fontname;
     }
+    
+    /**
+     * Returns the name of the BaseFont.
+     * @return the BaseFont
+     */
+    public PDFName getBaseFont() {
+        return (PDFName)get("BaseFont");
+    }
 
     /**
      * Returns the PDF name for a certain font type.
      * @param fontType font type
      * @return String corresponding PDF name
      */
-    protected String getPDFNameForFontType(FontType fontType) {
+    protected PDFName getPDFNameForFontType(FontType fontType) {
         if (fontType == FontType.TYPE0) {
-            return fontType.getName();
+            return new PDFName(fontType.getName());
         } else if (fontType == FontType.TYPE1) {
-            return fontType.getName();
+            return new PDFName(fontType.getName());
         } else if (fontType == FontType.MMTYPE1) {
-            return fontType.getName();
+            return new PDFName(fontType.getName());
         } else if (fontType == FontType.TYPE3) {
-            return fontType.getName();
+            return new PDFName(fontType.getName());
         } else if (fontType == FontType.TRUETYPE) {
-            return fontType.getName();
+            return new PDFName(fontType.getName());
         } else {
             throw new IllegalArgumentException("Unsupported font type: " + fontType.getName());
         }
@@ -198,46 +162,15 @@
             if (this.getClass() == PDFFont.class) {
                 throw new PDFConformanceException("For " + getDocumentSafely().getProfile() 
                     + ", all fonts, even the base 14"
-                    + " fonts, have to be embedded! Offending font: " + this.basefont);
+                    + " fonts, have to be embedded! Offending font: " + getBaseFont());
             }
         }
     }
-    
-    /**
-     * {@inheritDoc}
-     */
-    public String toPDFString() {
-        validate();
-        StringBuffer p = new StringBuffer(128);
-        p.append(getObjectID());
-        p.append("<< /Type /Font\n/Subtype /"
-                 + getPDFNameForFontType(this.subtype)
-                 + "\n/Name /" + this.fontname
-                 + "\n/BaseFont /" + this.basefont);
-        if (encoding != null) {
-            p.append("\n/Encoding ");
-            if (encoding instanceof PDFEncoding) {
-                p.append(((PDFEncoding)this.encoding).referencePDF());
-            } else if (encoding instanceof PDFStream) {
-                p.append(((PDFStream)this.encoding).referencePDF());
-            } else {
-                p.append("/").append((String)encoding);
-            }
-        }
-        fillInPDF(p);
-        p.append(" >>\nendobj\n");
-        return p.toString();
-    }
 
-    /**
-     * This method is called to receive the specifics for the font's subtype.
-     * <p>
-     * The given buffer already contains the fields common to all font types.
-     *
-     * @param target the buffer to be completed with the type specific fields
-     */
-    protected void fillInPDF(StringBuffer target) {
-        //nop
+    /** {@inheritDoc} */
+    protected int output(OutputStream stream) throws IOException {
+        validate();
+        return super.output(stream);
     }
-
+    
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontDescriptor.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontDescriptor.java Thu Mar  6 05:33:44 2008
@@ -26,29 +26,7 @@
  * <p>
  * Font descriptors are specified on page 222 and onwards of the PDF 1.3 spec.
  */
-public class PDFFontDescriptor extends PDFObject {
-
-    // Required fields
-    private int ascent;
-    private int capHeight;
-    private int descent;
-    private int flags;
-    private PDFRectangle fontBBox;
-    private String basefont;    // PDF-spec: FontName
-    private int italicAngle;
-    private int stemV;
-    // Optional fields
-    private int stemH = 0;
-    private int xHeight = 0;
-    private int leading = 0;
-    private int avgWidth = 0;
-    private int maxWidth = 0;
-    private int missingWidth = 0;
-    private AbstractPDFStream fontfile;
-    private AbstractPDFStream cidSet;
-    // private String charSet = null;
-
-    private FontType subtype;
+public class PDFFontDescriptor extends PDFDictionary {
 
     /**
      * Create the /FontDescriptor object
@@ -66,19 +44,17 @@
                              int descent, int capHeight, int flags,
                              PDFRectangle fontBBox, int italicAngle,
                              int stemV) {
-
-        /* generic creation of PDF object */
         super();
 
-        /* set fields using paramaters */
-        this.basefont = basefont;
-        this.ascent = ascent;
-        this.descent = descent;
-        this.capHeight = capHeight;
-        this.flags = flags;
-        this.fontBBox = fontBBox;
-        this.italicAngle = italicAngle;
-        this.stemV = stemV;
+        put("Type", new PDFName("FontDescriptor"));
+        put("FontName", new PDFName(basefont));
+        put("FontBBox", fontBBox);
+        put("Flags", flags);
+        put("CapHeight", capHeight);
+        put("Ascent", ascent);
+        put("Descent", descent);
+        put("ItalicAngle", italicAngle);
+        put("StemV", stemV);
     }
 
     /**
@@ -97,12 +73,24 @@
      */
     public void setMetrics(int avgWidth, int maxWidth, int missingWidth,
                            int leading, int stemH, int xHeight) {
-        this.avgWidth = avgWidth;
-        this.maxWidth = maxWidth;
-        this.missingWidth = missingWidth;
-        this.leading = leading;
-        this.stemH = stemH;
-        this.xHeight = xHeight;
+        if (avgWidth != 0) {
+            put("AvgWidth", avgWidth);
+        }
+        if (maxWidth != 0) {
+            put("MaxWidth", maxWidth);
+        }
+        if (missingWidth != 0) {
+            put("MissingWidth", missingWidth);
+        }
+        if (leading != 0) {
+            put("Leading", leading);
+        }
+        if (stemH != 0) {
+            put("StemH", stemH);
+        }
+        if (xHeight != 0) {
+            put("XHeight", xHeight);
+        }
     }
 
     /**
@@ -112,13 +100,24 @@
      * @param fontfile the stream containing an embedded font
      */
     public void setFontFile(FontType subtype, AbstractPDFStream fontfile) {
-        this.subtype = subtype;
-        this.fontfile = fontfile;
+        if (subtype == FontType.TYPE1) {
+            put("FontFile", fontfile);
+        } else {
+            put("FontFile2", fontfile);
+        }
     }
 
     /** @return the FontFile or null if the font is not embedded */
     public AbstractPDFStream getFontFile() {
-        return this.fontfile;
+        AbstractPDFStream stream;
+        stream = (AbstractPDFStream)get("FontFile");
+        if (stream == null) {
+            stream = (AbstractPDFStream)get("FontFile2");
+        }
+        if (stream == null) {
+            stream = (AbstractPDFStream)get("FontFile3");
+        }
+        return stream;
     }
     
     /**
@@ -126,19 +125,18 @@
      * @param cidSet the CIDSet stream
      */
     public void setCIDSet(AbstractPDFStream cidSet) {
-        this.cidSet = cidSet;
+        put("CIDSet", cidSet);
     }
     
     /** @return the CIDSet stream or null if not applicable */
     public AbstractPDFStream getCIDSet() {
-        return this.cidSet;
+        return (AbstractPDFStream)get("CIDSet");
     }
     
-    // public void setCharSet(){}//for subset fonts
-
     /**
      * {@inheritDoc}
      */
+    /*
     public String toPDFString() {
         StringBuffer p = new StringBuffer(128);
         p.append(getObjectID() 
@@ -201,7 +199,7 @@
         fillInPDF(p);
         p.append(" >>\nendobj\n");
         return p.toString();
-    }
+    }*/
 
     /**
      * Fill in the specifics for the font's descriptor.
@@ -209,9 +207,9 @@
      * The given buffer already contains the fields common to all descriptors.
      *
      * @param begin the buffer to be completed with the specific fields
-     */
+     *//*
     protected void fillInPDF(StringBuffer begin) {
         //nop
-    }
+    }*/
 
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontNonBase14.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontNonBase14.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontNonBase14.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontNonBase14.java Thu Mar  6 05:33:44 2008
@@ -28,26 +28,6 @@
 public abstract class PDFFontNonBase14 extends PDFFont {
 
     /**
-     * first character code in the font
-     */
-    protected int firstChar;
-
-    /**
-     * last character code in the font
-     */
-    protected int lastChar;
-
-    /**
-     * widths of characters from firstChar to lastChar
-     */
-    protected PDFArray widths;
-
-    /**
-     * descriptor of font metrics
-     */
-    protected PDFFontDescriptor descriptor;
-
-    /**
      * Create the /Font object
      *
      * @param fontname the internal name for the font
@@ -61,8 +41,6 @@
 
         /* generic creation of PDF object */
         super(fontname, subtype, basefont, encoding);
-
-        this.descriptor = null;
     }
 
     /**
@@ -74,10 +52,9 @@
      */
     public void setWidthMetrics(int firstChar, int lastChar,
                                 PDFArray widths) {
-        /* set fields using paramaters */
-        this.firstChar = firstChar;
-        this.lastChar = lastChar;
-        this.widths = widths;
+        put("FirstChar", new Integer(firstChar));
+        put("LastChar", new Integer(lastChar));
+        put("Widths", widths);
     }
 
     /**
@@ -86,12 +63,20 @@
      * @param descriptor the descriptor for other font's metrics
      */
     public void setDescriptor(PDFFontDescriptor descriptor) {
-        this.descriptor = descriptor;
+        put("FontDescriptor", descriptor);
     }
 
     /** @return the FontDescriptor or null if there is none */
     public PDFFontDescriptor getDescriptor() {
-        return this.descriptor;
+        return (PDFFontDescriptor)get("FontDescriptor");
+    }
+    
+    /**
+     * Sets a ToUnicode CMap.
+     * @param cmap the ToUnicode character map
+     */
+    public void setToUnicode(PDFCMap cmap) {
+        put("ToUnicode", cmap);
     }
     
     /** {@inheritDoc} */
@@ -104,20 +89,4 @@
         }
     }
     
-    /**
-     * {@inheritDoc}
-     */
-    protected void fillInPDF(StringBuffer target) {
-        target.append("\n/FirstChar ");
-        target.append(firstChar);
-        target.append("\n/LastChar ");
-        target.append(lastChar);
-        target.append("\n/Widths ");
-        target.append(this.widths.referencePDF());
-        if (descriptor != null) {
-            target.append("\n/FontDescriptor ");
-            target.append(this.descriptor.referencePDF());
-        }
-    }
-
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontTrueType.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontTrueType.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontTrueType.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontTrueType.java Thu Mar  6 05:33:44 2008
@@ -39,9 +39,7 @@
     public PDFFontTrueType(String fontname, 
                            String basefont,
                            Object encoding) {
-
-        /* generic creation of PDF object */
-        super(fontname, FontType.TRUETYPE, basefont, encoding /* , mapping */);
+        super(fontname, FontType.TRUETYPE, basefont, encoding);
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontType0.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontType0.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontType0.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontType0.java Thu Mar  6 05:33:44 2008
@@ -26,17 +26,7 @@
  * <p>
  * Type0 fonts are specified on page 208 and onwards of the PDF 1.3 spec.
  */
-public class PDFFontType0 extends PDFFontNonBase14 {
-
-    /**
-     * This should be an array of CIDFont but only the first one is used
-     */
-    protected PDFCIDFont descendantFonts;
-
-    /**
-     * The character map
-     */
-    protected PDFCMap cmap;
+public class PDFFontType0 extends PDFFont {
 
     /**
      * Create the /Font object
@@ -48,13 +38,7 @@
     public PDFFontType0(String fontname, 
                         String basefont,
                         Object encoding) {
-
-        /* generic creation of PDF object */
-        super(fontname, FontType.TYPE0, basefont, encoding /* , mapping */);
-
-        /* set fields using paramaters */
-        this.descendantFonts = null;
-        cmap = null;
+        super(fontname, FontType.TYPE0, basefont, encoding);
     }
 
     /**
@@ -69,12 +53,9 @@
                         String basefont,
                         Object encoding, 
                         PDFCIDFont descendantFonts) {
+        super(fontname, FontType.TYPE0, basefont, encoding);
 
-        /* generic creation of PDF object */
-        super(fontname, FontType.TYPE0, basefont, encoding /* , mapping */);
-
-        /* set fields using paramaters */
-        this.descendantFonts = descendantFonts;
+        setDescendantFonts(descendantFonts);
     }
 
     /**
@@ -82,7 +63,7 @@
      * @param descendantFonts the CIDFont upon which this font is based
      */
     public void setDescendantFonts(PDFCIDFont descendantFonts) {
-        this.descendantFonts = descendantFonts;
+        put("DescendantFonts", new PDFArray(this, new PDFObject[] {descendantFonts}));
     }
 
     /**
@@ -90,20 +71,7 @@
      * @param cmap the character map
      */
     public void setCMAP(PDFCMap cmap) {
-        this.cmap = cmap;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected void fillInPDF(StringBuffer target) {
-        if (descendantFonts != null) {
-            target.append("\n/DescendantFonts [ "
-                     + this.descendantFonts.referencePDF() + " ] ");
-        }
-        if (cmap != null) {
-            target.append("\n/ToUnicode " + cmap.referencePDF());
-        }
+        put("ToUnicode", cmap);
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontType3.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontType3.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontType3.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFFontType3.java Thu Mar  6 05:33:44 2008
@@ -32,26 +32,6 @@
 public class PDFFontType3 extends PDFFontNonBase14 {
 
     /**
-     * font's required /FontBBox bounding box
-     */
-    protected PDFRectangle fontBBox;
-
-    /**
-     * font's required /FontMatrix array
-     */
-    protected PDFArray fontMatrix;
-
-    /**
-     * font's required /CharProcs dictionary
-     */
-    protected PDFCharProcs charProcs;
-
-    /**
-     * font's optional /Resources object
-     */
-    protected PDFResources resources;
-
-    /**
      * Create the /Font object
      *
      * @param fontname the internal name for the font
@@ -61,13 +41,7 @@
     public PDFFontType3(String fontname, 
                         String basefont,
                         Object encoding) {
-
-        /* generic creation of PDF object */
-        super(fontname, FontType.TYPE3, basefont, encoding /* , mapping */);
-
-        this.fontBBox = null;
-        this.fontMatrix = null;
-        this.charProcs = null;
+        super(fontname, FontType.TYPE3, basefont, encoding);
     }
 
     /**
@@ -89,9 +63,9 @@
         /* generic creation of PDF object */
         super(fontname, FontType.TYPE3, basefont, encoding /* , mapping */);
 
-        this.fontBBox = fontBBox;
-        this.fontMatrix = fontMatrix;
-        this.charProcs = charProcs;
+        setFontBBox(fontBBox);
+        setFontMatrix(fontMatrix);
+        setCharProcs(charProcs);
     }
 
     /**
@@ -100,7 +74,7 @@
      * @param bbox bounding box for the font
      */
     public void setFontBBox(PDFRectangle bbox) {
-        this.fontBBox = bbox;
+        put("FontBBox", bbox);
     }
 
     /**
@@ -109,7 +83,7 @@
      * @param matrix the transformation matrix for the font
      */
     public void setFontMatrix(PDFArray matrix) {
-        this.fontMatrix = matrix;
+        put("FontMatrix", matrix);
     }
 
     /**
@@ -120,25 +94,7 @@
      * @param chars the glyphs' dictionary
      */
     public void setCharProcs(PDFCharProcs chars) {
-        this.charProcs = chars;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    protected void fillInPDF(StringBuffer target) {
-        if (fontBBox != null) {
-            target.append("\n/FontBBox ");
-            target.append(fontBBox.toPDF());
-        }
-        if (fontMatrix != null) {
-            target.append("\n/FontMatrix ");
-            target.append(fontMatrix.toPDF());
-        }
-        if (charProcs != null) {
-            target.append("\n/CharProcs ");
-            target.append(charProcs.referencePDF());
-        }
+        put("CharProcs", chars);
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java Thu Mar  6 05:33:44 2008
@@ -19,6 +19,13 @@
 
 package org.apache.fop.pdf;
 
+import java.awt.color.ColorSpace;
+import java.awt.color.ICC_Profile;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.io.IOUtils;
+
 /**
  * Represents an ICCBased color space in PDF.
  */
@@ -93,4 +100,56 @@
         return sb.toString();
     }
 
+    /**
+     * Sets sRGB as the DefaultRGB color space in the PDF document.
+     * @param pdfDoc the PDF document
+     * @return the newly installed color space object
+     */
+    public static PDFICCBasedColorSpace setupsRGBAsDefaultRGBColorSpace(PDFDocument pdfDoc) {
+        PDFICCStream sRGBProfile = setupsRGBColorProfile(pdfDoc);
+
+        //Map sRGB as default RGB profile for DeviceRGB
+        return pdfDoc.getFactory().makeICCBasedColorSpace(null, "DefaultRGB", sRGBProfile);
+    }
+
+    /**
+     * Installs the sRGB color space in the PDF document.
+     * @param pdfDoc the PDF document
+     * @return the newly installed color space object
+     */
+    public static PDFICCBasedColorSpace setupsRGBColorSpace(PDFDocument pdfDoc) {
+        PDFICCStream sRGBProfile = setupsRGBColorProfile(pdfDoc);
+
+        //Map sRGB as default RGB profile for DeviceRGB
+        return pdfDoc.getFactory().makeICCBasedColorSpace(null, null, sRGBProfile);
+    }
+
+    /**
+     * Sets up the sRGB color profile in the PDF document. It does so by trying to
+     * install a very small ICC profile (~4KB) instead of the very big one (~140KB)
+     * the Sun JVM uses.
+     * @param pdfDoc the PDF document
+     * @return the ICC stream with the sRGB profile
+     */
+    public static PDFICCStream setupsRGBColorProfile(PDFDocument pdfDoc) {
+        ICC_Profile profile;
+        PDFICCStream sRGBProfile = pdfDoc.getFactory().makePDFICCStream();
+        InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm");
+        if (in != null) {
+            try {
+                profile = ICC_Profile.getInstance(in);
+            } catch (IOException ioe) {
+                throw new RuntimeException(
+                        "Unexpected IOException loading the sRGB profile: " + ioe.getMessage());
+            } finally {
+                IOUtils.closeQuietly(in);
+            }
+        } else {
+            // Fallback: Use the sRGB profile from the JRE (about 140KB)
+            profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
+        }
+        sRGBProfile.setColorSpace(profile, null);
+        return sRGBProfile;
+    }
+    
 }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFMetadata.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFMetadata.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFMetadata.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFMetadata.java Thu Mar  6 05:33:44 2008
@@ -25,6 +25,8 @@
 
 import javax.xml.transform.TransformerConfigurationException;
 
+import org.xml.sax.SAXException;
+
 import org.apache.xmlgraphics.xmp.Metadata;
 import org.apache.xmlgraphics.xmp.XMPSerializer;
 import org.apache.xmlgraphics.xmp.schemas.DublinCoreAdapter;
@@ -36,8 +38,6 @@
 import org.apache.xmlgraphics.xmp.schemas.pdf.PDFAAdapter;
 import org.apache.xmlgraphics.xmp.schemas.pdf.PDFAXMPSchema;
 
-import org.xml.sax.SAXException;
-
 /**
  * Special PDFStream for Metadata.
  * @since PDF 1.4
@@ -118,10 +118,11 @@
      * @param pdfDoc the PDF Document
      * @return the requested XMP metadata
      */
-    public static Metadata createXMPFromUserAgent(PDFDocument pdfDoc) {
+    public static Metadata createXMPFromPDFDocument(PDFDocument pdfDoc) {
         Metadata meta = new Metadata();
         
         PDFInfo info = pdfDoc.getInfo();
+        PDFRoot root = pdfDoc.getRoot();
 
         //Set creation date if not available, yet
         if (info.getCreationDate() == null) {
@@ -144,6 +145,10 @@
         if (info.getSubject() != null) {
             //Subject maps to dc:description["x-default"] as per ISO-19005-1:2005/Cor.1:2007
             dc.setDescription(null, info.getSubject());
+        }
+        if (root.getLanguage() != null) {
+            //Note: No check is performed to make sure the value is valid RFC 3066!
+            dc.addLanguage(root.getLanguage());
         }
         dc.addDate(info.getCreationDate());
 

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFMetadata.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFObject.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFObject.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFObject.java Thu Mar  6 05:33:44 2008
@@ -26,6 +26,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Locale;
 import java.util.TimeZone;
 
 import org.apache.commons.logging.Log;
@@ -102,7 +103,9 @@
      */
     public void setObjectNumber(int objnum) {
         this.objnum = objnum;
+        PDFDocument doc = getDocument();
         setParent(null);
+        setDocument(doc); //Restore reference to PDFDocument after setting parent to null
         if (log.isTraceEnabled()) {
             log.trace("Assigning " + this + " object number " + objnum);
         }
@@ -140,7 +143,8 @@
     public final PDFDocument getDocumentSafely() {
         final PDFDocument doc = getDocument();
         if (doc == null) {
-            throw new IllegalStateException("Parent PDFDocument is unavailable");
+            throw new IllegalStateException("Parent PDFDocument is unavailable on "
+                    + getClass().getName());
         }
         return doc;
     }
@@ -327,33 +331,34 @@
     }
     
     /** Formatting pattern for PDF date */
-    protected static final SimpleDateFormat DATE_FORMAT 
-            = new SimpleDateFormat("'D:'yyyyMMddHHmmss");
+    protected static final SimpleDateFormat DATE_FORMAT;
 
+    static {
+        DATE_FORMAT = new SimpleDateFormat("'D:'yyyyMMddHHmmss", Locale.ENGLISH);
+        DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
+    }
+    
     /**
      * Formats a date/time according to the PDF specification 
      * (D:YYYYMMDDHHmmSSOHH'mm').
      * @param time date/time value to format
+     * @param tz the time zone
      * @return the requested String representation
      */
-    protected String formatDateTime(Date time) {
-        StringBuffer sb = new StringBuffer();
-        sb.append(DATE_FORMAT.format(time));
-        TimeZone tz = TimeZone.getDefault();
-        Calendar cal = Calendar.getInstance();
+    protected String formatDateTime(Date time, TimeZone tz) {
+        Calendar cal = Calendar.getInstance(tz, Locale.ENGLISH);
         cal.setTime(time);
         
-        int era = cal.get(Calendar.ERA);
-        int year = cal.get(Calendar.YEAR);
-        int month = cal.get(Calendar.MONTH);
-        int day = cal.get(Calendar.DAY_OF_MONTH);
-        int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
-        int milliseconds = cal.get(Calendar.HOUR_OF_DAY) * 1000 * 60 * 60;
-        milliseconds += cal.get(Calendar.MINUTE) * 1000 * 60;
-        milliseconds += cal.get(Calendar.SECOND) * 1000;
-        milliseconds += cal.get(Calendar.MILLISECOND);
+        int offset = cal.get(Calendar.ZONE_OFFSET);
+        offset += cal.get(Calendar.DST_OFFSET);
+        
+        //DateFormat is operating on GMT so adjust for time zone offset
+        Date dt1 = new Date(time.getTime() + offset);
+        StringBuffer sb = new StringBuffer();
+        sb.append(DATE_FORMAT.format(dt1));
+        
+        offset /= (1000 * 60); //Convert to minutes
         
-        int offset = tz.getOffset(era, year, month, day, dayOfWeek, milliseconds);
         if (offset == 0) {
             sb.append('Z');
         } else {
@@ -362,9 +367,8 @@
             } else {
                 sb.append('-');
             }
-            final int HOUR = (1000 * 60 * 60);
-            int offsetHour = Math.abs(offset / HOUR);
-            int offsetMinutes = (offset - (offsetHour * HOUR)) / (1000 * 60);
+            int offsetHour = Math.abs(offset / 60);
+            int offsetMinutes = Math.abs(offset % 60);
             if (offsetHour < 10) {
                 sb.append('0');
             }
@@ -379,4 +383,14 @@
         return sb.toString();
     }
 
+    /**
+     * Formats a date/time according to the PDF specification.
+     * (D:YYYYMMDDHHmmSSOHH'mm').
+     * @param time date/time value to format
+     * @return the requested String representation
+     */
+    protected String formatDateTime(Date time) {
+        return formatDateTime(time, TimeZone.getDefault());
+    }
+    
 }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFOutputIntent.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFPage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFPage.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFPage.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFPage.java Thu Mar  6 05:33:44 2008
@@ -19,6 +19,8 @@
  
 package org.apache.fop.pdf;
 
+import java.awt.geom.Rectangle2D;
+
 /**
  * Class representing a /Page object.
  * <p>
@@ -29,40 +31,10 @@
  */
 public class PDFPage extends PDFResourceContext {
 
-    /**
-     * Holds a reference on the parent PDFPages object.
-     */
-    private String parentRef;
-
-    /**
-     * the contents stream
-     */
-    protected PDFStream contents;
-
-    /**
-     * the width of the page in points
-     */
-    protected int pagewidth;
-
-    /**
-     * the height of the page in points
-     */
-    protected int pageheight;
-
     /** the page index (zero-based) */
     protected int pageIndex;
     
     /**
-     * Duration to display page
-     */
-    protected int duration = -1;
-
-    /**
-     * Transition dictionary
-     */
-    protected TransitionDictionary trDictionary = null;
-
-    /**
      * Create a /Page object
      *
      * @param resources the /Resources object
@@ -77,10 +49,10 @@
         /* generic creation of object */
         super(resources);
 
+        put("Type", new PDFName("Page"));
         /* set fields using parameters */
-        this.contents = contents;
-        this.pagewidth = pageWidth;
-        this.pageheight = pageHeight;
+        setContents(contents);
+        setSimplePageSize(pageWidth, pageHeight);
         this.pageIndex = pageIndex;
     }
 
@@ -97,13 +69,51 @@
         this(resources, null, pageWidth, pageHeight, pageIndex);
     }
 
+    private void setSimplePageSize(int width, int height) {
+        Rectangle2D box = new Rectangle2D.Double(0, 0, width, height);
+        setMediaBox(box);
+        setBleedBox(box); //Recommended by PDF/X
+        setTrimBox(box); //Needed for PDF/X
+    }
+    
+    private PDFArray toPDFArray(Rectangle2D box) {
+        return new PDFArray(this, new double[] {
+                box.getX(), box.getY(), box.getMaxX(), box.getMaxY()});
+    }
+    
+    /**
+     * Sets the "MediaBox" entry
+     * @param box the media rectangle
+     */
+    public void setMediaBox(Rectangle2D box) {
+        put("MediaBox", toPDFArray(box));
+    }
+    
+    /**
+     * Sets the "TrimBox" entry
+     * @param box the trim rectangle
+     */
+    public void setTrimBox(Rectangle2D box) {
+        put("TrimBox", toPDFArray(box));
+    }
+    
+    /**
+     * Sets the "BleedBox" entry
+     * @param box the bleed rectangle
+     */
+    public void setBleedBox(Rectangle2D box) {
+        put("BleedBox", toPDFArray(box));
+    }
+    
     /**
      * set this page contents
      *
      * @param contents the contents of the page
      */
     public void setContents(PDFStream contents) {
-        this.contents = contents;
+        if (contents != null) {
+            put("Contents", new PDFReference(contents));
+        }
     }
 
     /**
@@ -112,7 +122,7 @@
      * @param parent the /Pages object that is this page's parent
      */
     public void setParent(PDFPages parent) {
-        this.parentRef = parent.referencePDF();
+        put("Parent", new PDFReference(parent));
     }
 
     /**
@@ -124,24 +134,8 @@
      * @param tr the transition dictionary
      */
     public void setTransition(int dur, TransitionDictionary tr) {
-        duration = dur;
-        trDictionary = tr;
-    }
-
-    /**
-     * Returns the page width.
-     * @return the page width
-     */
-    public int getWidth() {
-        return this.pagewidth;
-    }
-
-    /**
-     * Returns the page height.
-     * @return the page height
-     */
-    public int getHeight() {
-        return this.pageheight;
+        put("Dur", new Integer(dur));
+        put("Trans", tr);
     }
 
     /**
@@ -150,35 +144,6 @@
      */
     public int getPageIndex() {
         return this.pageIndex;
-    }
-    
-    /**
-     * {@inheritDoc}
-     */
-    public String toPDFString() {
-        StringBuffer sb = new StringBuffer();
-
-        String box = "[ 0 0 " + getWidth() + " " + getHeight() + " ]";
-        sb = sb.append(getObjectID()
-                       + "<< /Type /Page\n" 
-                       + "/Parent " + this.parentRef + "\n"
-                       + "/MediaBox " + box + "\n" 
-                       + "/TrimBox " + box + "\n" //Needed for PDF/X
-                       + "/BleedBox " + box + "\n" //Recommended by PDF/X
-                       + "/Resources " + this.resources.referencePDF() + "\n" 
-                       + "/Contents " + this.contents.referencePDF() + "\n");
-        if (this.annotList != null) {
-            sb = sb.append("/Annots " + this.annotList.referencePDF() + "\n");
-        }
-        if (this.duration != -1) {
-            sb = sb.append("/Dur " + this.duration + "\n");
-        }
-        if (this.trDictionary != null) {
-            sb = sb.append("/Trans << " + this.trDictionary.getDictionary() + " >>\n");
-        }
-
-        sb = sb.append(">>\nendobj\n");
-        return sb.toString();
     }
 
 }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFProfile.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFRectangle.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFRectangle.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFRectangle.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFRectangle.java Thu Mar  6 05:33:44 2008
@@ -19,12 +19,16 @@
  
 package org.apache.fop.pdf;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
 /**
  * class representing a rectangle
  *
  * Rectangles are specified on page 183 of the PDF 1.3 spec.
  */
-public class PDFRectangle {
+public class PDFRectangle implements PDFWritable {
 
     /**
      * lower left x coordinate
@@ -73,23 +77,17 @@
         this.ury = array[3];
     }
 
-    /**
-     * produce the PDF representation for the object
-     *
-     * @return the PDF
-     */
-    public byte[] toPDF() {
-        return PDFDocument.encode(toPDFString());
+    private String format() {
+        return "[" + llx + " " + lly + " " + urx + " " + ury + "]";
     }
 
-    /**
-     * Create a PDF string for this rectangle.
-     *
-     * @return the pdf string
-     */
-    public String toPDFString() {
-        return new String(" [" + llx + " " + lly + " " + urx + " " + ury
-                          + "] ");
+    /** {@inheritDoc} */
+    public String toString() {
+        return "PDFRectangle" + format();
     }
 
+    /** {@inheritDoc} */
+    public void outputInline(OutputStream out, Writer writer) throws IOException {
+        writer.write(format());
+    }
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFResourceContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFResourceContext.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFResourceContext.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFResourceContext.java Thu Mar  6 05:33:44 2008
@@ -33,17 +33,7 @@
  * to the memory profile this was causing OOM issues. So, we store
  * only the object ID of the parent, rather than the parent itself.
  */
-public class PDFResourceContext extends PDFObject {
-
-    /**
-     * the page's /Resource object
-     */
-    protected PDFResources resources;
-
-    /**
-     * the list of annotation objects for this page
-     */
-    protected PDFAnnotList annotList;
+public class PDFResourceContext extends PDFDictionary {
 
     /**
      * Creates a new ResourceContext.
@@ -54,9 +44,7 @@
         super();
 
         /* set fields using parameters */
-        //this.document = doc;
-        this.resources = resources;
-        this.annotList = null;
+        put("Resources", resources);
     }
 
     /**
@@ -65,7 +53,7 @@
      * @return the resources in this resource context
      */
     public PDFResources getPDFResources() {
-        return this.resources;
+        return (PDFResources)get("Resources");
     }
 
     /**
@@ -74,10 +62,12 @@
      * @param annot a PDFAnnotList list of annotations
      */
     public void addAnnotation(PDFObject annot) {
-        if (this.annotList == null) {
-            this.annotList = getDocument().getFactory().makeAnnotList();
+        PDFAnnotList annotList = getAnnotations();
+        if (annotList == null) {
+            annotList = getDocument().getFactory().makeAnnotList();
+            put("Annots", annotList);
         }
-        this.annotList.addAnnot(annot);
+        annotList.addAnnot(annot);
     }
 
     /**
@@ -86,7 +76,7 @@
      * @return the current annotation list
      */
     public PDFAnnotList getAnnotations() {
-        return this.annotList;
+        return (PDFAnnotList)get("Annots");
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFRoot.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFRoot.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFRoot.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFRoot.java Thu Mar  6 05:33:44 2008
@@ -232,4 +232,24 @@
         }
     }
     
+    /**
+     * Returns the language identifier of the document.
+     * @return the language identifier of the document (or null if not set or undefined)
+     * @since PDF 1.4
+     */
+    public String getLanguage() {
+        return (String)get("Lang");
+    }
+    
+    /**
+     * Sets the language identifier of the document.
+     * @param lang the language identifier of the document.
+     */
+    public void setLanguage(String lang) {
+        if (lang == null) {
+            throw new NullPointerException("lang must not be null");
+        }
+        put("Lang", lang);
+    }
+    
 }

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFT1Stream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFT1Stream.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFT1Stream.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFT1Stream.java Thu Mar  6 05:33:44 2008
@@ -23,7 +23,6 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
-// FOP
 import org.apache.fop.fonts.type1.PFBData;
 
 /**
@@ -54,7 +53,9 @@
         if (pfb == null) {
             throw new IllegalStateException("pfb must not be null at this point");
         }
-        log.debug("Writing " + pfb.getLength() + " bytes of Type 1 font data");
+        if (log.isDebugEnabled()) {
+            log.debug("Writing " + pfb.getLength() + " bytes of Type 1 font data");
+        }
 
         int length = super.output(stream);
         log.debug("Embedded Type1 font");

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFTTFStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFTTFStream.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFTTFStream.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFTTFStream.java Thu Mar  6 05:33:44 2008
@@ -44,7 +44,9 @@
      */
     protected int output(java.io.OutputStream stream)
             throws java.io.IOException {
-        log.debug("Writing " + origLength + " bytes of TTF font data");
+        if (log.isDebugEnabled()) {
+            log.debug("Writing " + origLength + " bytes of TTF font data");
+        }
 
         int length = super.output(stream);
         log.debug("Embedded TrueType/OpenType font");

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java Thu Mar  6 05:33:44 2008
@@ -19,7 +19,8 @@
  
 package org.apache.fop.pdf;
 
-import org.apache.fop.fonts.CIDFont;
+import java.io.IOException;
+import java.io.Writer;
 
 /**
  * Class representing ToUnicode CMaps.
@@ -37,249 +38,251 @@
 public class PDFToUnicodeCMap extends PDFCMap {
 
     /**
-     * handle to read font
+     * The array of Unicode characters ordered by character code
+     * (maps from character code to Unicode code point).
      */
-    protected CIDFont cidFont;
+    protected char[] unicodeCharMap;
 
     /**
      * Constructor.
      *
-     * @param cidMetrics the CID font for which this Unicode CMap is built
+     * @param unicodeCharMap An array of Unicode characters ordered by character code
+     *                          (maps from character code to Unicode code point)
      * @param name One of the registered names found in Table 5.14 in PDF
      * Reference, Second Edition.
      * @param sysInfo The attributes of the character collection of the CIDFont.
      */
-    public PDFToUnicodeCMap(CIDFont cidMetrics, String name, PDFCIDSystemInfo sysInfo) {
+    public PDFToUnicodeCMap(char[] unicodeCharMap, String name, PDFCIDSystemInfo sysInfo) {
         super(name, sysInfo);
-        cidFont = cidMetrics;
+        this.unicodeCharMap = unicodeCharMap;
     }
 
     /** {@inheritDoc} */
-    public void fillInPDF(StringBuffer p) {
-        writeCIDInit(p);
-        writeCIDSystemInfo(p);
-        writeVersionTypeName(p);
-        writeCodeSpaceRange(p);
-        writeBFEntries(p);
-        writeWrapUp(p);
-        add(p.toString());
+    protected CMapBuilder createCMapBuilder(Writer writer) {
+        return new ToUnicodeCMapBuilder(writer);
     }
-
-    /** {@inheritDoc} */
-    protected void writeCIDSystemInfo(StringBuffer p) {
-        p.append("/CIDSystemInfo\n");
-        p.append("<< /Registry (Adobe)\n");
-        p.append("/Ordering (UCS)\n");
-        p.append("/Supplement 0\n");
-        p.append(">> def\n");
-    }
-
-    /** {@inheritDoc} */
-    protected void writeVersionTypeName(StringBuffer p) {
-        p.append("/CMapName /Adobe-Identity-UCS def\n");
-        p.append("/CMapType 2 def\n");
-    }
-
-    /**
-     * Writes the character mappings for this font.
-     * @param p StingBuffer to write to
-     */
-    protected void writeBFEntries(StringBuffer p) {
-        if (cidFont == null) {
-            return;
+    
+    class ToUnicodeCMapBuilder extends CMapBuilder {
+        
+        public ToUnicodeCMapBuilder(Writer writer) {
+            super(writer, null);
         }
 
-        char[] charArray = cidFont.getCharsUsed();
-
-        if (charArray != null) {
-            writeBFCharEntries(p, charArray);
-            writeBFRangeEntries(p, charArray);
+        /**
+         * Writes the CMap to a Writer.
+         * @param writer the writer
+         * @throws IOException if an I/O error occurs
+         */
+        public void writeCMap() throws IOException {
+            writeCIDInit();
+            writeCIDSystemInfo("Adobe", "UCS", 0);
+            writeName("Adobe-Identity-UCS");
+            writeType("2");
+            writeCodeSpaceRange();
+            writeBFEntries();
+            writeWrapUp();
+        }
+        
+        /**
+         * Writes the character mappings for this font.
+         * @param p StingBuffer to write to
+         */
+        protected void writeBFEntries() throws IOException {
+            if (unicodeCharMap != null) {
+                writeBFCharEntries(unicodeCharMap);
+                writeBFRangeEntries(unicodeCharMap);
+            }
         }
-    }
 
-    /**
-     * Writes the entries for single characters of a base font (only characters which cannot be
-     * expressed as part of a character range).
-     * @param p StringBuffer to write to
-     * @param charArray all the characters to map
-     */
-    protected void writeBFCharEntries(StringBuffer p, char[] charArray) {
-        int totalEntries = 0;
-        for (int i = 0; i < charArray.length; i++) {
-            if (!partOfRange(charArray, i)) {
-                totalEntries++;
+        /**
+         * Writes the entries for single characters of a base font (only characters which cannot be
+         * expressed as part of a character range).
+         * @param p StringBuffer to write to
+         * @param charArray all the characters to map
+         * @throws IOException 
+         */
+        protected void writeBFCharEntries(char[] charArray) throws IOException {
+            int totalEntries = 0;
+            for (int i = 0; i < charArray.length; i++) {
+                if (!partOfRange(charArray, i)) {
+                    totalEntries++;
+                }
             }
-        }
-        if (totalEntries < 1) {
-            return;
-        }
-        int remainingEntries = totalEntries;
-        int charIndex = 0;
-        do {
-            /* Limited to 100 entries in each section */
-            int entriesThisSection = Math.min(remainingEntries, 100);
-            p.append(entriesThisSection + " beginbfchar\n");
-            for (int i = 0; i < entriesThisSection; i++) {
-                /* Go to the next char not in a range */
-                while (partOfRange(charArray, charIndex)) {
+            if (totalEntries < 1) {
+                return;
+            }
+            int remainingEntries = totalEntries;
+            int charIndex = 0;
+            do {
+                /* Limited to 100 entries in each section */
+                int entriesThisSection = Math.min(remainingEntries, 100);
+                writer.write(entriesThisSection + " beginbfchar\n");
+                for (int i = 0; i < entriesThisSection; i++) {
+                    /* Go to the next char not in a range */
+                    while (partOfRange(charArray, charIndex)) {
+                        charIndex++;
+                    }
+                    writer.write("<" + padHexString(Integer.toHexString(charIndex), 4) + "> ");
+                    writer.write("<" + padHexString(Integer.toHexString(charArray[charIndex]), 4)
+                            + ">\n");
                     charIndex++;
                 }
-                p.append("<" + padHexString(Integer.toHexString(charIndex), 4) + "> ");
-                p.append("<" + padHexString(Integer.toHexString(charArray[charIndex]), 4) + ">\n");
-                charIndex++;
-            }
-            remainingEntries -= entriesThisSection;
-            p.append("endbfchar\n");
-        } while (remainingEntries > 0);
-    }
+                remainingEntries -= entriesThisSection;
+                writer.write("endbfchar\n");
+            } while (remainingEntries > 0);
+        }
 
-    /**
-     * Writes the entries for character ranges for a base font.
-     * @param p StringBuffer to write to
-     * @param charArray all the characters to map
-     */
-    protected void writeBFRangeEntries(StringBuffer p, char[] charArray) {
-        int totalEntries = 0;
-        for (int i = 0; i < charArray.length; i++) {
-            if (startOfRange(charArray, i)) {
-                totalEntries++;
+        /**
+         * Writes the entries for character ranges for a base font.
+         * @param p StringBuffer to write to
+         * @param charArray all the characters to map
+         * @throws IOException 
+         */
+        protected void writeBFRangeEntries(char[] charArray) throws IOException {
+            int totalEntries = 0;
+            for (int i = 0; i < charArray.length; i++) {
+                if (startOfRange(charArray, i)) {
+                    totalEntries++;
+                }
             }
-        }
-        if (totalEntries < 1) {
-            return;
-        }
-        int remainingEntries = totalEntries;
-        int charIndex = 0;
-        do {
-            /* Limited to 100 entries in each section */
-            int entriesThisSection = Math.min(remainingEntries, 100);
-            p.append(entriesThisSection + " beginbfrange\n");
-            for (int i = 0; i < entriesThisSection; i++) {
-                /* Go to the next start of a range */
-                while (!startOfRange(charArray, charIndex)) {
+            if (totalEntries < 1) {
+                return;
+            }
+            int remainingEntries = totalEntries;
+            int charIndex = 0;
+            do {
+                /* Limited to 100 entries in each section */
+                int entriesThisSection = Math.min(remainingEntries, 100);
+                writer.write(entriesThisSection + " beginbfrange\n");
+                for (int i = 0; i < entriesThisSection; i++) {
+                    /* Go to the next start of a range */
+                    while (!startOfRange(charArray, charIndex)) {
+                        charIndex++;
+                    }
+                    writer.write("<" + padHexString(Integer.toHexString(charIndex), 4) + "> ");
+                    writer.write("<"
+                            + padHexString(Integer.toHexString(endOfRange(charArray, charIndex)), 4)
+                            + "> ");
+                    writer.write("<" + padHexString(Integer.toHexString(charArray[charIndex]), 4)
+                            + ">\n");
                     charIndex++;
                 }
-                p.append("<" + padHexString(Integer.toHexString(charIndex), 4) + "> ");
-                p.append("<"
-                        + padHexString(Integer.toHexString(endOfRange(charArray, charIndex)), 4)
-                        + "> ");
-                p.append("<" + padHexString(Integer.toHexString(charArray[charIndex]), 4) + ">\n");
-                charIndex++;
-            }
-            remainingEntries -= entriesThisSection;
-            p.append("endbfrange\n");
-        } while (remainingEntries > 0);
-    }
-
-    /**
-     * Find the end of the current range.
-     * @param charArray The array which is being tested.
-     * @param startOfRange The index to the array element that is the start of
-     * the range.
-     * @return The index to the element that is the end of the range.
-     */
-    private int endOfRange(char[] charArray, int startOfRange) {
-        int i = startOfRange;
-        while (i < charArray.length - 1 && sameRangeEntryAsNext(charArray, i)) {
-            i++;
+                remainingEntries -= entriesThisSection;
+                writer.write("endbfrange\n");
+            } while (remainingEntries > 0);
         }
-        return i;
-    }
 
-    /**
-     * Determine whether this array element should be part of a bfchar entry or
-     * a bfrange entry.
-     * @param charArray The array to be tested.
-     * @param arrayIndex The index to the array element to be tested.
-     * @return True if this array element should be included in a range.
-     */
-    private boolean partOfRange(char[] charArray, int arrayIndex) {
-        if (charArray.length < 2) {
-            return false;
-        }
-        if (arrayIndex == 0) {
-            return sameRangeEntryAsNext(charArray, 0);
-        }
-        if (arrayIndex == charArray.length - 1) {
-            return sameRangeEntryAsNext(charArray, arrayIndex - 1);
-        }
-        if (sameRangeEntryAsNext(charArray, arrayIndex - 1)) {
-            return true;
-        }
-        if (sameRangeEntryAsNext(charArray, arrayIndex)) {
-            return true;
+        /**
+         * Find the end of the current range.
+         * @param charArray The array which is being tested.
+         * @param startOfRange The index to the array element that is the start of
+         * the range.
+         * @return The index to the element that is the end of the range.
+         */
+        private int endOfRange(char[] charArray, int startOfRange) {
+            int i = startOfRange;
+            while (i < charArray.length - 1 && sameRangeEntryAsNext(charArray, i)) {
+                i++;
+            }
+            return i;
         }
-        return false;
-    }
 
-    /**
-     * Determine whether two bytes can be written in the same bfrange entry.
-     * @param charArray The array to be tested.
-     * @param firstItem The first of the two items in the array to be tested.
-     * The second item is firstItem + 1.
-     * @return True if both 1) the next item in the array is sequential with
-     * this one, and 2) the first byte of the character in the first position
-     * is equal to the first byte of the character in the second position.
-     */
-    private boolean sameRangeEntryAsNext(char[] charArray, int firstItem) {
-        if (charArray[firstItem] + 1 != charArray[firstItem + 1]) {
-            return false;
-        }
-        if (firstItem / 256 != (firstItem + 1) / 256) {
+        /**
+         * Determine whether this array element should be part of a bfchar entry or
+         * a bfrange entry.
+         * @param charArray The array to be tested.
+         * @param arrayIndex The index to the array element to be tested.
+         * @return True if this array element should be included in a range.
+         */
+        private boolean partOfRange(char[] charArray, int arrayIndex) {
+            if (charArray.length < 2) {
+                return false;
+            }
+            if (arrayIndex == 0) {
+                return sameRangeEntryAsNext(charArray, 0);
+            }
+            if (arrayIndex == charArray.length - 1) {
+                return sameRangeEntryAsNext(charArray, arrayIndex - 1);
+            }
+            if (sameRangeEntryAsNext(charArray, arrayIndex - 1)) {
+                return true;
+            }
+            if (sameRangeEntryAsNext(charArray, arrayIndex)) {
+                return true;
+            }
             return false;
         }
-        return true;
-    }
 
-    /**
-     * Determine whether this array element should be the start of a bfrange
-     * entry.
-     * @param charArray The array to be tested.
-     * @param arrayIndex The index to the array element to be tested.
-     * @return True if this array element is the beginning of a range.
-     */
-    private boolean startOfRange(char[] charArray, int arrayIndex) {
-        // Can't be the start of a range if not part of a range.
-        if (!partOfRange(charArray, arrayIndex)) {
-            return false;
-        }
-        // If first element in the array, must be start of a range
-        if (arrayIndex == 0) {
+        /**
+         * Determine whether two bytes can be written in the same bfrange entry.
+         * @param charArray The array to be tested.
+         * @param firstItem The first of the two items in the array to be tested.
+         * The second item is firstItem + 1.
+         * @return True if both 1) the next item in the array is sequential with
+         * this one, and 2) the first byte of the character in the first position
+         * is equal to the first byte of the character in the second position.
+         */
+        private boolean sameRangeEntryAsNext(char[] charArray, int firstItem) {
+            if (charArray[firstItem] + 1 != charArray[firstItem + 1]) {
+                return false;
+            }
+            if (firstItem / 256 != (firstItem + 1) / 256) {
+                return false;
+            }
             return true;
         }
-        // If last element in the array, cannot be start of a range
-        if (arrayIndex == charArray.length - 1) {
-            return false;
-        }
-        /*
-         * If part of same range as the previous element is, cannot be start
-         * of range.
+
+        /**
+         * Determine whether this array element should be the start of a bfrange
+         * entry.
+         * @param charArray The array to be tested.
+         * @param arrayIndex The index to the array element to be tested.
+         * @return True if this array element is the beginning of a range.
          */
-        if (sameRangeEntryAsNext(charArray, arrayIndex - 1)) {
-            return false;
+        private boolean startOfRange(char[] charArray, int arrayIndex) {
+            // Can't be the start of a range if not part of a range.
+            if (!partOfRange(charArray, arrayIndex)) {
+                return false;
+            }
+            // If first element in the array, must be start of a range
+            if (arrayIndex == 0) {
+                return true;
+            }
+            // If last element in the array, cannot be start of a range
+            if (arrayIndex == charArray.length - 1) {
+                return false;
+            }
+            /*
+             * If part of same range as the previous element is, cannot be start
+             * of range.
+             */
+            if (sameRangeEntryAsNext(charArray, arrayIndex - 1)) {
+                return false;
+            }
+            // Otherwise, this is start of a range.
+            return true;
         }
-        // Otherwise, this is start of a range.
-        return true;
-    }
 
-    /**
-     * Prepends the input string with a sufficient number of "0" characters to
-     * get the returned string to be numChars length.
-     * @param input The input string.
-     * @param numChars The minimum characters in the output string.
-     * @return The padded string.
-     */
-    public static String padHexString(String input, int numChars) {
-        int length = input.length();
-        if (length >= numChars) {
-            return input;
-        }
-        StringBuffer returnString = new StringBuffer();
-        for (int i = 1; i <= numChars - length; i++) {
-            returnString.append("0");
+        /**
+         * Prepends the input string with a sufficient number of "0" characters to
+         * get the returned string to be numChars length.
+         * @param input The input string.
+         * @param numChars The minimum characters in the output string.
+         * @return The padded string.
+         */
+        private String padHexString(String input, int numChars) {
+            int length = input.length();
+            if (length >= numChars) {
+                return input;
+            }
+            StringBuffer returnString = new StringBuffer();
+            for (int i = 1; i <= numChars - length; i++) {
+                returnString.append("0");
+            }
+            returnString.append(input);
+            return returnString.toString();
         }
-        returnString.append(input);
-        return returnString.toString();
-    }
 
+    }    
+    
 }

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/PDFXMode.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/TransitionDictionary.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/TransitionDictionary.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/TransitionDictionary.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/pdf/TransitionDictionary.java Thu Mar  6 05:33:44 2008
@@ -19,50 +19,21 @@
  
 package org.apache.fop.pdf;
 
-import java.util.Map;
-import java.util.Iterator;
-
 /**
  * Transition Dictionary
  * This class is used to build a transition dictionary to
  * specify the transition between pages.
  */
-public class TransitionDictionary extends PDFObject {
-
-    private Map dictionaryValues;
+public class TransitionDictionary extends PDFDictionary {
 
     /**
      * Create a Transition Dictionary
      *
      * @param values the dictionary values to output
      */
-    public TransitionDictionary(Map values) {
-        dictionaryValues = values;
+    public TransitionDictionary() {
+        put("Type", new PDFName("Trans"));
     }
 
-    /**
-     * Get the dictionary.
-     * This returns the string containing the dictionary values.
-     *
-     * @return the string with the dictionary values
-     */
-    public String getDictionary() {
-        StringBuffer sb = new StringBuffer();
-        sb.append("/Type /Trans\n");
-        for (Iterator iter = dictionaryValues.keySet().iterator(); iter.hasNext();) {
-            Object key = iter.next();
-            sb.append(key + " " + dictionaryValues.get(key) + "\n");
-        }
-        return sb.toString();
-    }
-
-    /**
-     * there is nothing to return for the toPDF method, as it should not be called
-     *
-     * @return an empty string
-     */
-    public byte[] toPDF() {
-        return new byte[0];
-    }
 }
 

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java Thu Mar  6 05:33:44 2008
@@ -1,69 +1,69 @@
-/*
- * 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.render;
-
-import java.io.OutputStream;
-
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.fo.FOEventHandler;
-
-/**
- * Base class for factory classes which instantiate FOEventHandlers and provide information
- * about them.
- */
-public abstract class AbstractFOEventHandlerMaker {
-    
-    /**
-     * Instantiates a new FOEventHandler.
-     * @param ua the user agent
-     * @param out OutputStream for the FOEventHandler to use
-     * @return the newly instantiated FOEventHandler
-     * @throws FOPException if a problem occurs while creating the event handler
-     */
-    public abstract FOEventHandler makeFOEventHandler(FOUserAgent ua, OutputStream out)
-            throws FOPException;
-
-    /**
-     * @return Indicates whether this renderer requires an OutputStream to work with.
-     */
-    public abstract boolean needsOutputStream();
-    
-    /**
-     * @return an array of MIME types the renderer supports.
-     */
-    public abstract String[] getSupportedMimeTypes();
-
-    /**
-     * Indicates whether a specific MIME type is supported by this renderer.
-     * @param mimeType the MIME type (ex. "application/rtf")
-     * @return true if the MIME type is supported
-     */
-    public boolean isMimeTypeSupported(String mimeType) {
-        String[] mimes = getSupportedMimeTypes();
-        for (int i = 0; i < mimes.length; i++) {
-            if (mimes[i].equals(mimeType)) {
-                return true;
-            }
-        }
-        return false;
-    }
-    
-}
+/*
+ * 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.render;
+
+import java.io.OutputStream;
+
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.fo.FOEventHandler;
+
+/**
+ * Base class for factory classes which instantiate FOEventHandlers and provide information
+ * about them.
+ */
+public abstract class AbstractFOEventHandlerMaker {
+    
+    /**
+     * Instantiates a new FOEventHandler.
+     * @param ua the user agent
+     * @param out OutputStream for the FOEventHandler to use
+     * @return the newly instantiated FOEventHandler
+     * @throws FOPException if a problem occurs while creating the event handler
+     */
+    public abstract FOEventHandler makeFOEventHandler(FOUserAgent ua, OutputStream out)
+            throws FOPException;
+
+    /**
+     * @return Indicates whether this renderer requires an OutputStream to work with.
+     */
+    public abstract boolean needsOutputStream();
+    
+    /**
+     * @return an array of MIME types the renderer supports.
+     */
+    public abstract String[] getSupportedMimeTypes();
+
+    /**
+     * Indicates whether a specific MIME type is supported by this renderer.
+     * @param mimeType the MIME type (ex. "application/rtf")
+     * @return true if the MIME type is supported
+     */
+    public boolean isMimeTypeSupported(String mimeType) {
+        String[] mimes = getSupportedMimeTypes();
+        for (int i = 0; i < mimes.length; i++) {
+            if (mimes[i].equals(mimeType)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+}

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractFOEventHandlerMaker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java Thu Mar  6 05:33:44 2008
@@ -406,7 +406,8 @@
         
     }
     
-    private final QName FOX_TRANSFORM = new QName(ExtensionElementMapping.URI, "fox:transform");
+    private static final QName FOX_TRANSFORM
+            = new QName(ExtensionElementMapping.URI, "fox:transform");
     
     /** {@inheritDoc} */
     protected void renderBlockViewport(BlockViewport bv, List children) {

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRenderer.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRenderer.java Thu Mar  6 05:33:44 2008
@@ -25,32 +25,35 @@
 import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.util.List;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
-// XML
 import org.w3c.dom.Document;
 
-// FOP
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.BeforeFloat;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.BlockViewport;
 import org.apache.fop.area.BodyRegion;
 import org.apache.fop.area.CTM;
-import org.apache.fop.area.NormalFlow;
 import org.apache.fop.area.Footnote;
 import org.apache.fop.area.LineArea;
 import org.apache.fop.area.MainReference;
-import org.apache.fop.area.Span;
+import org.apache.fop.area.NormalFlow;
+import org.apache.fop.area.OffDocumentItem;
 import org.apache.fop.area.Page;
+import org.apache.fop.area.PageSequence;
 import org.apache.fop.area.PageViewport;
-import org.apache.fop.area.RegionViewport;
 import org.apache.fop.area.RegionReference;
+import org.apache.fop.area.RegionViewport;
+import org.apache.fop.area.Span;
 import org.apache.fop.area.Trait;
-import org.apache.fop.area.OffDocumentItem;
 import org.apache.fop.area.inline.Character;
 import org.apache.fop.area.inline.Container;
 import org.apache.fop.area.inline.ForeignObject;
@@ -60,15 +63,12 @@
 import org.apache.fop.area.inline.InlineParent;
 import org.apache.fop.area.inline.Leader;
 import org.apache.fop.area.inline.Space;
-import org.apache.fop.area.inline.Viewport;
+import org.apache.fop.area.inline.SpaceArea;
 import org.apache.fop.area.inline.TextArea;
+import org.apache.fop.area.inline.Viewport;
 import org.apache.fop.area.inline.WordArea;
-import org.apache.fop.area.inline.SpaceArea;
-import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fonts.FontInfo;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  * Abstract base class for all renderers. The Abstract renderer does all the
@@ -171,15 +171,7 @@
         return this.currentPageViewport;
     }
     
-    /**
-     * Prepare a page for rendering. This is called if the renderer supports
-     * out of order rendering. The renderer should prepare the page so that a
-     * page further on in the set of pages can be rendered. The body of the
-     * page should not be rendered. The page will be rendered at a later time
-     * by the call to render page.
-     *
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public void preparePage(PageViewport page) { }
 
     /**
@@ -219,6 +211,11 @@
     public void startPageSequence(LineArea seqTitle) {
         //do nothing
     }
+    
+    /** {@inheritDoc} */
+    public void startPageSequence(PageSequence pageSequence) {
+        startPageSequence(pageSequence.getTitle());
+    }
 
     // normally this would be overriden to create a page in the
     // output
@@ -557,31 +554,20 @@
             int saveIP = currentIPPosition;
             int saveBP = currentBPPosition;
 
-            if (block.getPositioning() == Block.ABSOLUTE) {
-                currentIPPosition += block.getXOffset();
-                currentBPPosition += block.getYOffset();
-                currentBPPosition += block.getSpaceBefore();
+            currentIPPosition += block.getXOffset();
+            currentBPPosition += block.getYOffset();
+            currentBPPosition += block.getSpaceBefore();
 
-                handleBlockTraits(block);
+            handleBlockTraits(block);
 
-                if (children != null) {
-                    renderBlocks(block, children);
-                }
+            if (children != null) {
+                renderBlocks(block, children);
+            }
 
+            if (block.getPositioning() == Block.ABSOLUTE) {
                 // absolute blocks do not effect the layout
                 currentBPPosition = saveBP;
             } else {
-                // relative blocks are offset
-                currentIPPosition += block.getXOffset();
-                currentBPPosition += block.getYOffset();
-                currentBPPosition += block.getSpaceBefore();
-
-                handleBlockTraits(block);
-
-                if (children != null) {
-                    renderBlocks(block, children);
-                }
-
                 // stacked and relative blocks effect stacking
                 currentIPPosition = saveIP;
                 currentBPPosition = saveBP + block.getAllocBPD();

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererConfigurator.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererConfigurator.java Thu Mar  6 05:33:44 2008
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-/* $Id: $ */
+/* $Id$ */
 
 package org.apache.fop.render;
 

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererMaker.java?rev=634267&r1=634266&r2=634267&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererMaker.java Thu Mar  6 05:33:44 2008
@@ -1,71 +1,71 @@
-/*
- * 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.render;
-
-import org.apache.fop.apps.FOUserAgent;
-
-/**
- * Base class for factory classes which instantiate Renderers and provide information
- * about them.
- */
-public abstract class AbstractRendererMaker {
-    
-    /**
-     * Instantiates a new renderer.
-     * @param userAgent the user agent
-     * @return the newly instantiated renderer
-     */
-    public abstract Renderer makeRenderer(FOUserAgent userAgent);
-
-    /**
-     * @return Indicates whether this renderer requires an OutputStream to work with.
-     */
-    public abstract boolean needsOutputStream();
-    
-    /**
-     * @return an array of MIME types the renderer supports.
-     */
-    public abstract String[] getSupportedMimeTypes();
-
-    /**
-     * Returns a renderer config object that can be used to
-     * configure the renderer.
-     * @param userAgent user agent
-     * @return a config object that can be used to configure the renderer
-     */
-    public RendererConfigurator getConfigurator(FOUserAgent userAgent) {
-        return null;
-    }
-
-    /**
-     * Indicates whether a specific MIME type is supported by this renderer.
-     * @param mimeType the MIME type (ex. "application/pdf")
-     * @return true if the MIME type is supported
-     */
-    public boolean isMimeTypeSupported(String mimeType) {
-        String[] mimes = getSupportedMimeTypes();
-        for (int i = 0; i < mimes.length; i++) {
-            if (mimes[i].equals(mimeType)) {
-                return true;
-            }
-        }
-        return false;
-    }
-}
+/*
+ * 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.render;
+
+import org.apache.fop.apps.FOUserAgent;
+
+/**
+ * Base class for factory classes which instantiate Renderers and provide information
+ * about them.
+ */
+public abstract class AbstractRendererMaker {
+    
+    /**
+     * Instantiates a new renderer.
+     * @param userAgent the user agent
+     * @return the newly instantiated renderer
+     */
+    public abstract Renderer makeRenderer(FOUserAgent userAgent);
+
+    /**
+     * @return Indicates whether this renderer requires an OutputStream to work with.
+     */
+    public abstract boolean needsOutputStream();
+    
+    /**
+     * @return an array of MIME types the renderer supports.
+     */
+    public abstract String[] getSupportedMimeTypes();
+
+    /**
+     * Returns a renderer config object that can be used to
+     * configure the renderer.
+     * @param userAgent user agent
+     * @return a config object that can be used to configure the renderer
+     */
+    public RendererConfigurator getConfigurator(FOUserAgent userAgent) {
+        return null;
+    }
+
+    /**
+     * Indicates whether a specific MIME type is supported by this renderer.
+     * @param mimeType the MIME type (ex. "application/pdf")
+     * @return true if the MIME type is supported
+     */
+    public boolean isMimeTypeSupported(String mimeType) {
+        String[] mimes = getSupportedMimeTypes();
+        for (int i = 0; i < mimes.length; i++) {
+            if (mimes[i].equals(mimeType)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/AbstractRendererMaker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/render/DefaultFontResolver.java
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
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