]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
support for empty fonts situation
authorarved <arved@unknown>
Fri, 10 Mar 2000 02:46:00 +0000 (02:46 +0000)
committerarved <arved@unknown>
Fri, 10 Mar 2000 02:46:00 +0000 (02:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193290 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/pdf/PDFResources.java

index 32e39b068cc1351914f267418b764559dbbc6a2d..0425f2c3b429df2324246416816fc9779116ab2d 100644 (file)
@@ -98,36 +98,43 @@ public class PDFResources extends PDFObject {
      *
      * @return the PDF
      */
-    public String toPDF() {
-       StringBuffer p = new StringBuffer(this.number + " "
-                                         + this.generation
-                                         + " obj\n<< /Font << ");
+       public String toPDF() {
+               StringBuffer p = new StringBuffer(this.number + " "
+                                               + this.generation
+                                               + " obj\n<< \n");
+               if(!this.fonts.isEmpty())
+               {
+                       p.append("/Font << ");
 
-       /* construct PDF dictionary of font object references */
-       Enumeration fontEnumeration = fonts.keys();
-       while (fontEnumeration.hasMoreElements()) {
-           String fontName = (String) fontEnumeration.nextElement();
-           p = p.append("/" + fontName + " " 
-                        + ((PDFFont) fonts.get(fontName)).referencePDF()
-                        + "\n");  
-       }
+                       /* construct PDF dictionary of font object references */
+                       Enumeration fontEnumeration = fonts.keys();
+                       while (fontEnumeration.hasMoreElements()) {
+                       String fontName = (String) fontEnumeration.nextElement();
+                       p = p.append("/" + fontName + " " 
+                                       + ((PDFFont) fonts.get(fontName)).referencePDF()
+                                       + "\n");  
+                       }
+                       
+                       p = p.append(">>\n");
+               }
+               
+               p.append("/ProcSet [ /PDF /ImageC /Text ] ");
 
-       p = p.append(">>\n/ProcSet [ /PDF /ImageC /Text ] ");
+               if (!this.xObjects.isEmpty())
+               {
+               p = p.append("/XObject <<");
+               for (int i = 1; i < this.xObjects.size(); i++) {
+                       p = p.append("/Im" + i + " " +
+                               ((PDFXObject)
+                               this.xObjects.elementAt(i -
+                                                       1)).referencePDF()
+                               +
+                               " \n");
+               }
+               }
 
-       if (!this.xObjects.isEmpty()) {
-           p = p.append("/XObject <<");
-           for (int i = 1; i < this.xObjects.size(); i++) {
-               p = p.append("/Im" + i + " " +
-                            ((PDFXObject)
-                             this.xObjects.elementAt(i -
-                                                     1)).referencePDF()
-                            +
-                            " \n");
-           }
-       }
+                       p = p.append(">>\nendobj\n");
 
-       p = p.append(">>\nendobj\n");
-
-       return p.toString();
-    }
+                       return p.toString();
+               }    
 }