summaryrefslogtreecommitdiff
path: root/bk_pdf.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2006-05-14 13:42:48 +0000
committerBen Harris <bjh21@bjh21.me.uk>2006-05-14 13:42:48 +0000
commite06921ba9541759101336126a6af96ab66b9ee2d (patch)
tree96ec2e47e9f592d08ea7af56893873e5c4704bbf /bk_pdf.c
parent9f368a32d754b2827a38f51aa6191aa625ce6a10 (diff)
downloadhalibut-e06921ba9541759101336126a6af96ab66b9ee2d.zip
halibut-e06921ba9541759101336126a6af96ab66b9ee2d.tar.gz
halibut-e06921ba9541759101336126a6af96ab66b9ee2d.tar.bz2
halibut-e06921ba9541759101336126a6af96ab66b9ee2d.tar.xz
Fairly ropey font-embedding support. In particular, the PDF output is
technically incorrect, though it works perfectly well with xpdf. To do it properly requires actually parsing the unencrypted part of a Type 1 font, which will be a bit tedious in C. [originally from svn r6685]
Diffstat (limited to 'bk_pdf.c')
-rw-r--r--bk_pdf.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/bk_pdf.c b/bk_pdf.c
index 0a9336b..0a36ad9 100644
--- a/bk_pdf.c
+++ b/bk_pdf.c
@@ -228,7 +228,20 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords,
objtext(fontdesc, buf);
sprintf(buf, "/StemV %g\n", fi->stemv);
objtext(fontdesc, buf);
- objtext(fontdesc, ">>\n");
+ if (fi->fp) {
+ object *fontfile = new_object(&olist);
+ char buf[513];
+ size_t len;
+ rewind(fi->fp);
+ do {
+ len = fread(buf, 1, sizeof(buf)-1, fi->fp);
+ buf[len] = 0;
+ objstream(fontfile, buf);
+ } while (len == sizeof(buf)-1);
+ objtext(fontdesc, "/FontFile ");
+ objref(fontdesc, fontfile);
+ }
+ objtext(fontdesc, "\n>>\n");
}
objtext(font, "\n>>\n");