diff options
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/epdf.h | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/pdftoepdf.cc | 7 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/utils.c | 7 |
3 files changed, 12 insertions, 3 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/epdf.h b/Build/source/texk/web2c/pdftexdir/epdf.h index d1f2a2c818f..40db0974366 100644 --- a/Build/source/texk/web2c/pdftexdir/epdf.h +++ b/Build/source/texk/web2c/pdftexdir/epdf.h @@ -85,6 +85,7 @@ extern "C" { __attribute__ ((format(printf, 1, 2))) extern void pdf_printf(const char *fmt, ...); extern void pdf_puts(const char *); + extern void pdf_newline(void); extern void pdfbeginstream(void); extern void pdfendobj(void); extern void pdfendstream(void); diff --git a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc index b687da19fc5..7d2faa5d69e 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc +++ b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc @@ -589,8 +589,7 @@ static void copyObject(Object * obj) pdf_puts(">>\n"); pdf_puts("stream\n"); copyStream(obj->getStream()->getUndecodedStream()); - if (pdflastbyte != '\n') - pdf_puts("\n"); + pdf_newline(); pdf_puts("endstream"); // can't simply write pdfendstream() } else if (obj->isRef()) { ref = obj->getRef(); @@ -902,6 +901,7 @@ void write_epdf(void) for (i = 0; pageDictKeys[i] != NULL; i++) { pageDict->lookupNF(pageDictKeys[i], &dictObj); if (!dictObj->isNull()) { + pdf_newline(); pdf_printf("/%s ", pageDictKeys[i]); copyObject(&dictObj); // preserves indirection } @@ -919,6 +919,7 @@ void write_epdf(void) if (!obj1->isDict()) pdftex_fail("PDF inclusion: invalid resources dict type <%s>", obj1->getTypeName()); + pdf_newline(); pdf_puts("/Resources <<\n"); for (i = 0, l = obj1->dictGetLength(); i < l; ++i) { obj1->dictGetVal(i, &obj2); @@ -977,7 +978,7 @@ void write_epdf(void) copyStream((contents->arrayGet(i, &contentsobj))->getStream()); contentsobj.free(); if (i < l - 1) - pdf_puts("\n"); // add a newline after each stream except the last + pdf_newline(); // add a newline after each stream except the last } pdfendstream(); } else { // the contents are optional, but we need to include an empty stream diff --git a/Build/source/texk/web2c/pdftexdir/utils.c b/Build/source/texk/web2c/pdftexdir/utils.c index ebf68346613..d7ccc213efd 100644 --- a/Build/source/texk/web2c/pdftexdir/utils.c +++ b/Build/source/texk/web2c/pdftexdir/utils.c @@ -166,6 +166,13 @@ void pdf_puts(const char *s) pdfroom(strlen(s) + 1); while (*s) pdfbuf[pdfptr++] = *s++; + pdflastbyte = s[-1]; +} + +void pdf_newline(void) +{ + if (pdflastbyte != '\n') + pdf_puts("\n"); } __attribute__ ((format(printf, 1, 2))) |