|
|
@ -1,10 +1,3 @@ |
|
|
|
Submitted By: Ken Moffat <ken at linuxfromscratch dot org> |
|
|
|
Date: 2017-09-21 |
|
|
|
Initial Package Version: 20170524 |
|
|
|
Upstream Status: Unknown |
|
|
|
Origin: Arch linux |
|
|
|
Description: Fixes compilation with the API changes of poppler-0.59. |
|
|
|
|
|
|
|
diff -ur source.orig/texk/web2c/luatexdir/image/pdftoepdf.w source/texk/web2c/luatexdir/image/pdftoepdf.w
|
|
|
|
--- source.orig/texk/web2c/luatexdir/image/pdftoepdf.w 2017-05-08 22:39:36.639375783 +0200
|
|
|
|
+++ source/texk/web2c/luatexdir/image/pdftoepdf.w 2017-09-19 11:23:36.586768739 +0200
|
|
|
@ -727,16 +720,39 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
pdf_puts(" "); |
|
|
|
} |
|
|
|
pdf_puts("]\n"); |
|
|
|
@@ -396,7 +359,7 @@
|
|
|
|
@@ -394,10 +357,29 @@
|
|
|
|
|
|
|
|
#define REPLACE_TYPE1C true |
|
|
|
|
|
|
|
+static bool embeddableFont(Object * fontdesc)
|
|
|
|
+{
|
|
|
|
+ Object fontfile, ffsubtype;
|
|
|
|
+
|
|
|
|
+ if (!fontdesc->isDict())
|
|
|
|
+ return false;
|
|
|
|
+ fontfile = fontdesc->dictLookup("FontFile");
|
|
|
|
+ if (fontfile.isStream())
|
|
|
|
+ return true;
|
|
|
|
+ if (REPLACE_TYPE1C) {
|
|
|
|
+ fontfile = fontdesc->dictLookup("FontFile3");
|
|
|
|
+ if (!fontfile.isStream())
|
|
|
|
+ return false;
|
|
|
|
+ ffsubtype = fontfile.streamGetDict()->lookup("Subtype");
|
|
|
|
+ return ffsubtype.isName() && !strcmp(ffsubtype.getName(), "Type1C");
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static void copyFont(char *tag, Object * fontRef) |
|
|
|
{ |
|
|
|
- PdfObject fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
|
|
|
|
- fontfile, ffsubtype, stemV;
|
|
|
|
+ Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
|
|
|
|
fontfile, ffsubtype, stemV; |
|
|
|
+ stemV;
|
|
|
|
GfxFont *gfont; |
|
|
|
fd_entry *fd; |
|
|
|
@@ -413,33 +376,49 @@
|
|
|
|
fm_entry *fontmap; |
|
|
|
@@ -413,33 +395,39 @@
|
|
|
|
} |
|
|
|
// Only handle included Type1 (and Type1C) fonts; anything else will be copied. |
|
|
|
// Type1C fonts are replaced by Type1 fonts, if REPLACE_TYPE1C is true. |
|
|
@ -754,23 +770,13 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
- && !strcmp(ffsubtype->getName(), "Type1C")))
|
|
|
|
- && (fontmap = lookup_fontmap(basefont->getName())) != NULL) {
|
|
|
|
+ fontdict = fontRef->fetch(xref);
|
|
|
|
+ fontdesc = Object(objNull);
|
|
|
|
+ if (fontdict.isDict()) {
|
|
|
|
+ subtype = fontdict.dictLookup("Subtype");
|
|
|
|
+ basefont = fontdict.dictLookup("BaseFont");
|
|
|
|
+ fontdescRef = fontdict.dictLookupNF("FontDescriptor");
|
|
|
|
+ if (fontdescRef.isRef()) {
|
|
|
|
+ fontdesc = fontdescRef.fetch(xref);
|
|
|
|
+ if (fontdesc.isDict()) {
|
|
|
|
+ fontfile = fontdesc.dictLookup("FontFile");
|
|
|
|
+ if (!fontfile.isStream() && REPLACE_TYPE1C) {
|
|
|
|
+ fontfile = fontdesc.dictLookup("FontFile3");
|
|
|
|
+ ffsubtype = fontfile.streamGetDict()->lookup("Subtype");
|
|
|
|
+ if (!(ffsubtype.isName() && !strcmp(ffsubtype.getName(), "Type1C"))) {
|
|
|
|
+ // not a Type1-C font.
|
|
|
|
+ fontfile = Object(objNull);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!fixedinclusioncopyfont && fontdict.isDict()
|
|
|
@ -779,7 +785,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
+ && basefont.isName()
|
|
|
|
+ && fontdescRef.isRef()
|
|
|
|
+ && fontdesc.isDict()
|
|
|
|
+ && fontfile.isStream()
|
|
|
|
+ && embeddableFont(&fontdesc)
|
|
|
|
+ && (fontmap = lookup_fontmap(basefont.getName())) != NULL) {
|
|
|
|
// round /StemV value, since the PDF input is a float |
|
|
|
// (see Font Descriptors in PDF reference), but we only store an |
|
|
@ -806,7 +812,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
pdf_printf(" %d 0 R ", addFont(fontRef->getRef(), fd, |
|
|
|
addEncoding(gfont))); |
|
|
|
} else { |
|
|
|
@@ -451,24 +430,24 @@
|
|
|
|
@@ -451,24 +439,24 @@
|
|
|
|
|
|
|
|
static void copyFontResources(Object * obj) |
|
|
|
{ |
|
|
@ -836,7 +842,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
} |
|
|
|
pdf_puts(">>\n"); |
|
|
|
} |
|
|
|
@@ -557,7 +536,7 @@
|
|
|
|
@@ -557,7 +545,7 @@
|
|
|
|
|
|
|
|
static void copyObject(Object * obj) |
|
|
|
{ |
|
|
@ -845,7 +851,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
int i, l, c; |
|
|
|
Ref ref; |
|
|
|
char *p; |
|
|
|
@@ -601,8 +580,8 @@
|
|
|
|
@@ -601,8 +589,8 @@
|
|
|
|
} else if (obj->isArray()) { |
|
|
|
pdf_puts("["); |
|
|
|
for (i = 0, l = obj->arrayGetLength(); i < l; ++i) { |
|
|
@ -856,16 +862,18 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
pdf_puts(" "); |
|
|
|
copyObject(&obj1); |
|
|
|
} |
|
|
|
@@ -612,7 +591,7 @@
|
|
|
|
@@ -612,9 +600,8 @@
|
|
|
|
copyDict(obj); |
|
|
|
pdf_puts(">>"); |
|
|
|
} else if (obj->isStream()) { |
|
|
|
- initDictFromDict(obj1, obj->streamGetDict());
|
|
|
|
+ obj1 = Object(obj->streamGetDict());
|
|
|
|
pdf_puts("<<\n"); |
|
|
|
copyDict(&obj1); |
|
|
|
- copyDict(&obj1);
|
|
|
|
+ copyDict(obj->getStream()->getDictObject());
|
|
|
|
pdf_puts(">>\n"); |
|
|
|
@@ -638,9 +617,8 @@
|
|
|
|
pdf_puts("stream\n"); |
|
|
|
copyStream(obj->getStream()->getUndecodedStream()); |
|
|
|
@@ -638,9 +625,8 @@
|
|
|
|
InObj *r; |
|
|
|
for (r = inObjList; r != 0; r = r->next) { |
|
|
|
if (!r->written) { |
|
|
@ -876,7 +884,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
if (r->type == objFont) { |
|
|
|
assert(!obj1.isStream()); |
|
|
|
pdfbeginobj(r->num, 2); // \pdfobjcompresslevel = 2 is for this |
|
|
|
@@ -656,7 +634,6 @@
|
|
|
|
@@ -656,7 +642,6 @@
|
|
|
|
pdf_puts("\n"); |
|
|
|
pdfendobj(); |
|
|
|
} |
|
|
@ -884,7 +892,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -839,8 +816,8 @@
|
|
|
|
@@ -839,8 +824,8 @@
|
|
|
|
Page *page; |
|
|
|
Ref *pageRef; |
|
|
|
Dict *pageDict; |
|
|
@ -895,7 +903,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
bool writeSepGroup = false; |
|
|
|
Object info; |
|
|
|
char *key; |
|
|
|
@@ -867,8 +844,8 @@
|
|
|
|
@@ -867,8 +852,8 @@
|
|
|
|
encodingList = 0; |
|
|
|
page = pdf_doc->doc->getCatalog()->getPage(epdf_selected_page); |
|
|
|
pageRef = pdf_doc->doc->getCatalog()->getPageRef(epdf_selected_page); |
|
|
@ -906,7 +914,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
rotate = page->getRotate(); |
|
|
|
PDFRectangle *pagebox; |
|
|
|
// write the Page header |
|
|
|
@@ -886,7 +863,7 @@
|
|
|
|
@@ -886,7 +871,7 @@
|
|
|
|
pdf_printf("/%s.PageNumber %i\n", pdfkeyprefix, (int) epdf_selected_page); |
|
|
|
} |
|
|
|
if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_INFODICT) == 0) { |
|
|
@ -915,7 +923,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
if (info.isRef()) { |
|
|
|
// the info dict must be indirect (PDF Ref p. 61) |
|
|
|
pdf_printf("/%s.InfoDict ", pdfkeyprefix); |
|
|
|
@@ -942,14 +919,14 @@
|
|
|
|
@@ -942,14 +927,14 @@
|
|
|
|
pdf_puts(stripzeros(s)); |
|
|
|
|
|
|
|
// Metadata validity check (as a stream it must be indirect) |
|
|
@ -934,7 +942,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
pdf_newline(); |
|
|
|
pdf_printf("/%s ", pageDictKeys[i]); |
|
|
|
copyObject(&dictObj); // preserves indirection |
|
|
|
@@ -957,8 +934,8 @@
|
|
|
|
@@ -957,8 +942,8 @@
|
|
|
|
} |
|
|
|
|
|
|
|
// handle page group |
|
|
@ -945,7 +953,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
if (pdfpagegroupval == 0) { |
|
|
|
// another pdf with page group was included earlier on the |
|
|
|
// same page; copy the Group entry as is. See manual for |
|
|
|
@@ -972,11 +949,11 @@
|
|
|
|
@@ -972,11 +957,11 @@
|
|
|
|
copyObject(&dictObj); |
|
|
|
} else { |
|
|
|
// write Group dict as a separate object, since the Page dict also refers to it |
|
|
@ -960,29 +968,24 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval); |
|
|
|
} |
|
|
|
} |
|
|
|
@@ -989,15 +966,15 @@
|
|
|
|
@@ -989,14 +974,14 @@
|
|
|
|
pdftex_warn |
|
|
|
("PDF inclusion: /Resources missing. 'This practice is not recommended' (PDF Ref)"); |
|
|
|
} else { |
|
|
|
- initDictFromDict(obj1, page->getResourceDict());
|
|
|
|
- if (!obj1->isDict())
|
|
|
|
+ obj1 = Object(page->getResourceDict());
|
|
|
|
+ if (!obj1.isDict())
|
|
|
|
+ Object *obj1 = page->getResourceDictObject();
|
|
|
|
if (!obj1->isDict()) |
|
|
|
pdftex_fail("PDF inclusion: invalid resources dict type <%s>", |
|
|
|
- obj1->getTypeName());
|
|
|
|
+ obj1.getTypeName());
|
|
|
|
obj1->getTypeName()); |
|
|
|
pdf_newline(); |
|
|
|
pdf_puts("/Resources <<\n"); |
|
|
|
- for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
|
|
|
|
for (i = 0, l = obj1->dictGetLength(); i < l; ++i) { |
|
|
|
- obj1->dictGetVal(i, &obj2);
|
|
|
|
- key = obj1->dictGetKey(i);
|
|
|
|
+ for (i = 0, l = obj1.dictGetLength(); i < l; ++i) {
|
|
|
|
+ obj2 = obj1.dictGetVal(i);
|
|
|
|
+ key = obj1.dictGetKey(i);
|
|
|
|
+ obj2 = obj1->dictGetVal(i);
|
|
|
|
key = obj1->dictGetKey(i); |
|
|
|
if (strcmp("Font", key) == 0) |
|
|
|
copyFontResources(&obj2); |
|
|
|
else if (strcmp("ProcSet", key) == 0) |
|
|
|
@@ -1009,8 +986,8 @@
|
|
|
|
@@ -1009,8 +994,8 @@
|
|
|
|
} |
|
|
|
|
|
|
|
// write the page contents |
|
|
@ -993,7 +996,7 @@ diff -ur source.orig/texk/web2c/pdftexdir/pdftoepdf.cc source/texk/web2c/pdftexd |
|
|
|
|
|
|
|
// Variant A: get stream and recompress under control |
|
|
|
// of \pdfcompresslevel |
|
|
|
@@ -1021,36 +998,35 @@
|
|
|
|
@@ -1021,36 +1006,35 @@
|
|
|
|
|
|
|
|
// Variant B: copy stream without recompressing |
|
|
|
// |