]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fixed some bugs in PDF rendering when font embedding fails.
authorKelly Campbell <kellyc@apache.org>
Sun, 8 Apr 2001 14:06:15 +0000 (14:06 +0000)
committerKelly Campbell <kellyc@apache.org>
Sun, 8 Apr 2001 14:06:15 +0000 (14:06 +0000)
FontDescriptor is now written out anyway to produce a valid PDF
and acrobat reports that the font can't be displayed.
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194196 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/pdf/PDFDocument.java
src/org/apache/fop/render/pdf/fonts/MultiByteFont.java

index 6636d2d624564f05ddffa2883468b4bfdbd27783..b0314cb3ba652b5edf578cca5be334d06347728c 100644 (file)
@@ -854,17 +854,16 @@ public class PDFDocument {
                                       desc.getStemV(),
                                       desc.getItalicAngle());
         }
-            // Check if the font is embeddable
+       this.objects.addElement(font);
+       
+       // Check if the font is embeddable
         if (desc.isEmbeddable()) {
             PDFStream stream=desc.getFontFile(this.objectcount+1);
             if (stream!=null) {
                 this.objectcount++;
                 font.setFontFile(desc.getSubType(), stream);
-                this.objects.addElement(font);
                 this.objects.addElement(stream);
             }
-        } else {
-            this.objects.addElement(font);
         }
        return font;
     }
@@ -1080,21 +1079,20 @@ public class PDFDocument {
 
         this.resources.setXObjects(xObjects);
 
-        /* loop through the object numbers */
-        for ( int i=1; i <= this.objectcount; i++ ) {
+       Enumeration en = this.objects.elements();
+       while (en.hasMoreElements()) {
+            /* retrieve the object with the current number */
+            PDFObject object = (PDFObject)en.nextElement();
 
             /* add the position of this object to the list of object
                locations */
             this.location.addElement(new Integer(this.position));
-
-            /* retrieve the object with the current number */
-            PDFObject object = (PDFObject)this.objects.elementAt(i-1);
-
-            /* output the object and increment the character position
+           
+           /* output the object and increment the character position
                by the object's length */
             this.position += object.output(stream);
-        }
-
+       }
+       
         /* output the xref table and increment the character position
            by the table's length */
         this.position += outputXref(stream);
@@ -1157,12 +1155,12 @@ public class PDFDocument {
         StringBuffer pdf = new StringBuffer("xref\n0 " + (this.objectcount+1) 
         + "\n0000000000 65535 f \n");
 
-        /* loop through object numbers */
-        for ( int i=1; i < this.objectcount+1; i++ ) {
-
+       Enumeration en = this.location.elements();
+       while (en.hasMoreElements()) {
+           String x = en.nextElement().toString();
+           
             /* contruct xref entry for object */
             String padding = "0000000000";
-            String x = this.location.elementAt(i-1).toString();
             String loc = padding.substring(x.length()) + x;
 
             /* append to xref table */
index f8305c3d66c6f55612d8237ead27e12fd4b56a73..2fb09b1b8af6e418a3ab37dd7bd61cbf313b977b 100644 (file)
@@ -185,7 +185,7 @@ public class MultiByteFont extends CIDFont implements FontDescriptor {
             embeddedFont.addFilter("ascii-85");
             embeddedFont.setData(subsetFont, subsetFont.length);
         } catch (IOException ioe) {
-            MessageHandler.error("Failed to embed font " + fontName +
+            MessageHandler.errorln("Failed to embed font ["+i+"] " + fontName +
                                  ": " + ioe.getMessage());
             return (PDFStream) null;
         }