jeremias    2003/03/27 02:37:52

  Modified:    src/java/org/apache/fop/pdf PDFFileSpec.java
                        PDFEncoding.java PDFCMap.java
  Log:
  The PDF object number doesn't get passed to the constructor anymore. Adjust for that.
  Use the toPDFString() (returns String) method instead of toPDF() (returns byte[]) 
where appropriate. String to byte[] conversion is done in PDFObject in a well-defined 
location instead of scattered around the codebase.
  
  Revision  Changes    Path
  1.2       +8 -11     xml-fop/src/java/org/apache/fop/pdf/PDFFileSpec.java
  
  Index: PDFFileSpec.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFFileSpec.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDFFileSpec.java  11 Mar 2003 13:05:09 -0000      1.1
  +++ PDFFileSpec.java  27 Mar 2003 10:37:52 -0000      1.2
  @@ -64,27 +64,24 @@
       /**
        * create a /FileSpec object.
        *
  -     * @param number the object's number
        * @param filename the filename represented by this object
        */
  -    public PDFFileSpec(int number, String filename) {
  +    public PDFFileSpec(String filename) {
   
           /* generic creation of object */
  -        super(number);
  +        super();
   
           this.filename = filename;
       }
   
       /**
  -     * represent the object in PDF
  -     *
  -     * @return the PDF string
  +     * @see org.apache.fop.pdf.PDFObject#toPDFString()
        */
  -    public byte[] toPDF() {
  -        String p = new String(this.number + " " + this.generation
  -                              + " obj\n<<\n/Type /FileSpec\n" + "/F ("
  -                              + this.filename + ")\n" + ">>\nendobj\n");
  -        return p.getBytes();
  +    public String toPDFString() {
  +        return getObjectID() 
  +                + "<<\n/Type /FileSpec\n" 
  +                + "/F (" + this.filename + ")\n" 
  +                + ">>\nendobj\n";
       }
   
       /*
  
  
  
  1.2       +9 -13     xml-fop/src/java/org/apache/fop/pdf/PDFEncoding.java
  
  Index: PDFEncoding.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFEncoding.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDFEncoding.java  11 Mar 2003 13:05:09 -0000      1.1
  +++ PDFEncoding.java  27 Mar 2003 10:37:52 -0000      1.2
  @@ -54,7 +54,6 @@
   import java.util.List;
   import java.util.Map;
   import java.util.Iterator;
  -import java.util.HashMap;
   
   /**
    * class representing an /Encoding object.
  @@ -98,17 +97,16 @@
       /**
        * create the /Encoding object
        *
  -     * @param number the object's number
        * @param basename the name of the character encoding schema
        */
  -    public PDFEncoding(int number, String basename) {
  +    public PDFEncoding(String basename) {
   
           /* generic creation of PDF object */
  -        super(number);
  +        super();
   
           /* set fields using paramaters */
           this.basename = basename;
  -        this.differences = new HashMap();
  +        this.differences = new java.util.HashMap();
       }
   
       /**
  @@ -122,14 +120,12 @@
       }
   
       /**
  -     * produce the PDF representation for the object
  -     *
  -     * @return the PDF
  +     * @see org.apache.fop.pdf.PDFObject#toPDFString()
        */
  -    public byte[] toPDF() {
  -        StringBuffer p = new StringBuffer();
  -        p.append(this.number + " " + this.generation
  -                 + " obj\n<< /Type /Encoding");
  +    public String toPDFString() {
  +        StringBuffer p = new StringBuffer(128);
  +        p.append(getObjectID() 
  +            + "<< /Type /Encoding");
           if ((basename != null) && (!basename.equals(""))) {
               p.append("\n/BaseEncoding /" + this.basename);
           }
  @@ -150,7 +146,7 @@
               p.append(" ]");
           }
           p.append(" >>\nendobj\n");
  -        return p.toString().getBytes();
  +        return p.toString();
       }
   
       /*
  
  
  
  1.2       +2 -3      xml-fop/src/java/org/apache/fop/pdf/PDFCMap.java
  
  Index: PDFCMap.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFCMap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDFCMap.java      11 Mar 2003 13:05:09 -0000      1.1
  +++ PDFCMap.java      27 Mar 2003 10:37:52 -0000      1.2
  @@ -402,12 +402,11 @@
       /**
        * create the /CMap object
        *
  -     * @param number the pdf object number
        * @param name one the registered names (see Table 7.20 on p 215)
        * @param sysInfo the attributes of the character collection of the CIDFont
        */
  -    public PDFCMap(int number, String name, PDFCIDSystemInfo sysInfo) {
  -        super(number);
  +    public PDFCMap(String name, PDFCIDSystemInfo sysInfo) {
  +        super();
           this.name = name;
           this.sysInfo = sysInfo;
           this.base = null;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to