aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-03-27 11:00:34 +0000
committerJeremias Maerki <jeremias@apache.org>2003-03-27 11:00:34 +0000
commitee8e0333a8a4c781d30b78216b19d2e3c57e33fa (patch)
treea013b0deebf9c7918a64c25f4d05164e473f810a /src/java/org
parente71f657fa279852f046314e183ec816c03dbd0fa (diff)
downloadxmlgraphics-fop-ee8e0333a8a4c781d30b78216b19d2e3c57e33fa.tar.gz
xmlgraphics-fop-ee8e0333a8a4c781d30b78216b19d2e3c57e33fa.zip
Adjust to the PDF Stream changes.
TODO: This could still be optimized in a similar way as the PDFT1Stream (to avoid the additional buffer). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196165 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/pdf/PDFTTFStream.java40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFTTFStream.java b/src/java/org/apache/fop/pdf/PDFTTFStream.java
index dfab0facc..49c552653 100644
--- a/src/java/org/apache/fop/pdf/PDFTTFStream.java
+++ b/src/java/org/apache/fop/pdf/PDFTTFStream.java
@@ -61,11 +61,10 @@ public class PDFTTFStream extends PDFStream {
/**
* 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 @@ public class PDFTTFStream extends PDFStream {
*/
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();
- /**@todo Log using Logger */
- System.out.println("Writing " + size + " bytes of font data");
+ this.data.clear();
this.data.getOutputStream().write(data, 0, size);
}