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 ke...@apache.org on 2001/04/08 16:06:15 UTC
cvs commit: xml-fop/src/org/apache/fop/render/pdf/fonts MultiByteFont.java
kellyc 01/04/08 07:06:15
Modified: src/org/apache/fop/pdf PDFDocument.java
src/org/apache/fop/render/pdf/fonts MultiByteFont.java
Log:
Fixed some bugs in PDF rendering when font embedding fails.
FontDescriptor is now written out anyway to produce a valid PDF
and acrobat reports that the font can't be displayed.
Revision Changes Path
1.21 +16 -18 xml-fop/src/org/apache/fop/pdf/PDFDocument.java
Index: PDFDocument.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFDocument.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- PDFDocument.java 2001/04/01 09:54:53 1.20
+++ PDFDocument.java 2001/04/08 14:06:14 1.21
@@ -1,4 +1,4 @@
-/*-- $Id: PDFDocument.java,v 1.20 2001/04/01 09:54:53 kellyc Exp $ --
+/*-- $Id: PDFDocument.java,v 1.21 2001/04/08 14:06:14 kellyc Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -854,17 +854,16 @@
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 @@
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);
@@ -1156,13 +1154,13 @@
/* construct initial part of xref */
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 */
1.3 +2 -2 xml-fop/src/org/apache/fop/render/pdf/fonts/MultiByteFont.java
Index: MultiByteFont.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/fonts/MultiByteFont.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MultiByteFont.java 2001/03/22 18:17:00 1.2
+++ MultiByteFont.java 2001/04/08 14:06:15 1.3
@@ -1,4 +1,4 @@
-/* $Id: MultiByteFont.java,v 1.2 2001/03/22 18:17:00 fotis Exp $
+/* $Id: MultiByteFont.java,v 1.3 2001/04/08 14:06:15 kellyc Exp $
*
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
@@ -185,7 +185,7 @@
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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org