diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2006-05-10 19:30:21 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2006-05-10 19:30:21 +0000 |
| commit | 1d9065a073a8f8ac707a6fa2e7683755f1b82df0 (patch) | |
| tree | 716c7caa66e15265fd3c385c097b4bf08a7196df /bk_pdf.c | |
| parent | 867be607004e3816dc775d214065261a7ce4afb5 (diff) | |
| download | halibut-1d9065a073a8f8ac707a6fa2e7683755f1b82df0.zip halibut-1d9065a073a8f8ac707a6fa2e7683755f1b82df0.tar.gz halibut-1d9065a073a8f8ac707a6fa2e7683755f1b82df0.tar.bz2 halibut-1d9065a073a8f8ac707a6fa2e7683755f1b82df0.tar.xz | |
Make /Widths arrays for fonts more compact by using FirstChar and LastChar
to skip unused code points.
[originally from svn r6673]
Diffstat (limited to 'bk_pdf.c')
| -rw-r--r-- | bk_pdf.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -164,11 +164,20 @@ void pdf_backend(paragraph *sourceform, keywordlist *keywords, { object *widths = new_object(&olist); - objtext(font, "/FirstChar 0\n/LastChar 255\n/Widths "); + int firstchar = -1, lastchar = -1; + char buf[80]; + for (i = 0; i < 256; i++) + if (fe->indices[i] >= 0) { + if (firstchar < 0) firstchar = i; + lastchar = i; + } + sprintf(buf, "/FirstChar %d\n/LastChar %d\n/Widths ", + firstchar, lastchar); + objtext(font, buf); objref(font, widths); objtext(font, "\n"); objtext(widths, "[\n"); - for (i = 0; i < 256; i++) { + for (i = firstchar; i <= lastchar; i++) { char buf[80]; double width; if (fe->indices[i] < 0) |