summaryrefslogtreecommitdiff
path: root/bk_paper.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-04-16 10:56:31 +0000
committerSimon Tatham <anakin@pobox.com>2004-04-16 10:56:31 +0000
commitf2cf240dc050f1eb376dfd1d952b3a255893be6f (patch)
tree776e434dd7ca5b86616e3a024b2915b2838f92bb /bk_paper.c
parent046a6dc8493e42e9e9c7f0fec5a454730f6f689b (diff)
downloadhalibut-f2cf240dc050f1eb376dfd1d952b3a255893be6f.zip
halibut-f2cf240dc050f1eb376dfd1d952b3a255893be6f.tar.gz
halibut-f2cf240dc050f1eb376dfd1d952b3a255893be6f.tar.bz2
halibut-f2cf240dc050f1eb376dfd1d952b3a255893be6f.tar.xz
Compacted PS and PDF output files by removing redundant reiterations
of the same font and position designations. Reduced the size of the Halibut manual PDF to less than half what it started out as, and the PS one to more like a third of its original size. [originally from svn r4083]
Diffstat (limited to 'bk_paper.c')
-rw-r--r--bk_paper.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/bk_paper.c b/bk_paper.c
index 2e05028..dba4efd 100644
--- a/bk_paper.c
+++ b/bk_paper.c
@@ -14,14 +14,6 @@
*
* - linearised PDF, perhaps?
*
- * - compression of output files. For the actual text display,
- * both output formats currently average about 50-60 characters
- * per 5-6 character word of text, and almost all of it's the
- * same.
- * * In PS, we can define custom text operators to make things
- * more efficient.
- * * In PDF, there already are!
- *
* - I'm uncertain of whether I need to include a ToUnicode CMap
* in each of my font definitions in PDF. Currently things (by
* which I mean cut and paste out of acroread) seem to be
@@ -1563,7 +1555,8 @@ static void add_rect_to_page(page_data *page, int x, int y, int w, int h)
}
static void add_string_to_page(page_data *page, int x, int y,
- font_encoding *fe, int size, char *text)
+ font_encoding *fe, int size, char *text,
+ int width)
{
text_fragment *frag;
@@ -1581,6 +1574,7 @@ static void add_string_to_page(page_data *page, int x, int y,
frag->fe = fe;
frag->fontsize = size;
frag->text = dupstr(text);
+ frag->width = width;
}
/*
@@ -1634,7 +1628,8 @@ static int render_string(page_data *page, font_data *font, int fontsize,
if (!subfont || sf != subfont) {
if (subfont) {
text[textpos] = '\0';
- add_string_to_page(page, x, y, subfont, fontsize, text);
+ add_string_to_page(page, x, y, subfont, fontsize, text,
+ textwid);
x += textwid;
} else {
assert(textpos == 0);
@@ -1651,7 +1646,7 @@ static int render_string(page_data *page, font_data *font, int fontsize,
if (textpos > 0) {
text[textpos] = '\0';
- add_string_to_page(page, x, y, subfont, fontsize, text);
+ add_string_to_page(page, x, y, subfont, fontsize, text, textwid);
x += textwid;
}