jeremias    2003/03/27 03:00:34

  Modified:    src/java/org/apache/fop/pdf PDFTTFStream.java
  Log:
  Adjust to the PDF Stream changes.
  TODO: This could still be optimized in a similar way as the PDFT1Stream (to avoid 
the additional buffer).
  
  Revision  Changes    Path
  1.2       +19 -21    xml-fop/src/java/org/apache/fop/pdf/PDFTTFStream.java
  
  Index: PDFTTFStream.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFTTFStream.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDFTTFStream.java 11 Mar 2003 13:05:09 -0000      1.1
  +++ PDFTTFStream.java 27 Mar 2003 11:00:34 -0000      1.2
  @@ -61,11 +61,10 @@
   
       /**
        * Main constructor
  -     * @param num PDF object number
        * @param len original length
        */
  -    public PDFTTFStream(int num, int len) {
  -        super(num);
  +    public PDFTTFStream(int len) {
  +        super();
           origLength = len;
       }
   
  @@ -76,35 +75,34 @@
        */
       protected int output(java.io.OutputStream stream)
               throws java.io.IOException {
  -        int length = 0;
  -        String filterEntry = applyFilters();
  -        String preData = new String(this.number + " " + this.generation
  -                                    + " obj\n<< /Length "
  -                                    + (data.getSize() + 1) + " " + filterEntry
  -                                    + " " + "/Length1 " + origLength
  -                                    + " >>\n");
  +        getDocumentSafely().getLogger().debug("Writing " 
  +                + origLength + " bytes of TTF font data");
   
  -        byte[] p = preData.getBytes();
  -        stream.write(p);
  -        length += p.length;
  -
  -        length += outputStreamData(stream);
  -        p = "endobj\n".getBytes();
  -        stream.write(p);
  -        length += p.length;
  +        int length = super.output(stream);
  +        getDocumentSafely().getLogger().debug("Embedded TrueType/OpenType font");
           return length;
       }
   
       /**
  +     * @see org.apache.fop.pdf.AbstractPDFStream#buildStreamDict(String)
  +     */
  +    protected String buildStreamDict(String lengthEntry) {
  +        final String filterEntry = getFilterList().buildFilterDictEntries();
  +        return (getObjectID()
  +                + "<< /Length " + lengthEntry
  +                + " /Length1 " + origLength
  +                + "\n" + filterEntry
  +                + "\n>>\n");
  +    }
  +
  +    /**
        * Sets the TrueType font data.
        * @param data the font payload
        * @param size size of the payload
        * @throws IOException in case of an I/O problem
        */
       public void setData(byte[] data, int size) throws IOException {
  -        this.data.reset();
  -        /[EMAIL PROTECTED] Log using Logger */
  -        System.out.println("Writing " + size + " bytes of font data");
  +        this.data.clear();
           this.data.getOutputStream().write(data, 0, size);
       }
   
  
  
  

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

Reply via email to