summaryrefslogtreecommitdiff
path: root/bk_pdf.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2007-01-27 20:47:41 +0000
committerBen Harris <bjh21@bjh21.me.uk>2007-01-27 20:47:41 +0000
commit72d22e8a1a1b47635e1b8da49ae703bde01228f2 (patch)
tree64b4c37716491d55c10c4287c473e6d6715da7dd /bk_pdf.c
parent2641476245d6cb1e9e85d37c6c539741aff2800d (diff)
downloadhalibut-72d22e8a1a1b47635e1b8da49ae703bde01228f2.zip
halibut-72d22e8a1a1b47635e1b8da49ae703bde01228f2.tar.gz
halibut-72d22e8a1a1b47635e1b8da49ae703bde01228f2.tar.bz2
halibut-72d22e8a1a1b47635e1b8da49ae703bde01228f2.tar.xz
Add support for PFB files. This seems to have caused me to completely
rewrite the Type 1 font support, and I'm sure the result is more complex than it needs to be, but it seems to work correctly, so I shouldn't complain. [originally from svn r7175]
Diffstat (limited to 'bk_pdf.c')
-rw-r--r--bk_pdf.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/bk_pdf.c b/bk_pdf.c
index 3a0ec75..99eb933 100644
--- a/bk_pdf.c
+++ b/bk_pdf.c
@@ -236,7 +236,7 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
objtext(fontdesc, buf);
sprintf(buf, "/StemV %g\n", fi->stemv);
objtext(fontdesc, buf);
- if (fi->fp) {
+ if (fi->fontfile) {
object *fontfile = new_object(&olist);
size_t len;
char *ffbuf;
@@ -487,13 +487,20 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
rdaddsc(&rs, text);
if (o->stream.text) {
+ if (!o->main.text)
+ rdaddsc(&o->main, "<<\n");
+#ifdef PDF_NOCOMPRESS
+ zlen = o->stream.pos;
+ zbuf = snewn(zlen, char);
+ memcpy(zbuf, o->stream.text, zlen);
+ sprintf(text, "/Length %d\n>>\n", zlen);
+#else
zcontext = deflate_compress_new(DEFLATE_TYPE_ZLIB);
deflate_compress_data(zcontext, o->stream.text, o->stream.pos,
DEFLATE_END_OF_DATA, &zbuf, &zlen);
deflate_compress_free(zcontext);
- if (!o->main.text)
- rdaddsc(&o->main, "<<\n");
sprintf(text, "/Filter/FlateDecode\n/Length %d\n>>\n", zlen);
+#endif
rdaddsc(&o->main, text);
}