X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/d5bc1c48d6a59db9480a3c8ce43fd8ca8a3b6a21..babfe3e260c345c06201516d990155ca8aba49e3:/bk_pdf.c?ds=sidebyside diff --git a/bk_pdf.c b/bk_pdf.c index 3a0ec75..74944f0 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 && fi->filetype == TYPE1) { 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); }