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 vh...@apache.org on 2010/08/25 18:49:40 UTC

svn commit: r989216 [13/19] - in /xmlgraphics/fop/branches/Temp_TrueTypeInPostScript: ./ examples/plan/src/org/apache/fop/plan/ lib/ src/codegen/java/org/apache/fop/tools/ src/codegen/unicode/data/ src/codegen/unicode/java/org/apache/fop/hyphenation/ s...

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/CollapsingBorderModel.java Wed Aug 25 16:49:26 2010
@@ -196,7 +196,7 @@ public abstract class CollapsingBorderMo
      * @param border1 a border specification
      * @param border2 another border specification
      * @return the winning border, null if the two borders are equivalent
-     * @see determineWinner
+     * @see #determineWinner(BorderSpecification,BorderSpecification,boolean)
      */
     public abstract BorderSpecification determineWinner(BorderSpecification border1,
             BorderSpecification border2);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java Wed Aug 25 16:49:26 2010
@@ -33,7 +33,7 @@ import org.apache.fop.layoutmgr.Position
  * The caption contains blocks that are positioned next to the
  * table on the caption side.
  * The caption blocks have an implicit keep with the table.
- * @todo Implement getNextKnuthElements()
+ * @asf.todo Implement getNextKnuthElements()
  */
 public class TableAndCaptionLayoutManager extends BlockStackingLayoutManager {
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java Wed Aug 25 16:49:26 2010
@@ -31,7 +31,7 @@ import org.apache.fop.layoutmgr.Position
  * LayoutManager for a table-caption FO.
  * The table caption contains blocks that are placed beside the
  * table.
- * @todo Implement getNextKnuthElements()
+ * @asf.todo Implement getNextKnuthElements()
  */
 public class TableCaptionLayoutManager extends BlockStackingLayoutManager {
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Wed Aug 25 16:49:26 2010
@@ -277,17 +277,10 @@ public class TableCellLayoutManager exte
      * this row is placed on a previous page). Used to calculate the placement of the
      * row's background image if any
      */
-    public void addAreas(PositionIterator parentIter,
-                         LayoutContext layoutContext,
-                         int[] spannedGridRowHeights,
-                         int startRow,
-                         int endRow,
-                         int borderBeforeWhich,
-                         int borderAfterWhich,
-                         boolean firstOnPage,
-                         boolean lastOnPage,
-                         RowPainter painter,
-                         int firstRowHeight) {
+    public void addAreas                                        // CSOK: ParameterNumber
+        (PositionIterator parentIter, LayoutContext layoutContext, int[] spannedGridRowHeights,
+         int startRow, int endRow, int borderBeforeWhich, int borderAfterWhich, boolean firstOnPage,
+         boolean lastOnPage, RowPainter painter, int firstRowHeight) {
         getParentArea(null);
 
         addId();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Wed Aug 25 16:49:26 2010
@@ -55,7 +55,7 @@ import org.apache.fop.util.BreakUtil;
 public class TableContentLayoutManager implements PercentBaseContext {
 
     /** Logger **/
-    private static Log log = LogFactory.getLog(TableContentLayoutManager.class);
+    private static final Log LOG = LogFactory.getLog(TableContentLayoutManager.class);
 
     private TableLayoutManager tableLM;
     private TableRowIterator bodyIter;
@@ -127,10 +127,18 @@ public class TableContentLayoutManager i
         return this.footerList;
     }
 
-    /** {@inheritDoc} */
-    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
-        if (log.isDebugEnabled()) {
-            log.debug("==> Columns: " + getTableLM().getColumns());
+    /**
+     * Get a sequence of KnuthElements representing the content
+     * of the node assigned to the LM.
+     *
+     * @param context   the LayoutContext used to store layout information
+     * @param alignment the desired text alignment
+     * @return          the list of KnuthElements
+     * @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int)
+     */
+    public List getNextKnuthElements(LayoutContext context, int alignment) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("==> Columns: " + getTableLM().getColumns());
         }
         KnuthBox headerAsFirst = null;
         KnuthBox headerAsSecondToLast = null;
@@ -140,8 +148,8 @@ public class TableContentLayoutManager i
                     headerIter, context, alignment, TableRowIterator.HEADER);
             this.headerNetHeight
                     = ElementListUtils.calcContentLength(this.headerList);
-            if (log.isDebugEnabled()) {
-                log.debug("==> Header: "
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("==> Header: "
                         + headerNetHeight + " - " + this.headerList);
             }
             TableHeaderFooterPosition pos = new TableHeaderFooterPosition(
@@ -160,8 +168,8 @@ public class TableContentLayoutManager i
                     footerIter, context, alignment, TableRowIterator.FOOTER);
             this.footerNetHeight
                     = ElementListUtils.calcContentLength(this.footerList);
-            if (log.isDebugEnabled()) {
-                log.debug("==> Footer: "
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("==> Footer: "
                         + footerNetHeight + " - " + this.footerList);
             }
             //We can simply add the table footer at the end of the whole list
@@ -369,14 +377,14 @@ public class TableContentLayoutManager i
             } else if (pos instanceof TableContentPosition) {
                 tablePositions.add(pos);
             } else {
-                if (log.isDebugEnabled()) {
-                    log.debug("Ignoring position: " + pos);
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Ignoring position: " + pos);
                 }
             }
         }
         if (lastPos instanceof TableHFPenaltyPosition) {
             TableHFPenaltyPosition penaltyPos = (TableHFPenaltyPosition)lastPos;
-            log.debug("Break at penalty!");
+            LOG.debug("Break at penalty!");
             if (penaltyPos.headerElements != null) {
                 //Header positions for the penalty position are in the last element and need to
                 //be handled first before all other TableContentPositions
@@ -402,7 +410,7 @@ public class TableContentLayoutManager i
 
         if (tablePositions.isEmpty()) {
             // TODO make sure this actually never happens
-            log.error("tablePositions empty."
+            LOG.error("tablePositions empty."
                     + " Please send your FO file to fop-users@xmlgraphics.apache.org");
         } else {
             // Here we are sure that posIter iterates only over TableContentPosition instances

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Wed Aug 25 16:49:26 2010
@@ -240,7 +240,7 @@ public class TableLayoutManager extends 
 
 
         // Elements for the table-header/footer/body
-        LinkedList contentKnuthElements;
+        List contentKnuthElements;
         contentLM = new TableContentLayoutManager(this);
         LayoutContext childLC = new LayoutContext(0);
         /*

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java Wed Aug 25 16:49:26 2010
@@ -28,8 +28,6 @@ import org.apache.fop.fo.FONode.FONodeIt
 import org.apache.fop.fo.flow.table.EffRow;
 import org.apache.fop.fo.flow.table.Table;
 import org.apache.fop.fo.flow.table.TableBody;
-import org.apache.fop.fo.flow.table.TablePart;
-
 
 /**
  * Iterator that lets the table layout manager step over all the rows of a part of the

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/AbstractPDFStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/AbstractPDFStream.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/AbstractPDFStream.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/AbstractPDFStream.java Wed Aug 25 16:49:26 2010
@@ -191,7 +191,7 @@ public abstract class AbstractPDFStream 
         StreamCache encodedStream = null;
         PDFNumber refLength = null;
         final Object lengthEntry;
-        if (getDocument().isEncodingOnTheFly()) {
+        if (isEncodingOnTheFly()) {
             refLength = new PDFNumber();
             getDocumentSafely().registerObject(refLength);
             lengthEntry = refLength;
@@ -218,6 +218,15 @@ public abstract class AbstractPDFStream 
     }
 
     /**
+     * Indicates whether encoding may happen without buffering the encoded data. If this method
+     * returns true, the /Length entry will be an indirect object, a direct object otherwise.
+     * @return true if encoding should happen "on the fly"
+     */
+    protected boolean isEncodingOnTheFly() {
+        return getDocument().isEncodingOnTheFly();
+    }
+
+    /**
      * Populates the dictionary with all necessary entries for the stream.
      * Override this method if you need additional entries.
      * @param lengthEntry value for the /Length entry

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/AlphaRasterImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/AlphaRasterImage.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/AlphaRasterImage.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/AlphaRasterImage.java Wed Aug 25 16:49:26 2010
@@ -116,7 +116,7 @@ public class AlphaRasterImage implements
         return null;
     }
 
-    /** {@inheritDoc} */
+    /** @return null (unless overridden) */
     public String getSoftMask() {
         return null;
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/CMapBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/CMapBuilder.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/CMapBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/CMapBuilder.java Wed Aug 25 16:49:26 2010
@@ -22,11 +22,19 @@ package org.apache.fop.pdf;
 import java.io.IOException;
 import java.io.Writer;
 
+/** A cmap builder. */
 public class CMapBuilder {
 
+    /** name */
     protected String name;
+    /** writer */
     protected Writer writer;
 
+    /**
+     * Construct cmap builder.
+     * @param writer a writer
+     * @param name a name
+     */
     public CMapBuilder(Writer writer, String name) {
         this.writer = writer;
         this.name = name;
@@ -52,12 +60,14 @@ public class CMapBuilder {
         writeUseCMap();
     }
 
+    /** @throws IOException if i/o exception */
     protected void writePreStream() throws IOException {
         // writer.write("/Type /CMap\n");
         // writer.write(sysInfo.toPDFString());
         // writer.write("/CMapName /" + name + EOL);
     }
 
+    /** @throws IOException if i/o exception */
     protected void writeStreamComments() throws IOException {
         writer.write("%!PS-Adobe-3.0 Resource-CMap\n");
         writer.write("%%DocumentNeededResources: ProcSet (CIDInit)\n");
@@ -66,12 +76,19 @@ public class CMapBuilder {
         writer.write("%%EndComments\n");
     }
 
+    /** @throws IOException if i/o exception */
     protected void writeCIDInit() throws IOException {
         writer.write("/CIDInit /ProcSet findresource begin\n");
         writer.write("12 dict begin\n");
         writer.write("begincmap\n");
     }
 
+    /**
+     * @param registry string
+     * @param ordering string
+     * @param supplement string
+     * @throws IOException if i/o exception
+     */
     protected void writeCIDSystemInfo(String registry, String ordering, int supplement)
                 throws IOException {
         writer.write("/CIDSystemInfo 3 dict dup begin\n");
@@ -87,32 +104,50 @@ public class CMapBuilder {
         writer.write("end def\n");
     }
 
+    /** @throws IOException if i/o exception */
     protected void writeCIDSystemInfo() throws IOException {
         writeCIDSystemInfo("Adobe", "Identity", 0);
     }
 
+    /**
+     * @param version a version
+     * @throws IOException if i/o exception
+     */
     protected void writeVersion(String version) throws IOException {
         writer.write("/CMapVersion ");
         writer.write(version);
         writer.write(" def\n");
     }
 
+    /**
+     * @param type a type
+     * @throws IOException if i/o exception
+     */
     protected void writeType(String type) throws IOException {
         writer.write("/CMapType ");
         writer.write(type);
         writer.write(" def\n");
     }
 
+    /**
+     * @param name a name
+     * @throws IOException if i/o exception
+     */
     protected void writeName(String name) throws IOException {
         writer.write("/CMapName /");
         writer.write(name);
         writer.write(" def\n");
     }
 
+    /** @throws IOException if i/o exception */
     protected void writeCodeSpaceRange() throws IOException {
         writeCodeSpaceRange(false);
     }
 
+    /**
+     * @param singleByte true if single byte range
+     * @throws IOException if i/o exception
+     */
     protected void writeCodeSpaceRange(boolean singleByte) throws IOException {
         writer.write("1 begincodespacerange\n");
         if (singleByte) {
@@ -123,18 +158,21 @@ public class CMapBuilder {
         writer.write("endcodespacerange\n");
     }
 
+    /** @throws IOException if i/o exception */
     protected void writeCIDRange() throws IOException {
         writer.write("1 begincidrange\n");
         writer.write("<0000> <FFFF> 0\n");
         writer.write("endcidrange\n");
     }
 
+    /** @throws IOException if i/o exception */
     protected void writeBFEntries() throws IOException {
         // writer.write("1 beginbfrange\n");
         // writer.write("<0020> <0100> <0000>\n");
         // writer.write("endbfrange\n");
     }
 
+    /** @throws IOException if i/o exception */
     protected void writeWrapUp() throws IOException {
         writer.write("endcmap\n");
         writer.write("CMapName currentdict /CMap defineresource pop\n");
@@ -142,11 +180,13 @@ public class CMapBuilder {
         writer.write("end\n");
     }
 
+    /** @throws IOException if i/o exception */
     protected void writeStreamAfterComments() throws IOException {
         writer.write("%%EndResource\n");
         writer.write("%%EOF\n");
     }
 
+    /** does nothing  */
     protected void writeUseCMap() {
         /*
          * writer.write(" /Type /CMap");

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/DestinationComparator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/DestinationComparator.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/DestinationComparator.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/DestinationComparator.java Wed Aug 25 16:49:26 2010
@@ -30,6 +30,7 @@ public class DestinationComparator imple
     return dest1.getIDRef().compareTo(dest2.getIDRef());
   }*/
 
+    /** {@inheritDoc} */
     public int compare (Object obj1, Object obj2) {
         if (obj1 instanceof PDFDestination && obj2 instanceof PDFDestination) {
             PDFDestination dest1 = (PDFDestination)obj1;

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFAMode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFAMode.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFAMode.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFAMode.java Wed Aug 25 16:49:26 2010
@@ -49,7 +49,7 @@ public final class PDFAMode {
      * @return true if this mode obeys the restrictions established by PDF/A-1a.
      */
     public boolean isPDFA1LevelA() {
-        return (this != DISABLED);
+        return (this == PDFA_1A);
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFArray.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFArray.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFArray.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFArray.java Wed Aug 25 16:49:26 2010
@@ -172,6 +172,13 @@ public class PDFArray extends PDFObject 
         this.values.add(new Double(value));
     }
 
+    /**
+     * Clears the PDF array.
+     */
+    public void clear() {
+        this.values.clear();
+    }
+
     /** {@inheritDoc} */
     protected int output(OutputStream stream) throws IOException {
         CountingOutputStream cout = new CountingOutputStream(stream);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFCIDFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFCIDFont.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFCIDFont.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFCIDFont.java Wed Aug 25 16:49:26 2010
@@ -56,9 +56,10 @@ public class PDFCIDFont extends PDFObjec
      * @param supplement Supplement number
      * @param descriptor CID font descriptor
      */
-    public PDFCIDFont(String basefont, CIDFontType cidtype, int dw,
-                      int[] w, String registry, String ordering,
-                      int supplement, PDFCIDFontDescriptor descriptor) {
+    public PDFCIDFont                                           // CSOK: ParameterNumber
+        (String basefont, CIDFontType cidtype, int dw,
+         int[] w, String registry, String ordering,
+         int supplement, PDFCIDFontDescriptor descriptor) {
 
         this(basefont, cidtype, dw,
                 new PDFWArray(w),

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java Wed Aug 25 16:49:26 2010
@@ -26,8 +26,9 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.xmlgraphics.java2d.color.CMYKColorSpace;
-import org.apache.xmlgraphics.java2d.color.ColorExt;
+import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace;
+
+import org.apache.fop.util.ColorExt;
 
 /**
  * PDF Color object.
@@ -122,7 +123,7 @@ public class PDFColor extends PDFPathPai
             ce = (ColorExt)col;
             cs = ce.getOrigColorSpace();
         }
-        if (cs != null && cs instanceof CMYKColorSpace) {
+        if (cs != null && cs instanceof DeviceCMYKColorSpace) {
             // CMYK case
             this.colorSpace = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_CMYK);
             float[] cmyk = (ce == null

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFDocument.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFDocument.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFDocument.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFDocument.java Wed Aug 25 16:49:26 2010
@@ -124,8 +124,8 @@ public class PDFDocument {
     private PDFEncryption encryption;
 
     /** the colorspace (0=RGB, 1=CMYK) */
-    private PDFDeviceColorSpace colorspace =
-        new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
+    private PDFDeviceColorSpace colorspace
+        = new PDFDeviceColorSpace(PDFDeviceColorSpace.DEVICE_RGB);
 
     /** the counter for Pattern name numbering (e.g. 'Pattern1') */
     private int patternCount = 0;
@@ -1017,9 +1017,7 @@ public class PDFDocument {
         output(stream);
         for (int count = 0; count < this.trailerObjects.size(); count++) {
             PDFObject o = (PDFObject)this.trailerObjects.get(count);
-            this.location.set(
-                o.getObjectNumber() - 1,
-                new Integer(this.position));
+            setLocation(o.getObjectNumber() - 1, this.position);
             this.position += o.output(stream);
         }
         /* output the xref table and increment the character position

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFEncryptionJCE.java Wed Aug 25 16:49:26 2010
@@ -21,7 +21,6 @@ package org.apache.fop.pdf;
 
 // Java
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.OutputStream;
 import java.security.InvalidKeyException;
 import java.security.MessageDigest;
@@ -80,26 +79,6 @@ public class PDFEncryptionJCE extends PD
         }
 
         /**
-         * Encode the given data with the filter
-         * @param data The data to be encrypted
-         * @return The encrypted data
-         */
-        public byte[] encode(byte[] data) {
-            return encryption.encryptData(data, number, generation);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        public void encode(InputStream in, OutputStream out, int length)
-                                                        throws IOException {
-            byte[] buffer = new byte[length];
-            in.read(buffer);
-            buffer = encode(buffer);
-            out.write(buffer);
-        }
-
-        /**
          * {@inheritDoc}
          */
         public OutputStream applyFilter(OutputStream out) throws IOException {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFEncryptionManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFEncryptionManager.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFEncryptionManager.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFEncryptionManager.java Wed Aug 25 16:49:26 2010
@@ -31,10 +31,13 @@ import org.apache.commons.logging.LogFac
  * This class acts as a factory for PDF encryption support. It enables the
  * feature to be optional to FOP depending on the availability of JCE.
  */
-public class PDFEncryptionManager {
+public final class PDFEncryptionManager {
+
+    private PDFEncryptionManager() {
+    }
 
     /** logging instance */
-    protected static Log log = LogFactory.getLog(PDFEncryptionManager.class);
+    private static final Log LOG = LogFactory.getLog(PDFEncryptionManager.class);
 
     /**
      * Indicates whether JCE is available.
@@ -60,12 +63,12 @@ public class PDFEncryptionManager {
             Provider[] providers;
             providers = Security.getProviders("Cipher.RC4");
             if (providers == null) {
-                log.warn("Cipher provider for RC4 not available.");
+                LOG.warn("Cipher provider for RC4 not available.");
                 return false;
             }
             providers = Security.getProviders("MessageDigest.MD5");
             if (providers == null) {
-                log.warn("MessageDigest provider for MD5 not available.");
+                LOG.warn("MessageDigest provider for MD5 not available.");
                 return false;
             }
             return true;
@@ -88,13 +91,13 @@ public class PDFEncryptionManager {
         if (params != null) {
             if (!checkAvailableAlgorithms()) {
                 if (isJCEAvailable()) {
-                    log.warn("PDF encryption has been requested, JCE is "
+                    LOG.warn("PDF encryption has been requested, JCE is "
                             + "available but there's no "
                             + "JCE provider available that provides the "
                             + "necessary algorithms. The PDF won't be "
                             + "encrypted.");
                 } else {
-                    log.warn("PDF encryption has been requested but JCE is "
+                    LOG.warn("PDF encryption has been requested but JCE is "
                             + "unavailable! The PDF won't be encrypted.");
                 }
             }
@@ -119,19 +122,19 @@ public class PDFEncryptionManager {
             return (PDFEncryption)obj;
         } catch (ClassNotFoundException e) {
             if (checkAvailableAlgorithms()) {
-                log.warn("JCE and algorithms available, but the "
+                LOG.warn("JCE and algorithms available, but the "
                     + "implementation class unavailable. Please do a full "
                     + "rebuild.");
             }
             return null;
         } catch (NoSuchMethodException e) {
-            log.error(e);
+            LOG.error(e);
             return null;
         } catch (IllegalAccessException e) {
-            log.error(e);
+            LOG.error(e);
             return null;
         } catch (InvocationTargetException e) {
-            log.error(e);
+            LOG.error(e);
             return null;
         }
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFactory.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFactory.java Wed Aug 25 16:49:26 2010
@@ -65,6 +65,9 @@ import org.apache.fop.fonts.type1.PFBPar
  */
 public class PDFFactory {
 
+    /** Resolution of the User Space coordinate system (72dpi). */
+    public static final int DEFAULT_PDF_RESOLUTION = 72;
+
     private PDFDocument document;
 
     private Log log = LogFactory.getLog(PDFFactory.class);
@@ -289,12 +292,13 @@ public class PDFFactory {
      * It should be 0 as this is the constructor for sampled functions.
      * @return the PDF function that was created
      */
-    public PDFFunction makeFunction(int theFunctionType, List theDomain,
-                                    List theRange, List theSize,
-                                    int theBitsPerSample, int theOrder,
-                                    List theEncode, List theDecode,
-                                    StringBuffer theFunctionDataStream,
-                                    List theFilter) {
+    public PDFFunction makeFunction                             // CSOK: ParameterNumber
+        (int theFunctionType, List theDomain,
+         List theRange, List theSize,
+         int theBitsPerSample, int theOrder,
+         List theEncode, List theDecode,
+         StringBuffer theFunctionDataStream,
+         List theFilter) {
         // Type 0 function
         PDFFunction function = new PDFFunction(theFunctionType, theDomain,
                                                theRange, theSize,
@@ -462,12 +466,13 @@ public class PDFFactory {
      * @param theFunction The PDF Function that maps an (x,y) location to a color
      * @return the PDF shading that was created
      */
-    public PDFShading makeShading(PDFResourceContext res, int theShadingType,
-                                  PDFDeviceColorSpace theColorSpace,
-                                  List theBackground, List theBBox,
-                                  boolean theAntiAlias, List theDomain,
-                                  List theMatrix,
-                                  PDFFunction theFunction) {
+    public PDFShading makeShading                               // CSOK: ParameterNumber
+        (PDFResourceContext res, int theShadingType,
+         PDFDeviceColorSpace theColorSpace,
+         List theBackground, List theBBox,
+         boolean theAntiAlias, List theDomain,
+         List theMatrix,
+         PDFFunction theFunction) {
         // make Shading of Type 1
         PDFShading shading = new PDFShading(theShadingType,
                                             theColorSpace, theBackground,
@@ -514,12 +519,13 @@ public class PDFFactory {
      * The default is [false, false]
      * @return the PDF shading that was created
      */
-    public PDFShading makeShading(PDFResourceContext res, int theShadingType,
-                                  PDFDeviceColorSpace theColorSpace,
-                                  List theBackground, List theBBox,
-                                  boolean theAntiAlias, List theCoords,
-                                  List theDomain, PDFFunction theFunction,
-                                  List theExtend) {
+    public PDFShading makeShading                               // CSOK: ParameterNumber
+        (PDFResourceContext res, int theShadingType,
+         PDFDeviceColorSpace theColorSpace,
+         List theBackground, List theBBox,
+         boolean theAntiAlias, List theCoords,
+         List theDomain, PDFFunction theFunction,
+         List theExtend) {
         // make Shading of Type 2 or 3
         PDFShading shading = new PDFShading(theShadingType,
                                             theColorSpace, theBackground,
@@ -567,14 +573,15 @@ public class PDFFactory {
      * @param theFunction the PDFFunction
      * @return the PDF shading that was created
      */
-    public PDFShading makeShading(PDFResourceContext res, int theShadingType,
-                                  PDFDeviceColorSpace theColorSpace,
-                                  List theBackground, List theBBox,
-                                  boolean theAntiAlias,
-                                  int theBitsPerCoordinate,
-                                  int theBitsPerComponent,
-                                  int theBitsPerFlag, List theDecode,
-                                  PDFFunction theFunction) {
+    public PDFShading makeShading                               // CSOK: ParameterNumber
+        (PDFResourceContext res, int theShadingType,
+         PDFDeviceColorSpace theColorSpace,
+         List theBackground, List theBBox,
+         boolean theAntiAlias,
+         int theBitsPerCoordinate,
+         int theBitsPerComponent,
+         int theBitsPerFlag, List theDecode,
+         PDFFunction theFunction) {
         // make Shading of type 4,6 or 7
         PDFShading shading = new PDFShading(theShadingType,
                                             theColorSpace, theBackground,
@@ -622,14 +629,15 @@ public class PDFFactory {
      * @param theFunction The PDFFunction that's mapped on to this shape
      * @return the PDF shading that was created
      */
-    public PDFShading makeShading(PDFResourceContext res, int theShadingType,
-                                  PDFDeviceColorSpace theColorSpace,
-                                  List theBackground, List theBBox,
-                                  boolean theAntiAlias,
-                                  int theBitsPerCoordinate,
-                                  int theBitsPerComponent, List theDecode,
-                                  int theVerticesPerRow,
-                                  PDFFunction theFunction) {
+    public PDFShading makeShading                               // CSOK: ParameterNumber
+        (PDFResourceContext res, int theShadingType,
+         PDFDeviceColorSpace theColorSpace,
+         List theBackground, List theBBox,
+         boolean theAntiAlias,
+         int theBitsPerCoordinate,
+         int theBitsPerComponent, List theDecode,
+         int theVerticesPerRow,
+         PDFFunction theFunction) {
         // make shading of Type 5
         PDFShading shading = new PDFShading(theShadingType,
                                             theColorSpace, theBackground,
@@ -672,11 +680,12 @@ public class PDFFactory {
      * @param thePatternDataStream The stream of pattern data to be tiled.
      * @return the PDF pattern that was created
      */
-    public PDFPattern makePattern(PDFResourceContext res, int thePatternType,    // 1
-                                  PDFResources theResources, int thePaintType, int theTilingType,
-                                  List theBBox, double theXStep,
-                                  double theYStep, List theMatrix,
-                                  List theXUID, StringBuffer thePatternDataStream) {
+    public PDFPattern makePattern                               // CSOK: ParameterNumber
+        (PDFResourceContext res, int thePatternType,    // 1
+         PDFResources theResources, int thePaintType, int theTilingType,
+         List theBBox, double theXStep,
+         double theYStep, List theMatrix,
+         List theXUID, StringBuffer thePatternDataStream) {
         // PDFResources theResources
         PDFPattern pattern = new PDFPattern(theResources, 1,
                                             thePaintType, theTilingType,
@@ -871,7 +880,8 @@ public class PDFFactory {
      */
     public PDFNames makeNames() {
         PDFNames names = new PDFNames();
-        getDocument().registerObject(names);
+        getDocument().assignObjectNumber(names);
+        getDocument().addTrailerObject(names);
         return names;
     }
 
@@ -1044,6 +1054,8 @@ public class PDFFactory {
         return link;
     }
 
+    private static final String EMBEDDED_FILE = "embedded-file:";
+
     /**
      * Create/find and return the appropriate external PDFAction according to the target
      *
@@ -1056,32 +1068,88 @@ public class PDFFactory {
     public PDFAction getExternalAction(String target, boolean newWindow) {
         int index;
         String targetLo = target.toLowerCase();
-        // HTTP URL?
-        if (targetLo.startsWith("http://")) {
+        if (target.startsWith(EMBEDDED_FILE)) {
+            // File Attachments (Embedded Files)
+            String filename = target.substring(EMBEDDED_FILE.length());
+            return getActionForEmbeddedFile(filename, newWindow);
+        } else if (targetLo.startsWith("http://")) {
+            // HTTP URL?
             return new PDFUri(target);
-        // Non PDF files. Try to /Launch them.
         } else if (targetLo.startsWith("file://")) {
+            // Non PDF files. Try to /Launch them.
             target = target.substring("file://".length());
             return getLaunchAction(target);
-        // Bare PDF file name?
         } else if (targetLo.endsWith(".pdf")) {
+            // Bare PDF file name?
             return getGoToPDFAction(target, null, -1, newWindow);
-        // PDF file + page?
-        } else if ((index = targetLo.indexOf(".pdf#page=")) > 0) {
+        } else if ((index = targetLo.indexOf(".pdf#page=")) > 0) { // CSOK: InnerAssignment
+            // PDF file + page?
             String filename = target.substring(0, index + 4);
             int page = Integer.parseInt(target.substring(index + 10));
             return getGoToPDFAction(filename, null, page, newWindow);
-        // PDF file + destination?
-        } else if ((index = targetLo.indexOf(".pdf#dest=")) > 0) {
+        } else if ((index = targetLo.indexOf(".pdf#dest=")) > 0) { // CSOK: InnerAssignment
+            // PDF file + destination?
             String filename = target.substring(0, index + 4);
             String dest = target.substring(index + 10);
             return getGoToPDFAction(filename, dest, -1, newWindow);
-        // None of the above? Default to URI:
         } else {
+            // None of the above? Default to URI:
             return new PDFUri(target);
         }
     }
 
+    private PDFAction getActionForEmbeddedFile(String filename, boolean newWindow) {
+        PDFNames names = getDocument().getRoot().getNames();
+        if (names == null) {
+            throw new IllegalStateException(
+                    "No Names dictionary present."
+                    + " Cannot create Launch Action for embedded file: " + filename);
+        }
+        PDFNameTreeNode embeddedFiles = names.getEmbeddedFiles();
+        if (embeddedFiles == null) {
+            throw new IllegalStateException(
+                    "No /EmbeddedFiles name tree present."
+                    + " Cannot create Launch Action for embedded file: " + filename);
+        }
+
+        //Find filespec reference for the embedded file
+        filename = PDFText.toPDFString(filename, '_');
+        PDFArray files = embeddedFiles.getNames();
+        PDFReference embeddedFileRef = null;
+        int i = 0;
+        while (i < files.length()) {
+            String name = (String)files.get(i);
+            i++;
+            PDFReference ref = (PDFReference)files.get(i);
+            if (name.equals(filename)) {
+                embeddedFileRef = ref;
+                break;
+            }
+            i++;
+        }
+        if (embeddedFileRef == null) {
+            throw new IllegalStateException(
+                    "No embedded file with name " + filename + " present.");
+        }
+
+        //Finally create the action
+        //PDFLaunch action = new PDFLaunch(embeddedFileRef);
+        //This works with Acrobat 8 but not with Acrobat 9
+
+        //The following two options didn't seem to have any effect.
+        //PDFGoToEmbedded action = new PDFGoToEmbedded(embeddedFileRef, 0, newWindow);
+        //PDFGoToRemote action = new PDFGoToRemote(embeddedFileRef, 0, newWindow);
+
+        //This finally seems to work:
+        StringBuffer scriptBuffer = new StringBuffer();
+        scriptBuffer.append("this.exportDataObject({cName:\"");
+        scriptBuffer.append(filename);
+        scriptBuffer.append("\", nLaunch:2});");
+
+        PDFJavaScriptLaunchAction action = new PDFJavaScriptLaunchAction(scriptBuffer.toString());
+        return action;
+    }
+
     /**
      * Create or find a PDF GoTo with the given page reference string and Y offset,
      * and return its PDF object reference

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFileSpec.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFileSpec.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFileSpec.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFileSpec.java Wed Aug 25 16:49:26 2010
@@ -20,15 +20,9 @@
 package org.apache.fop.pdf;
 
 /**
- * class representing a /FileSpec object.
- *
+ * Class representing a /FileSpec object.
  */
-public class PDFFileSpec extends PDFObject {
-
-    /**
-     * the filename
-     */
-    protected String filename;
+public class PDFFileSpec extends PDFDictionary {
 
     /**
      * create a /FileSpec object.
@@ -39,29 +33,30 @@ public class PDFFileSpec extends PDFObje
 
         /* generic creation of object */
         super();
+        put("Type", new PDFName("Filespec"));
+        put("F", filename);
+    }
 
-        this.filename = filename;
+    private String getFilename() {
+        return (String)get("F");
     }
 
     /**
-     * {@inheritDoc}
+     * Associates an dictionary with pointers to embedded file streams with this file spec.
+     * @param embeddedFileDict the dictionary with pointers to embedded file streams
      */
-    public String toPDFString() {
-        return getObjectID()
-                + "<<\n/Type /FileSpec\n"
-                + "/F (" + this.filename + ")\n"
-                + ">>\nendobj\n";
+    public void setEmbeddedFile(PDFDictionary embeddedFileDict) {
+        put("EF", embeddedFileDict);
     }
 
-    /*
-     * example
-     * 29 0 obj
-     * <<
-     * /Type /FileSpec
-     * /F (table1.pdf)
-     * >>
-     * endobj
+    /**
+     * Sets a description for the file spec.
+     * @param description the description
+     * @since PDF 1.6
      */
+    public void setDescription(String description) {
+        put("Desc", description);
+    }
 
     /** {@inheritDoc} */
     protected boolean contentEquals(PDFObject obj) {
@@ -75,7 +70,7 @@ public class PDFFileSpec extends PDFObje
 
         PDFFileSpec spec = (PDFFileSpec)obj;
 
-        if (!spec.filename.equals(filename)) {
+        if (!spec.getFilename().equals(getFilename())) {
             return false;
         }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFontDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFontDescriptor.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFontDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFontDescriptor.java Wed Aug 25 16:49:26 2010
@@ -40,10 +40,11 @@ public class PDFFontDescriptor extends P
      * @param italicAngle the angle of the vertical dominant strokes
      * @param stemV the width of the dominant vertical stems of glyphs
      */
-    public PDFFontDescriptor(String basefont, int ascent,
-                             int descent, int capHeight, int flags,
-                             PDFRectangle fontBBox, int italicAngle,
-                             int stemV) {
+    public PDFFontDescriptor                                    // CSOK: ParameterNumber
+        (String basefont, int ascent,
+         int descent, int capHeight, int flags,
+         PDFRectangle fontBBox, int italicAngle,
+         int stemV) {
         super();
 
         put("Type", new PDFName("FontDescriptor"));

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFormXObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFormXObject.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFormXObject.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFormXObject.java Wed Aug 25 16:49:26 2010
@@ -34,7 +34,6 @@ import java.io.OutputStream;
 public class PDFFormXObject extends PDFXObject {
 
     private PDFStream contents;
-    private PDFReference resRef;
 
     /**
      * create a FormXObject with the given number and name and load the
@@ -47,13 +46,15 @@ public class PDFFormXObject extends PDFX
     public PDFFormXObject(int xnumber, PDFStream contents, PDFReference resources) {
         super();
         put("Name", new PDFName("Form" + xnumber));
-        this.resRef = resources;
         this.contents = contents;
 
         put("Type", new PDFName("XObject"));
         put("Subtype", new PDFName("Form"));
         put("FormType", new Integer(1));
         setMatrix(new AffineTransform());
+        if (resources != null) {
+            put("Resources", resources);
+        }
     }
 
     /**
@@ -172,7 +173,6 @@ public class PDFFormXObject extends PDFX
         if (get("Matrix") == null) {
             put("Matrix", new PDFArray(this, new int[] {1, 0, 0, 1, 0, 0}));
         }
-        put("Resources", resRef);
         super.populateStreamDict(lengthEntry);
     }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFunction.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFFunction.java Wed Aug 25 16:49:26 2010
@@ -211,10 +211,11 @@ public class PDFFunction extends PDFObje
      * @param theFunctionType This is the type of function (0,2,3, or 4).
      * It should be 0 as this is the constructor for sampled functions.
      */
-    public PDFFunction(int theFunctionType, List theDomain,
-                       List theRange, List theSize, int theBitsPerSample,
-                       int theOrder, List theEncode, List theDecode,
-                       StringBuffer theFunctionDataStream, List theFilter) {
+    public PDFFunction                                          // CSOK: ParameterNumber
+        (int theFunctionType, List theDomain,
+         List theRange, List theSize, int theBitsPerSample,
+         int theOrder, List theEncode, List theDecode,
+         StringBuffer theFunctionDataStream, List theFilter) {
         super();
 
         this.functionType = 0;      // dang well better be 0;
@@ -374,7 +375,7 @@ public class PDFFunction extends PDFObje
      *
      * @return the PDF string.
      */
-    public byte[] toPDF() {
+    public byte[] toPDF() {                                     // CSOK: MethodLength
         int vectorSize = 0;
         int numberOfFunctions = 0;
         int tempInt = 0;

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFGoTo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFGoTo.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFGoTo.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFGoTo.java Wed Aug 25 16:49:26 2010
@@ -42,10 +42,8 @@ public class PDFGoTo extends PDFAction {
      * @param pageReference the pageReference represented by this object
      */
     public PDFGoTo(String pageReference) {
-        /* generic creation of object */
         super();
-
-        this.pageReference = pageReference;
+        setPageReference(pageReference);
     }
 
     /**
@@ -56,9 +54,7 @@ public class PDFGoTo extends PDFAction {
      */
     public PDFGoTo(String pageReference, Point2D position) {
         /* generic creation of object */
-        super();
-
-        this.pageReference = pageReference;
+        this(pageReference);
         setPosition(position);
     }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFGoToRemote.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFGoToRemote.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFGoToRemote.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFGoToRemote.java Wed Aug 25 16:49:26 2010
@@ -27,7 +27,7 @@ public class PDFGoToRemote extends PDFAc
     /**
      * the file specification
      */
-    private PDFFileSpec pdfFileSpec;
+    private PDFReference pdfFileSpec;
     private int pageReference = 0;
     private String destination = null;
     private boolean newWindow = false;
@@ -43,12 +43,12 @@ public class PDFGoToRemote extends PDFAc
         /* generic creation of object */
         super();
 
-        this.pdfFileSpec = pdfFileSpec;
+        this.pdfFileSpec = pdfFileSpec.makeReference();
         this.newWindow = newWindow;
     }
 
     /**
-     * create an GoToR object.
+     * Create an GoToR object.
      *
      * @param pdfFileSpec the fileSpec associated with the action
      * @param page a page reference within the remote document
@@ -56,7 +56,18 @@ public class PDFGoToRemote extends PDFAc
      *                  displayed in a new window
      */
     public PDFGoToRemote(PDFFileSpec pdfFileSpec, int page, boolean newWindow) {
-        /* generic creation of object */
+        this(pdfFileSpec.makeReference(), page, newWindow);
+    }
+
+    /**
+     * Create an GoToR object.
+     *
+     * @param pdfFileSpec the fileSpec associated with the action
+     * @param page a page reference within the remote document
+     * @param newWindow boolean indicating whether the target should be
+     *                  displayed in a new window
+     */
+    public PDFGoToRemote(PDFReference pdfFileSpec, int page, boolean newWindow) {
         super();
 
         this.pdfFileSpec = pdfFileSpec;
@@ -76,7 +87,7 @@ public class PDFGoToRemote extends PDFAc
         /* generic creation of object */
         super();
 
-        this.pdfFileSpec = pdfFileSpec;
+        this.pdfFileSpec = pdfFileSpec.makeReference();
         this.destination = dest;
         this.newWindow = newWindow;
     }
@@ -97,7 +108,7 @@ public class PDFGoToRemote extends PDFAc
         StringBuffer sb = new StringBuffer(64);
         sb.append(getObjectID());
         sb.append("<<\n/S /GoToR\n/F ");
-        sb.append(pdfFileSpec.referencePDF());
+        sb.append(pdfFileSpec.toString());
         sb.append("\n");
 
         if (destination != null) {
@@ -139,7 +150,7 @@ public class PDFGoToRemote extends PDFAc
 
         PDFGoToRemote remote = (PDFGoToRemote)obj;
 
-        if (!remote.pdfFileSpec.referencePDF().equals(pdfFileSpec.referencePDF())) {
+        if (!remote.pdfFileSpec.toString().equals(pdfFileSpec.toString())) {
             return false;
         }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFLaunch.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFLaunch.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFLaunch.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFLaunch.java Wed Aug 25 16:49:26 2010
@@ -5,7 +5,7 @@
  * 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
@@ -14,7 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /* $Id$ */
+
 package org.apache.fop.pdf;
 
 /**
@@ -22,21 +24,39 @@ package org.apache.fop.pdf;
  */
 public class PDFLaunch extends PDFAction {
 
-    private PDFFileSpec externalFileSpec;
+    private PDFReference externalFileSpec;
 
+    /**
+     * Creates a new /Launch action.
+     * @param fileSpec the file specification to launch
+     */
     public PDFLaunch(PDFFileSpec fileSpec) {
+        this(fileSpec.makeReference());
+    }
+
+    /**
+     * Creates a new /Launch action.
+     * @param fileSpec a reference to the file specification
+     */
+    public PDFLaunch(PDFReference fileSpec) {
+        PDFObject fs = fileSpec.getObject();
+        if (fs != null) {
+            assert fs instanceof PDFFileSpec;
+        }
         this.externalFileSpec = fileSpec;
     }
 
+    /** {@inheritDoc} */
     public String getAction() {
         return this.referencePDF();
     }
 
+    /** {@inheritDoc} */
     public String toPDFString() {
         StringBuffer sb = new StringBuffer(64);
         sb.append(getObjectID());
         sb.append("<<\n/S /Launch\n/F ");
-        sb.append(externalFileSpec.referencePDF());
+        sb.append(externalFileSpec.toString());
         sb.append(" \n>>\nendobj\n");
 
         return sb.toString();
@@ -54,7 +74,7 @@ public class PDFLaunch extends PDFAction
 
         PDFLaunch launch = (PDFLaunch) obj;
 
-        if (!launch.externalFileSpec.referencePDF().equals(externalFileSpec.referencePDF())) {
+        if (!launch.externalFileSpec.toString().equals(externalFileSpec.toString())) {
             return false;
         }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFMetadata.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFMetadata.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFMetadata.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFMetadata.java Wed Aug 25 16:49:26 2010
@@ -47,7 +47,11 @@ public class PDFMetadata extends PDFStre
     private Metadata xmpMetadata;
     private boolean readOnly = true;
 
-    /** @see org.apache.fop.pdf.PDFObject#PDFObject() */
+    /**
+     * @param xmp xmp metadata
+     * @param readOnly true if read only
+     * @see org.apache.fop.pdf.PDFObject#PDFObject()
+     */
     public PDFMetadata(Metadata xmp, boolean readOnly) {
         super();
         if (xmp == null) {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFName.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFName.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFName.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFName.java Wed Aug 25 16:49:26 2010
@@ -49,16 +49,18 @@ public class PDFName extends PDFObject {
      */
     static String escapeName(String name) {
         StringBuffer sb = new StringBuffer(Math.min(16, name.length() + 4));
-        if (!name.startsWith("/")) {
-            sb.append('/');
+        boolean skipFirst = false;
+        sb.append('/');
+        if (name.startsWith("/")) {
+            skipFirst = true;
         }
-        for (int i = 0, c = name.length(); i < c; i++) {
+        for (int i = (skipFirst ? 1 : 0), c = name.length(); i < c; i++) {
             char ch = name.charAt(i);
-            if (ch >= 33 && ch <= 126) {
-                sb.append(ch);
-            } else {
+            if (ch < 33 || ch > 126 || ch == 0x2F) {
                 sb.append('#');
                 toHex(ch, sb);
+            } else {
+                sb.append(ch);
             }
         }
         return sb.toString();

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNameTreeNode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNameTreeNode.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNameTreeNode.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNameTreeNode.java Wed Aug 25 16:49:26 2010
@@ -19,6 +19,7 @@
 
 package org.apache.fop.pdf;
 
+
 /**
  * Class representing a PDF name tree node.
  */
@@ -104,7 +105,6 @@ public class PDFNameTreeNode extends PDF
         return (String)limits.get(1);
     }
 
-
     private PDFArray prepareLimitsArray() {
         PDFArray limits = (PDFArray)get(LIMITS);
         if (limits == null) {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNames.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNames.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNames.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNames.java Wed Aug 25 16:49:26 2010
@@ -24,6 +24,9 @@ package org.apache.fop.pdf;
  */
 public class PDFNames extends PDFDictionary {
 
+    private static final String DESTS = "Dests";
+    private static final String EMBEDDED_FILES = "EmbeddedFiles";
+
     /**
      * Create the Names object
      */
@@ -37,7 +40,7 @@ public class PDFNames extends PDFDiction
      * @return the Dests object, or null if it's not used
      */
     public PDFDests getDests() {
-        return (PDFDests)get("Dests");
+        return (PDFDests)get(DESTS);
     }
 
     /**
@@ -45,7 +48,23 @@ public class PDFNames extends PDFDiction
      * @param dests the Dests object
      */
     public void setDests(PDFDests dests) {
-        put("Dests", dests);
+        put(DESTS, dests);
+    }
+
+    /**
+     * Returns the EmbeddedFiles object
+     * @return the EmbeddedFiles object, or null if it's not used
+     */
+    public PDFEmbeddedFiles getEmbeddedFiles() {
+        return (PDFEmbeddedFiles)get(EMBEDDED_FILES);
+    }
+
+    /**
+     * Set the EmbeddedFiles object
+     * @param embeddedFiles the EmbeddedFiles object
+     */
+    public void setEmbeddedFiles(PDFEmbeddedFiles embeddedFiles) {
+        put(EMBEDDED_FILES, embeddedFiles);
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNull.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNull.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNull.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNull.java Wed Aug 25 16:49:26 2010
@@ -33,7 +33,6 @@ public final class PDFNull implements PD
 
     /**
      * Creates a new PDF name object.
-     * @param name the name value
      */
     private PDFNull() {
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFPattern.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFPattern.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFPattern.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFPattern.java Wed Aug 25 16:49:26 2010
@@ -117,11 +117,12 @@ public class PDFPattern extends PDFPathP
      * @param theXUID Optional vector of Integers that uniquely identify the pattern
      * @param thePatternDataStream The stream of pattern data to be tiled.
      */
-    public PDFPattern(PDFResources theResources, int thePatternType,    // 1
-                      int thePaintType, int theTilingType, List theBBox,
-                      double theXStep, double theYStep,
-                      List theMatrix, List theXUID,
-                      StringBuffer thePatternDataStream) {
+    public PDFPattern                                           // CSOK: ParameterNumber
+        (PDFResources theResources, int thePatternType,    // 1
+         int thePaintType, int theTilingType, List theBBox,
+         double theXStep, double theYStep,
+         List theMatrix, List theXUID,
+         StringBuffer thePatternDataStream) {
         super();
         this.resources = theResources;
         // This next parameter is implicit to all constructors, and is

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFProfile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFProfile.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFProfile.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFProfile.java Wed Aug 25 16:49:26 2010
@@ -265,4 +265,16 @@ public class PDFProfile {
         }
     }
 
+    /** Checks if embedded files are allowed. */
+    public void verifyEmbeddedFilesAllowed() {
+        final String err = "{0} does not allow embedded files.";
+        if (isPDFAActive()) {
+            throw new PDFConformanceException(format(err, getPDFAMode()));
+        }
+        if (isPDFXActive()) {
+            //Implicit since file specs are forbidden
+            throw new PDFConformanceException(format(err, getPDFXMode()));
+        }
+    }
+
 }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFShading.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFShading.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFShading.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFShading.java Wed Aug 25 16:49:26 2010
@@ -164,10 +164,11 @@ public class PDFShading extends PDFObjec
      * It's optional, the default is the identity matrix
      * @param theFunction The PDF Function that maps an (x,y) location to a color
      */
-    public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace,
-                      List theBackground, List theBBox,
-                      boolean theAntiAlias, List theDomain,
-                      List theMatrix, PDFFunction theFunction) {
+    public PDFShading                                           // CSOK: ParameterNumber
+        (int theShadingType, PDFDeviceColorSpace theColorSpace,
+         List theBackground, List theBBox,
+         boolean theAntiAlias, List theDomain,
+         List theMatrix, PDFFunction theFunction) {
         super();
         this.shadingType = theShadingType;    // 1
         this.colorSpace = theColorSpace;
@@ -202,11 +203,12 @@ public class PDFShading extends PDFObjec
      *                  and end colors past the start and end points
      * The default is [false, false]
      */
-    public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace,
-                      List theBackground, List theBBox,
-                      boolean theAntiAlias, List theCoords,
-                      List theDomain, PDFFunction theFunction,
-                      List theExtend) {
+    public PDFShading                                           // CSOK: ParameterNumber
+        (int theShadingType, PDFDeviceColorSpace theColorSpace,
+         List theBackground, List theBBox,
+         boolean theAntiAlias, List theCoords,
+         List theDomain, PDFFunction theFunction,
+         List theExtend) {
         super();
         this.shadingType = theShadingType;    // 2 or 3
         this.colorSpace = theColorSpace;
@@ -242,11 +244,12 @@ public class PDFShading extends PDFObjec
      * @param theDecode List of Doubles see PDF 1.3 spec pages 303 to 312.
      * @param theFunction the PDFFunction
      */
-    public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace,
-                      List theBackground, List theBBox,
-                      boolean theAntiAlias, int theBitsPerCoordinate,
-                      int theBitsPerComponent, int theBitsPerFlag,
-                      List theDecode, PDFFunction theFunction) {
+    public PDFShading                                           // CSOK: ParameterNumber
+        (int theShadingType, PDFDeviceColorSpace theColorSpace,
+         List theBackground, List theBBox,
+         boolean theAntiAlias, int theBitsPerCoordinate,
+         int theBitsPerComponent, int theBitsPerFlag,
+         List theDecode, PDFFunction theFunction) {
         super();
 
         this.shadingType = theShadingType;    // 4,6 or 7
@@ -281,11 +284,12 @@ public class PDFShading extends PDFObjec
      * @param theVerticesPerRow number of vertices in each "row" of the lattice.
      * @param theFunction The PDFFunction that's mapped on to this shape
      */
-    public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace,
-                      List theBackground, List theBBox,
-                      boolean theAntiAlias, int theBitsPerCoordinate,
-                      int theBitsPerComponent, List theDecode,
-                      int theVerticesPerRow, PDFFunction theFunction) {
+    public PDFShading                                           // CSOK: ParameterNumber
+        (int theShadingType, PDFDeviceColorSpace theColorSpace,
+         List theBackground, List theBBox,
+         boolean theAntiAlias, int theBitsPerCoordinate,
+         int theBitsPerComponent, List theDecode,
+         int theVerticesPerRow, PDFFunction theFunction) {
         super();
         this.shadingType = theShadingType;    // 5
         this.colorSpace = theColorSpace;
@@ -334,7 +338,7 @@ public class PDFShading extends PDFObjec
      *
      * @return the PDF string.
      */
-    public String toPDFString() {
+    public String toPDFString() {                               // CSOK: MethodLength
         int vectorSize;
         int tempInt;
         StringBuffer p = new StringBuffer(128);

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFText.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFText.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFText.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFText.java Wed Aug 25 16:49:26 2010
@@ -320,5 +320,41 @@ public class PDFText extends PDFObject {
         return bout.toByteArray();
     }
 
+    /**
+     * Converts a text to PDF's "string" data type. Unsupported characters get converted to '?'
+     * characters (similar to what the Java "US-ASCII" encoding does).
+     * @see #toPDFString(CharSequence, char)
+     * @param text the text to convert
+     * @return the converted string
+     */
+    public static String toPDFString(CharSequence text) {
+        return toPDFString(text, '?');
+    }
+
+    /**
+     * Converts a text to PDF's "string" data type. Unsupported characters get converted to the
+     * given replacement character.
+     * <p>
+     * The PDF library currently doesn't properly distinguish between the PDF
+     * data types "string" and "text string", so we currently restrict "string" to US-ASCII, also
+     * because "string" seems somewhat under-specified concerning the upper 128 bytes.
+     * @param text the text to convert
+     * @param replacement the replacement character used when substituting a character
+     * @return the converted string
+     */
+    public static String toPDFString(CharSequence text, char replacement) {
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0, c = text.length(); i < c; i++) {
+            char ch = text.charAt(i);
+            if (ch > 127) {
+                //TODO Revisit the restriction to US-ASCII once "string" and "text string" are
+                //"disentangled".
+                sb.append(replacement);
+            } else {
+                sb.append(ch);
+            }
+        }
+        return sb.toString();
+    }
 }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFToUnicodeCMap.java Wed Aug 25 16:49:26 2010
@@ -79,7 +79,6 @@ public class PDFToUnicodeCMap extends PD
 
         /**
          * Writes the CMap to a Writer.
-         * @param writer the writer
          * @throws IOException if an I/O error occurs
          */
         public void writeCMap() throws IOException {
@@ -94,7 +93,6 @@ public class PDFToUnicodeCMap extends PD
 
         /**
          * Writes the character mappings for this font.
-         * @param p StingBuffer to write to
          */
         protected void writeBFEntries() throws IOException {
             if (unicodeCharMap != null) {
@@ -106,7 +104,6 @@ public class PDFToUnicodeCMap extends PD
         /**
          * 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
          */
@@ -147,7 +144,6 @@ public class PDFToUnicodeCMap extends PD
 
         /**
          * 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
          */

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/TransitionDictionary.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/TransitionDictionary.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/TransitionDictionary.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/TransitionDictionary.java Wed Aug 25 16:49:26 2010
@@ -28,8 +28,6 @@ public class TransitionDictionary extend
 
     /**
      * Create a Transition Dictionary
-     *
-     * @param values the dictionary values to output
      */
     public TransitionDictionary() {
         put("Type", new PDFName("Trans"));

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java Wed Aug 25 16:49:26 2010
@@ -34,9 +34,10 @@ import java.awt.image.Raster;
 import java.awt.image.WritableRaster;
 import java.io.IOException;
 
-import org.apache.fop.render.RendererContext.RendererContextWrapper;
 import org.apache.xmlgraphics.util.UnitConv;
 
+import org.apache.fop.render.RendererContext.RendererContextWrapper;
+
 /**
  * Abstract base class for Graphics2DAdapter implementations.
  */
@@ -151,6 +152,7 @@ public abstract class AbstractGraphics2D
     public void paintImage(Graphics2DImagePainter painter,
             RendererContext context,
             int x, int y, int width, int height) throws IOException {
+        //TODO Deprecated method to be removed once Barcode4J 2.1 is released.
         paintImage((org.apache.xmlgraphics.java2d.Graphics2DImagePainter)painter,
                 context, x, y, width, height);
     }

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractImageHandlerGraphics2D.java Wed Aug 25 16:49:26 2010
@@ -34,7 +34,7 @@ import java.awt.image.DataBuffer;
 import java.awt.image.Raster;
 import java.awt.image.WritableRaster;
 
-import org.apache.fop.util.UnitConv;
+import org.apache.xmlgraphics.util.UnitConv;
 
 /**
  * Abstract base class for ImageHandler implementations that process Java2D images through
@@ -45,7 +45,6 @@ public abstract class AbstractImageHandl
     /**
      * Paints the image to a BufferedImage and returns that.
      * @param painter the painter which will paint the actual image
-     * @param context the renderer context for the current renderer
      * @param targetDimension the target dimensions of the image to be converted to a bitmap
      * @param resolution the requested bitmap resolution
      * @param gray true if the generated image should be in grayscales

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractPathOrientedRenderer.java Wed Aug 25 16:49:26 2010
@@ -172,11 +172,10 @@ public abstract class AbstractPathOrient
      * @param bpsStart the border-start traits
      * @param bpsEnd the border-end traits
      */
-    protected void drawBackground(float startx, float starty,
-                    float width, float height,
-                    Trait.Background back,
-                    BorderProps bpsBefore, BorderProps bpsAfter,
-                    BorderProps bpsStart, BorderProps bpsEnd) {
+    protected void drawBackground                               // CSOK: ParameterNumber
+        (float startx, float starty, float width, float height, Trait.Background back,
+         BorderProps bpsBefore, BorderProps bpsAfter,
+         BorderProps bpsStart, BorderProps bpsEnd) {
         if (back != null) {
             endTextObject();
 
@@ -262,10 +261,10 @@ public abstract class AbstractPathOrient
      * @param bpsStart the border-start traits
      * @param bpsEnd the border-end traits
      */
-    protected void drawBorders(float startx, float starty,
-                    float width, float height,
-                    BorderProps bpsBefore, BorderProps bpsAfter,
-                    BorderProps bpsStart, BorderProps bpsEnd) {
+    protected void drawBorders                                  // CSOK: ParameterNumber
+        (float startx, float starty, float width, float height,
+         BorderProps bpsBefore, BorderProps bpsAfter,
+         BorderProps bpsStart, BorderProps bpsEnd) {
         Rectangle2D.Float borderRect = new Rectangle2D.Float(startx, starty, width, height);
         drawBorders(borderRect, bpsBefore, bpsAfter, bpsStart, bpsEnd);
     }
@@ -283,7 +282,8 @@ public abstract class AbstractPathOrient
      * @param bpsStart the border specification on the start side
      * @param bpsEnd the border specification on the end side
      */
-    protected void drawBorders(Rectangle2D.Float borderRect,
+    protected void drawBorders                                  // CSOK: MethodLength
+        (Rectangle2D.Float borderRect,
             BorderProps bpsBefore, BorderProps bpsAfter, BorderProps bpsStart, BorderProps bpsEnd) {
         //TODO generalize each of the four conditions into using a parameterized drawBorder()
         boolean[] border = new boolean[] {
@@ -858,8 +858,9 @@ public abstract class AbstractPathOrient
      * @param style the border style (one of Constants.EN_DASHED etc.)
      * @param col the color for the border segment
      */
-    protected abstract void drawBorderLine(float x1, float y1, float x2, float y2,
-            boolean horz, boolean startOrBefore, int style, Color col);
+    protected abstract void drawBorderLine                      // CSOK: ParameterNumber
+        (float x1, float y1, float x2, float y2, boolean horz,
+         boolean startOrBefore, int style, Color col);
 
     /** {@inheritDoc} */
     public void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
@@ -872,8 +873,6 @@ public abstract class AbstractPathOrient
     /**
      * Establishes a new coordinate system with the given transformation matrix.
      * The current graphics state is saved and the new coordinate system is concatenated.
-     * @param block
-     *
      * @param at the transformation matrix
      */
     protected void establishTransformationMatrix(AffineTransform at) {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractRenderer.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/AbstractRenderer.java Wed Aug 25 16:49:26 2010
@@ -215,6 +215,7 @@ public abstract class AbstractRenderer
 
     /** {@inheritDoc} */
     public void startPageSequence(PageSequence pageSequence) {
+        //TODO Discuss removing old deprecated method startPageSequence(LineArea)
         startPageSequence(pageSequence.getTitle());
     }
 

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ImageHandlerRegistry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ImageHandlerRegistry.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ImageHandlerRegistry.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ImageHandlerRegistry.java Wed Aug 25 16:49:26 2010
@@ -133,6 +133,7 @@ public class ImageHandlerRegistry {
     /**
      * Returns the ordered array of supported image flavors. The array needs to be ordered by
      * priority so the image loader framework can return the preferred image type.
+     * @param context the rendering context
      * @return the array of image flavors
      */
     public synchronized ImageFlavor[] getSupportedFlavors(RenderingContext context) {

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ImageHandlerUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ImageHandlerUtil.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ImageHandlerUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ImageHandlerUtil.java Wed Aug 25 16:49:26 2010
@@ -28,7 +28,10 @@ import org.apache.fop.fo.extensions.Exte
 /**
  * Utility methods for image handling.
  */
-public class ImageHandlerUtil {
+public final class ImageHandlerUtil {
+
+    private ImageHandlerUtil() {
+    }
 
     /** conversion-mode extension attribute */
     public static final QName CONVERSION_MODE = new QName(

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/Renderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/Renderer.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/Renderer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/Renderer.java Wed Aug 25 16:49:26 2010
@@ -149,7 +149,7 @@ public interface Renderer {
      * Tells the renderer that a new page sequence starts.
      *
      * @param seqTitle  The title of the page sequence
-     * @deprecated Use startPageSequence(PageSequence) instead
+     * @deprecated Use {@link #startPageSequence(PageSequence)} instead
      */
     void startPageSequence(LineArea seqTitle);
 
@@ -162,7 +162,7 @@ public interface Renderer {
 
     /**
      * Tells the renderer to render a particular page. A renderer typically
-     * reponds by packing up the current page and writing it immediately to the
+     * responds by packing up the current page and writing it immediately to the
      * output device.
      *
      * @param page              The page to be rendered

Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/RendererEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/RendererEventProducer.java?rev=989216&r1=989215&r2=989216&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/RendererEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/RendererEventProducer.java Wed Aug 25 16:49:26 2010
@@ -30,7 +30,10 @@ import org.apache.fop.events.EventProduc
 public interface RendererEventProducer extends EventProducer {
 
     /** Provider class for the event producer. */
-    class Provider {
+    final class Provider {
+
+        private Provider() {
+        }
 
         /**
          * Returns an event producer.



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