summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/pdftexdir/epdf.h2
-rw-r--r--Build/source/texk/web2c/pdftexdir/image.h1
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.web4
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftoepdf.cc128
-rw-r--r--Build/source/texk/web2c/pdftexdir/pkin.c9
-rw-r--r--Build/source/texk/web2c/pdftexdir/utils.c2
-rw-r--r--Build/source/texk/web2c/pdftexdir/writeimg.c12
-rw-r--r--Build/source/texk/web2c/pdftexdir/writejbig2.c10
8 files changed, 43 insertions, 125 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/epdf.h b/Build/source/texk/web2c/pdftexdir/epdf.h
index 28c146e67eb..59abe26d9a8 100644
--- a/Build/source/texk/web2c/pdftexdir/epdf.h
+++ b/Build/source/texk/web2c/pdftexdir/epdf.h
@@ -54,7 +54,6 @@ extern "C" {
extern integer epdf_page_box;
extern void *epdf_doc;
extern void *epdf_xref;
- extern integer epdf_lastGroupObjectNum;
extern integer pdfboxspecmedia;
extern integer pdfboxspeccrop;
@@ -96,7 +95,6 @@ extern "C" {
__attribute__ ((format(printf, 1, 2)))
extern void tex_printf(const char *, ...);
extern void write_epdf(void);
- extern void write_additional_epdf_objects(void);
extern void zpdfbegindict(integer, bool);
extern void zpdfbeginobj(integer, bool);
extern void zpdfcreateobj(integer, integer);
diff --git a/Build/source/texk/web2c/pdftexdir/image.h b/Build/source/texk/web2c/pdftexdir/image.h
index 4b6f2ff38c2..9365d128716 100644
--- a/Build/source/texk/web2c/pdftexdir/image.h
+++ b/Build/source/texk/web2c/pdftexdir/image.h
@@ -106,7 +106,6 @@ extern integer image_max;
extern integer read_pdf_info(char *, char *, integer, integer, integer,
integer);
extern void write_epdf(void);
-extern void write_additional_epdf_objects(void);
extern void epdf_delete(void);
extern void read_png_info(integer);
extern void write_png(integer);
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web
index ff574014306..e061e20cb33 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.web
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.web
@@ -288,8 +288,8 @@ known as `\eTeX'.
{printed when \eTeX\ starts}
@#
@d pdftex_version==140 { \.{\\pdftexversion} }
-@d pdftex_revision=="10" { \.{\\pdftexrevision} }
-@d pdftex_version_string=='-1.40.10' {current \pdfTeX\ version}
+@d pdftex_revision=="11" { \.{\\pdftexrevision} }
+@d pdftex_version_string=='-1.40.11-beta' {current \pdfTeX\ version}
@#
@d pdfeTeX_banner=='This is pdfeTeX, Version 3.1415926',pdftex_version_string,eTeX_version_string
{printed when \pdfeTeX\ starts}
diff --git a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
index c2f7e8baf14..d1da80bb3cc 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
+++ b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -151,20 +151,12 @@ static PdfDocument *find_add_document(char *file_name)
if (p) {
xref = p->xref;
(p->occurences)++;
-#ifdef DEBUG
- fprintf(stderr, "\npdfTeX Debug: Incrementing %s (%d)\n", p->file_name,
- p->occurences);
-#endif
return p;
}
p = new PdfDocument;
p->file_name = xstrdup(file_name);
p->xref = xref = 0;
p->occurences = 0;
-#ifdef DEBUG
- fprintf(stderr, "\npdfTeX Debug: Creating %s (%d)\n", p->file_name,
- p->occurences);
-#endif
GString *docName = new GString(p->file_name);
p->doc = new PDFDoc(docName); // takes ownership of docName
if (!p->doc->isOk() || !p->doc->okToPrint()) {
@@ -440,6 +432,11 @@ static void copyFontResources(Object * obj)
obj->dictGetValNF(i, &fontRef);
if (fontRef->isRef())
copyFont(obj->dictGetKey(i), &fontRef);
+ else if (fontRef->isDict()) { // some programs generate pdf with embedded font object
+ copyName(obj->dictGetKey(i));
+ pdf_puts(" ");
+ copyObject(&fontRef);
+ }
else
pdftex_fail("PDF inclusion: invalid font in reference type <%s>",
fontRef->getTypeName());
@@ -578,7 +575,6 @@ static void copyObject(Object * obj)
pdf_puts(">>");
} else if (obj->isStream()) {
initDictFromDict(obj1, obj->streamGetDict());
- obj->streamGetDict()->incRef();
pdf_puts("<<\n");
copyDict(&obj1);
pdf_puts(">>\n");
@@ -778,8 +774,8 @@ read_pdf_info(char *image_name, char *page_name, integer page_num,
epdf_height = pagebox->y1 - pagebox->y2;
}
- rotate = page->getRotate();
// handle page rotation and adjust dimens as needed
+ rotate = page->getRotate();
if (rotate != 0) {
if (rotate % 90 == 0) {
// handle only the simple case: multiple of 90s.
@@ -801,28 +797,6 @@ read_pdf_info(char *image_name, char *page_name, integer page_num,
}
}
}
- // get the group and make sure it's indirect
- if (page->getGroup() != NULL) {
- initDictFromDict(lastGroup, page->getGroup());
- if (lastGroup->dictGetLength() > 0) {
- groupIsIndirect = lastGroup->isRef();
- if (groupIsIndirect) {
- // FIXME: Here we already copy the object. It would be
- // better to do this only after write_epdf, otherwise we
- // may copy ununsed /Group objects
- copyObject(&lastGroup);
- epdf_lastGroupObjectNum =
- getNewObjectNumber(lastGroup->getRef());
- } else {
- // make the group an indirect object; copying is done later
- // by write_additional_epdf_objects after write_epdf
- epdf_lastGroupObjectNum = pdfnewobjnum();
- }
- pdf_puts("\n");
- }
- } else {
- epdf_lastGroupObjectNum = 0;
- }
pdf_doc->xref = pdf_doc->doc->getXRef();
return page_num;
@@ -835,8 +809,9 @@ read_pdf_info(char *image_name, char *page_name, integer page_num,
void write_epdf(void)
{
Page *page;
- PdfObject contents, obj1, obj2;
- PdfObject metadata, pieceinfo, separationInfo;
+ Ref *pageRef;
+ Dict *pageDict;
+ PdfObject contents, obj1, obj2, pageObj, dictObj;
Object info;
char *key;
char s[256];
@@ -844,16 +819,25 @@ void write_epdf(void)
int rotate;
double scale[6] = { 0, 0, 0, 0, 0, 0 };
bool writematrix = false;
+ static char *pageDictKeys[] = {
+ "Group",
+ "LastModified",
+ "Metadata",
+ "PieceInfo",
+ "SeparationInfo",
+// "Resources",
+ NULL
+ };
+
PdfDocument *pdf_doc = (PdfDocument *) epdf_doc;
(pdf_doc->occurences)--;
-#ifdef DEBUG
- fprintf(stderr, "\npdfTeX Debug: Decrementing %s (%d)\n",
- pdf_doc->file_name, pdf_doc->occurences);
-#endif
xref = pdf_doc->xref;
inObjList = pdf_doc->inObjList;
encodingList = 0;
page = pdf_doc->doc->getCatalog()->getPage(epdf_selected_page);
+ pageRef = pdf_doc->doc->getCatalog()->getPageRef(epdf_selected_page);
+ xref->fetch(pageRef->num, pageRef->gen, &pageObj);
+ pageDict = pageObj->getDict();
rotate = page->getRotate();
PDFRectangle *pagebox;
// write the Page header
@@ -920,46 +904,20 @@ void write_epdf(void)
pagebox->x1, pagebox->y1, pagebox->x2, pagebox->y2);
pdf_puts(stripzeros(s));
- // write the page Group if it's there
- if (epdf_lastGroupObjectNum > 0) {
- initDictFromDict(lastGroup, page->getGroup());
- if (lastGroup->dictGetLength() > 0) {
- pdf_puts("/Group ");
- groupIsIndirect = lastGroup->isRef();
- pdf_printf("%d 0 R", epdf_lastGroupObjectNum);
- pdf_puts("\n");
- }
- }
- // write the page Metadata if it's there
- if (page->getMetadata() != NULL) {
- metadata->initStream(page->getMetadata());
- pdf_puts("/Metadata ");
- copyObject(&metadata);
- pdf_puts("\n");
- }
- // write the page PieceInfo if it's there
- if (page->getPieceInfo() != NULL) {
- initDictFromDict(pieceinfo, page->getPieceInfo());
- if (pieceinfo->dictGetLength() > 0) {
- pdf_puts("/PieceInfo ");
- copyObject(&pieceinfo);
- pdf_puts("\n");
- }
- }
- // copy LastModified (needed when PieceInfo is there)
- if (page->getLastModified() != NULL) {
- pdf_printf("/LastModified (%s)\n",
- page->getLastModified()->getCString());
- }
- // write the page SeparationInfo if it's there
- if (page->getSeparationInfo() != NULL) {
- initDictFromDict(separationInfo, page->getSeparationInfo());
- if (separationInfo->dictGetLength() > 0) {
- pdf_puts("/SeparationInfo ");
- copyObject(&separationInfo);
- pdf_puts("\n");
+ // Metadata validity check (as a stream it must be indirect)
+ pageDict->lookupNF("Metadata", &dictObj);
+ if (!dictObj->isNull() && !dictObj->isRef())
+ pdftex_warn("PDF inclusion: /Metadata must be indirect object");
+
+ // copy selected items in Page dictionary except Resources
+ for (i = 0; pageDictKeys[i] != NULL; i++) {
+ pageDict->lookupNF(pageDictKeys[i], &dictObj);
+ if (!dictObj->isNull()) {
+ pdf_printf("/%s ", pageDictKeys[i]);
+ copyObject(&dictObj); // preserves indirection
}
}
+
// write the Resources dictionary
if (page->getResourceDict() == NULL) {
// Resources can be missing (files without them have been spotted
@@ -969,7 +927,6 @@ void write_epdf(void)
("PDF inclusion: /Resources missing. 'This practice is not recommended' (PDF Ref)");
} else {
initDictFromDict(obj1, page->getResourceDict());
- page->getResourceDict()->incRef();
if (!obj1->isDict())
pdftex_fail("PDF inclusion: invalid resources dict type <%s>",
obj1->getTypeName());
@@ -986,6 +943,7 @@ void write_epdf(void)
}
pdf_puts(">>\n");
}
+
// write the page contents
page->getContents(&contents);
if (contents->isStream()) {
@@ -1029,6 +987,8 @@ void write_epdf(void)
Object contentsobj;
copyStream((contents->arrayGet(i, &contentsobj))->getStream());
contentsobj.free();
+ if (i < l - 1)
+ pdf_puts("\n"); // add a newline after each stream except the last
}
pdfendstream();
} else { // the contents are optional, but we need to include an empty stream
@@ -1044,17 +1004,6 @@ void write_epdf(void)
pdf_doc->xref = xref;
}
-// Called after the xobject generated by write_epdf has been finished; used to
-// write out objects that have been made indirect
-void write_additional_epdf_objects(void)
-{
- if ((epdf_lastGroupObjectNum > 0) && !groupIsIndirect) {
- zpdfbeginobj(epdf_lastGroupObjectNum, 2);
- copyObject(&lastGroup);
- pdfendobj();
- }
-}
-
// Called when an image has been written and it's resources in image_tab are
// freed and it's not referenced anymore.
@@ -1063,9 +1012,6 @@ void epdf_delete()
PdfDocument *pdf_doc = (PdfDocument *) epdf_doc;
xref = pdf_doc->xref;
if (pdf_doc->occurences < 0) {
-#ifdef DEBUG
- fprintf(stderr, "\npdfTeX Debug: Deleting %s\n", pdf_doc->file_name);
-#endif
delete_document(pdf_doc);
}
}
diff --git a/Build/source/texk/web2c/pdftexdir/pkin.c b/Build/source/texk/web2c/pdftexdir/pkin.c
index 52530cde437..cb43cc55677 100644
--- a/Build/source/texk/web2c/pdftexdir/pkin.c
+++ b/Build/source/texk/web2c/pdftexdir/pkin.c
@@ -172,9 +172,6 @@ static halfword pkpackednum(void)
repeatcount = pkpackednum();
else
repeatcount = 1;
-#ifdef DEBUG
- printf("[%d]", (int) repeatcount);
-#endif
return ((*realfunc) ());
}
}
@@ -274,12 +271,6 @@ static void unpack(chardesc * cd)
bitweight = 0;
while (rowsleft > 0) {
count = (*realfunc) ();
-#ifdef DEBUG
- if (turnon)
- printf("(%d) ", (int) count);
- else
- printf("%d ", (int) count);
-#endif
while (count != 0) {
if ((count < wordweight) && (count < hbit)) {
if (turnon)
diff --git a/Build/source/texk/web2c/pdftexdir/utils.c b/Build/source/texk/web2c/pdftexdir/utils.c
index 14d00a68549..ebf68346613 100644
--- a/Build/source/texk/web2c/pdftexdir/utils.c
+++ b/Build/source/texk/web2c/pdftexdir/utils.c
@@ -248,6 +248,8 @@ void pdftex_fail(const char *fmt, ...)
safe_print(" ==> Fatal error occurred, no output PDF file produced!");
println();
if (kpathsea_debug) {
+ safe_print("kpathsea_debug enabled, calling abort()...");
+ println();
abort();
} else {
exit(EX_SOFTWARE);
diff --git a/Build/source/texk/web2c/pdftexdir/writeimg.c b/Build/source/texk/web2c/pdftexdir/writeimg.c
index cc638926746..ba6281eeb33 100644
--- a/Build/source/texk/web2c/pdftexdir/writeimg.c
+++ b/Build/source/texk/web2c/pdftexdir/writeimg.c
@@ -40,7 +40,6 @@ integer epdf_selected_page;
integer epdf_num_pages;
integer epdf_page_box;
void *epdf_doc;
-integer epdf_lastGroupObjectNum;
static integer new_image_entry(void)
{
@@ -315,7 +314,6 @@ integer readimage(strnumber s, integer page_num, strnumber page_name,
pdf_ptr(img)->orig_y = bp2int(epdf_orig_y);
pdf_ptr(img)->selected_page = page_num;
pdf_ptr(img)->doc = epdf_doc;
- img_group_ref(img) = epdf_lastGroupObjectNum;
break;
case IMAGE_TYPE_PNG:
img_pages(img) = 1;
@@ -352,6 +350,7 @@ void writeimage(integer img)
switch (img_type(img)) {
case IMAGE_TYPE_PNG:
write_png(img);
+ write_additional_png_objects();
break;
case IMAGE_TYPE_JPG:
write_jpg(img);
@@ -363,20 +362,13 @@ void writeimage(integer img)
epdf_doc = pdf_ptr(img)->doc;
epdf_selected_page = pdf_ptr(img)->selected_page;
epdf_page_box = pdf_ptr(img)->page_box;
- epdf_lastGroupObjectNum = img_group_ref(img);
write_epdf();
break;
default:
pdftex_fail("unknown type of image");
}
+
tex_printf(">");
- if (img_type(img) == IMAGE_TYPE_PDF) {
- write_additional_epdf_objects();
- } else {
- if (img_type(img) == IMAGE_TYPE_PNG) {
- write_additional_png_objects();
- }
- }
cur_file_name = NULL;
}
diff --git a/Build/source/texk/web2c/pdftexdir/writejbig2.c b/Build/source/texk/web2c/pdftexdir/writejbig2.c
index e724a3cab3c..6ef31f012f7 100644
--- a/Build/source/texk/web2c/pdftexdir/writejbig2.c
+++ b/Build/source/texk/web2c/pdftexdir/writejbig2.c
@@ -78,7 +78,6 @@ object exists, reference it. Else create fresh one.
***********************************************************************/
#include "writejbig2.h"
-#undef DEBUG
/**********************************************************************/
@@ -311,19 +310,10 @@ boolean readseghdr(FILEINFO * fip, SEGINFO * sip)
sip->hdrstart = xftell(fip->file, fip->filename);
if (fip->sequentialaccess && sip->hdrstart == fip->filesize)
return false; /* no endoffileflag is ok for sequentialaccess */
-#ifdef DEBUG
- printf("\nhdrstart %d\n", sip->hdrstart);
-#endif
/* 7.2.2 Segment number */
sip->segnum = read4bytes(fip->file);
-#ifdef DEBUG
- printf(" segnum %d\n", sip->segnum);
-#endif
/* 7.2.3 Segment header flags */
sip->seghdrflags = ygetc(fip->file);
-#ifdef DEBUG
- printf(" hdrflags %d\n", sip->seghdrflags & 0x3f);
-#endif
checkseghdrflags(sip);
if (fip->sequentialaccess && sip->endoffileflag) /* accept shorter segment, */
return true; /* makes it compliant with Example 3.4 of PDFRef. 5th ed. */