aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2007-05-11 08:47:11 +0000
committerJeremias Maerki <jeremias@apache.org>2007-05-11 08:47:11 +0000
commit0266898d9599fb55792ed321acfdf77a53c6c22d (patch)
tree9b8b9818d919172905d15a010a549a4a65ec0f12
parentb2fd48501bf49caef7f721944484dfe3bad2387f (diff)
downloadxmlgraphics-fop-0266898d9599fb55792ed321acfdf77a53c6c22d.tar.gz
xmlgraphics-fop-0266898d9599fb55792ed321acfdf77a53c6c22d.zip
Bugfix: Integers were not correctly formatted in PDF. This fixes a problem with embedded fonts.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@537129 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/pdf/PDFArray.java6
-rw-r--r--src/java/org/apache/fop/pdf/PDFDictionary.java6
-rw-r--r--src/java/org/apache/fop/pdf/PDFObject.java15
3 files changed, 17 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFArray.java b/src/java/org/apache/fop/pdf/PDFArray.java
index 0e7a2b986..abeed1d86 100644
--- a/src/java/org/apache/fop/pdf/PDFArray.java
+++ b/src/java/org/apache/fop/pdf/PDFArray.java
@@ -127,11 +127,7 @@ public class PDFArray extends PDFObject {
p.append(" ");
}
Object obj = this.values.get(i);
- if (obj instanceof PDFWritable) {
- p.append(((PDFWritable)obj).toInlinePDFString());
- } else {
- p.append("(").append(obj).append(")");
- }
+ formatObject(obj, p);
}
p.append("]");
if (hasObjectNumber()) {
diff --git a/src/java/org/apache/fop/pdf/PDFDictionary.java b/src/java/org/apache/fop/pdf/PDFDictionary.java
index aa15792b2..2a9c3ffe4 100644
--- a/src/java/org/apache/fop/pdf/PDFDictionary.java
+++ b/src/java/org/apache/fop/pdf/PDFDictionary.java
@@ -84,11 +84,7 @@ public class PDFDictionary extends PDFObject {
p.append(key);
p.append(" ");
Object obj = this.entries.get(key);
- if (obj instanceof PDFWritable) {
- p.append(((PDFWritable)obj).toInlinePDFString());
- } else {
- p.append("(").append(obj).append(")");
- }
+ formatObject(obj, p);
}
p.append("\n>>\n");
if (hasObjectNumber()) {
diff --git a/src/java/org/apache/fop/pdf/PDFObject.java b/src/java/org/apache/fop/pdf/PDFObject.java
index 806f7621d..544a30cc4 100644
--- a/src/java/org/apache/fop/pdf/PDFObject.java
+++ b/src/java/org/apache/fop/pdf/PDFObject.java
@@ -245,6 +245,21 @@ public abstract class PDFObject implements PDFWritable {
}*/
}
+ /**
+ * Formats an object for serialization to PDF.
+ * @param obj the object
+ * @param sb the StringBuffer to write to
+ */
+ protected void formatObject(Object obj, StringBuffer sb) {
+ if (obj instanceof PDFWritable) {
+ sb.append(((PDFWritable)obj).toInlinePDFString());
+ } else if (obj instanceof Number) {
+ sb.append(obj);
+ } else {
+ sb.append("(").append(obj).append(")");
+ }
+ }
+
/** Formatting pattern for PDF date */
protected static final SimpleDateFormat DATE_FORMAT
= new SimpleDateFormat("'D:'yyyyMMddHHmmss");