diff options
Diffstat (limited to 'Build/source/libs/xpdf/xpdf-src/xpdf')
114 files changed, 1552 insertions, 3229 deletions
diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc index 33534dafd60..7b2b9855669 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <math.h> #include "gmem.h" @@ -339,12 +343,8 @@ AcroForm *AcroForm::load(PDFDoc *docA, Catalog *catalog, Object *acroFormObjA) { AcroForm *acroForm; AcroFormField *field; Object xfaObj, fieldsObj, annotsObj, annotRef, annotObj, obj1, obj2; - char *touchedObjs; int pageNum, i, j; - touchedObjs = (char *)gmalloc(docA->getXRef()->getNumObjects()); - memset(touchedObjs, 0, docA->getXRef()->getNumObjects()); - // this is the normal case: acroFormObj is a dictionary, as expected if (acroFormObjA->isDict()) { acroForm = new AcroForm(docA, acroFormObjA); @@ -372,12 +372,11 @@ AcroForm *AcroForm::load(PDFDoc *docA, Catalog *catalog, Object *acroFormObjA) { } obj1.free(); delete acroForm; - gfree(touchedObjs); return NULL; } for (i = 0; i < obj1.arrayGetLength(); ++i) { obj1.arrayGetNF(i, &obj2); - acroForm->scanField(&obj2, touchedObjs); + acroForm->scanField(&obj2); obj2.free(); } obj1.free(); @@ -401,7 +400,7 @@ AcroForm *AcroForm::load(PDFDoc *docA, Catalog *catalog, Object *acroFormObjA) { annotRef.fetch(acroForm->doc->getXRef(), &annotObj); if (annotObj.isDict()) { if (annotObj.dictLookup("Subtype", &obj1)->isName("Widget")) { - acroForm->scanField(&annotRef, touchedObjs); + acroForm->scanField(&annotRef); } obj1.free(); } @@ -432,7 +431,7 @@ AcroForm *AcroForm::load(PDFDoc *docA, Catalog *catalog, Object *acroFormObjA) { annotRef.fetch(acroForm->doc->getXRef(), &annotObj); if (annotObj.isDict()) { if (annotObj.dictLookup("Subtype", &obj1)->isName("Widget")) { - acroForm->scanField(&annotRef, touchedObjs); + acroForm->scanField(&annotRef); } obj1.free(); } @@ -450,8 +449,6 @@ AcroForm *AcroForm::load(PDFDoc *docA, Catalog *catalog, Object *acroFormObjA) { } } - gfree(touchedObjs); - return acroForm; } @@ -515,22 +512,12 @@ int AcroForm::lookupAnnotPage(Object *annotRef) { return 0; } -void AcroForm::scanField(Object *fieldRef, char *touchedObjs) { +void AcroForm::scanField(Object *fieldRef) { AcroFormField *field; Object fieldObj, kidsObj, kidRef, kidObj, subtypeObj; GBool isTerminal; int i; - // check for an object loop - if (fieldRef->isRef()) { - if (fieldRef->getRefNum() < 0 || - fieldRef->getRefNum() >= doc->getXRef()->getNumObjects() || - touchedObjs[fieldRef->getRefNum()]) { - return; - } - touchedObjs[fieldRef->getRefNum()] = 1; - } - fieldRef->fetch(doc->getXRef(), &fieldObj); if (!fieldObj.isDict()) { error(errSyntaxError, -1, "AcroForm field object is wrong type"); @@ -558,7 +545,7 @@ void AcroForm::scanField(Object *fieldRef, char *touchedObjs) { if (!isTerminal) { for (i = 0; !isTerminal && i < kidsObj.arrayGetLength(); ++i) { kidsObj.arrayGetNF(i, &kidRef); - scanField(&kidRef, touchedObjs); + scanField(&kidRef); kidRef.free(); } } @@ -2046,18 +2033,21 @@ void AcroFormField::drawText(GString *text, GString *da, GfxFontDict *fontDict, wMax = dx - 2 * border - 4; +#if 1 //~tmp // this is a kludge that appears to match Adobe's behavior if (height > 15) { topBorder = 5; } else { topBorder = 2; } +#else + topBorder = 5; +#endif // compute font autosize if (fontSize == 0) { for (fontSize = 10; fontSize > 1; --fontSize) { yy = dy - topBorder; - w = 0; i = 0; while (i < text2->getLength()) { getNextLine(text2, i, font, fontSize, wMax, &j, &w, &k); @@ -3193,7 +3183,7 @@ GBool AcroFormField::unicodeStringEqual(Unicode *u, int unicodeLength, return gFalse; } for (int i = 0; i < unicodeLength; ++i) { - if ((Unicode)(s->getChar(i) & 0xff) != u[i]) { + if ((s->getChar(i) & 0xff) != u[i]) { return gFalse; } } @@ -3203,7 +3193,7 @@ GBool AcroFormField::unicodeStringEqual(Unicode *u, int unicodeLength, GBool AcroFormField::unicodeStringEqual(Unicode *u, int unicodeLength, const char *s) { for (int i = 0; i < unicodeLength; ++i) { - if (!s[i] || (Unicode)(s[i] & 0xff) != u[i]) { + if (!s[i] || (s[i] & 0xff) != u[i]) { return gFalse; } } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.h b/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.h index 0e922d17afc..7678d46dbc8 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + class TextString; class Gfx; class GfxFont; @@ -43,7 +47,7 @@ private: AcroForm(PDFDoc *docA, Object *acroFormObjA); void buildAnnotPageList(Catalog *catalog); int lookupAnnotPage(Object *annotRef); - void scanField(Object *fieldRef, char *touchedObjs); + void scanField(Object *fieldRef); PDFDoc *doc; Object acroFormObj; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc index 465bda6194a..82ef600be73 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc @@ -2,15 +2,18 @@ // // Annot.cc // -// Copyright 2000-2022 Glyph & Cog, LLC +// Copyright 2000-2003 Glyph & Cog, LLC // //======================================================================== #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <math.h> -#include <limits.h> #include "gmem.h" #include "gmempp.h" #include "GList.h" @@ -275,8 +278,6 @@ Annot::Annot(PDFDoc *docA, Dict *dict, Ref *refA) { obj3.free(); } else if (obj2.isRef()) { obj2.copy(&appearance); - } else if (obj2.isStream()) { - obj2.copy(&appearance); } obj1.free(); obj2.free(); @@ -305,48 +306,29 @@ Annot::~Annot() { ocObj.free(); } -void Annot::generateAnnotAppearance(Object *annotObj) { +void Annot::generateAnnotAppearance() { Object obj; - appearance.fetch(doc->getXRef(), &obj); - GBool alreadyHaveAppearance = obj.isStream(); - obj.free(); - if (alreadyHaveAppearance) { - return; - } - if (!type || (type->cmp("Line") && - type->cmp("PolyLine") && - type->cmp("Polygon") && - type->cmp("FreeText"))) { - return; - } - - Object annotObj2; - if (!annotObj) { - getObject(&annotObj2); - annotObj = &annotObj2; - } - if (!annotObj->isDict()) { - annotObj2.free(); - return; - } - - if (!type->cmp("Line")) { - generateLineAppearance(annotObj); - } else if (!type->cmp("PolyLine")) { - generatePolyLineAppearance(annotObj); - } else if (!type->cmp("Polygon")) { - generatePolygonAppearance(annotObj); - } else if (!type->cmp("FreeText")) { - generateFreeTextAppearance(annotObj); + appearance.fetch(doc->getXRef(), &obj); + if (!obj.isStream()) { + if (type) { + if (!type->cmp("Line")) { + generateLineAppearance(); + } else if (!type->cmp("PolyLine")) { + generatePolyLineAppearance(); + } else if (!type->cmp("Polygon")) { + generatePolygonAppearance(); + } else if (!type->cmp("FreeText")) { + generateFreeTextAppearance(); + } + } } - - annotObj2.free(); + obj.free(); } //~ this doesn't draw the caption -void Annot::generateLineAppearance(Object *annotObj) { - Object gfxStateDict, appearDict, obj1, obj2; +void Annot::generateLineAppearance() { + Object annotObj, gfxStateDict, appearDict, obj1, obj2; MemStream *appearStream; double x1, y1, x2, y2, dx, dy, len, w; double lx1, ly1, lx2, ly2; @@ -357,10 +339,15 @@ void Annot::generateLineAppearance(Object *annotObj) { AnnotLineEndType lineEnd1, lineEnd2; GBool fill; + if (!getObject(&annotObj)->isDict()) { + annotObj.free(); + return; + } + appearBuf = new GString(); //----- check for transparency - if (annotObj->dictLookup("CA", &obj1)->isNum()) { + if (annotObj.dictLookup("CA", &obj1)->isNum()) { gfxStateDict.initDict(doc->getXRef()); gfxStateDict.dictAdd(copyString("ca"), obj1.copy(&obj2)); appearBuf->append("/GS1 gs\n"); @@ -371,7 +358,7 @@ void Annot::generateLineAppearance(Object *annotObj) { setLineStyle(borderStyle, &w); setStrokeColor(borderStyle->getColor(), borderStyle->getNumColorComps()); fill = gFalse; - if (annotObj->dictLookup("IC", &obj1)->isArray()) { + if (annotObj.dictLookup("IC", &obj1)->isArray()) { if (setFillColor(&obj1)) { fill = gTrue; } @@ -379,14 +366,14 @@ void Annot::generateLineAppearance(Object *annotObj) { obj1.free(); //----- get line properties - if (annotObj->dictLookup("L", &obj1)->isArray() && + if (annotObj.dictLookup("L", &obj1)->isArray() && obj1.arrayGetLength() == 4) { if (obj1.arrayGet(0, &obj2)->isNum()) { x1 = obj2.getNum(); } else { obj2.free(); obj1.free(); - return; + goto err1; } obj2.free(); if (obj1.arrayGet(1, &obj2)->isNum()) { @@ -394,7 +381,7 @@ void Annot::generateLineAppearance(Object *annotObj) { } else { obj2.free(); obj1.free(); - return; + goto err1; } obj2.free(); if (obj1.arrayGet(2, &obj2)->isNum()) { @@ -402,7 +389,7 @@ void Annot::generateLineAppearance(Object *annotObj) { } else { obj2.free(); obj1.free(); - return; + goto err1; } obj2.free(); if (obj1.arrayGet(3, &obj2)->isNum()) { @@ -410,16 +397,16 @@ void Annot::generateLineAppearance(Object *annotObj) { } else { obj2.free(); obj1.free(); - return; + goto err1; } obj2.free(); } else { obj1.free(); - return; + goto err1; } obj1.free(); lineEnd1 = lineEnd2 = annotLineEndNone; - if (annotObj->dictLookup("LE", &obj1)->isArray() && + if (annotObj.dictLookup("LE", &obj1)->isArray() && obj1.arrayGetLength() == 2) { lineEnd1 = parseLineEndType(obj1.arrayGet(0, &obj2)); obj2.free(); @@ -427,19 +414,19 @@ void Annot::generateLineAppearance(Object *annotObj) { obj2.free(); } obj1.free(); - if (annotObj->dictLookup("LL", &obj1)->isNum()) { + if (annotObj.dictLookup("LL", &obj1)->isNum()) { leaderLen = obj1.getNum(); } else { leaderLen = 0; } obj1.free(); - if (annotObj->dictLookup("LLE", &obj1)->isNum()) { + if (annotObj.dictLookup("LLE", &obj1)->isNum()) { leaderExtLen = obj1.getNum(); } else { leaderExtLen = 0; } obj1.free(); - if (annotObj->dictLookup("LLO", &obj1)->isNum()) { + if (annotObj.dictLookup("LLO", &obj1)->isNum()) { leaderOffLen = obj1.getNum(); } else { leaderOffLen = 0; @@ -526,19 +513,27 @@ void Annot::generateLineAppearance(Object *annotObj) { appearBuf->getLength(), &appearDict); appearance.free(); appearance.initStream(appearStream); + + err1: + annotObj.free(); } //~ this doesn't handle line ends (arrows) -void Annot::generatePolyLineAppearance(Object *annotObj) { - Object gfxStateDict, appearDict, obj1, obj2; +void Annot::generatePolyLineAppearance() { + Object annotObj, gfxStateDict, appearDict, obj1, obj2; MemStream *appearStream; double x1, y1, w; int i; + if (!getObject(&annotObj)->isDict()) { + annotObj.free(); + return; + } + appearBuf = new GString(); //----- check for transparency - if (annotObj->dictLookup("CA", &obj1)->isNum()) { + if (annotObj.dictLookup("CA", &obj1)->isNum()) { gfxStateDict.initDict(doc->getXRef()); gfxStateDict.dictAdd(copyString("ca"), obj1.copy(&obj2)); appearBuf->append("/GS1 gs\n"); @@ -549,7 +544,7 @@ void Annot::generatePolyLineAppearance(Object *annotObj) { setLineStyle(borderStyle, &w); setStrokeColor(borderStyle->getColor(), borderStyle->getNumColorComps()); // fill = gFalse; - // if (annotObj->dictLookup("IC", &obj1)->isArray()) { + // if (annotObj.dictLookup("IC", &obj1)->isArray()) { // if (setFillColor(&obj1)) { // fill = gTrue; // } @@ -557,22 +552,22 @@ void Annot::generatePolyLineAppearance(Object *annotObj) { // obj1.free(); //----- draw line - if (!annotObj->dictLookup("Vertices", &obj1)->isArray()) { + if (!annotObj.dictLookup("Vertices", &obj1)->isArray()) { obj1.free(); - return; + goto err1; } for (i = 0; i+1 < obj1.arrayGetLength(); i += 2) { if (!obj1.arrayGet(i, &obj2)->isNum()) { obj2.free(); obj1.free(); - return; + goto err1; } x1 = obj2.getNum(); obj2.free(); if (!obj1.arrayGet(i+1, &obj2)->isNum()) { obj2.free(); obj1.free(); - return; + goto err1; } y1 = obj2.getNum(); obj2.free(); @@ -611,18 +606,26 @@ void Annot::generatePolyLineAppearance(Object *annotObj) { appearBuf->getLength(), &appearDict); appearance.free(); appearance.initStream(appearStream); + + err1: + annotObj.free(); } -void Annot::generatePolygonAppearance(Object *annotObj) { - Object gfxStateDict, appearDict, obj1, obj2; +void Annot::generatePolygonAppearance() { + Object annotObj, gfxStateDict, appearDict, obj1, obj2; MemStream *appearStream; double x1, y1; int i; + if (!getObject(&annotObj)->isDict()) { + annotObj.free(); + return; + } + appearBuf = new GString(); //----- check for transparency - if (annotObj->dictLookup("CA", &obj1)->isNum()) { + if (annotObj.dictLookup("CA", &obj1)->isNum()) { gfxStateDict.initDict(doc->getXRef()); gfxStateDict.dictAdd(copyString("ca"), obj1.copy(&obj2)); appearBuf->append("/GS1 gs\n"); @@ -630,30 +633,30 @@ void Annot::generatePolygonAppearance(Object *annotObj) { obj1.free(); //----- set fill color - if (!annotObj->dictLookup("IC", &obj1)->isArray() || + if (!annotObj.dictLookup("IC", &obj1)->isArray() || !setFillColor(&obj1)) { obj1.free(); - return; + goto err1; } obj1.free(); //----- fill polygon - if (!annotObj->dictLookup("Vertices", &obj1)->isArray()) { + if (!annotObj.dictLookup("Vertices", &obj1)->isArray()) { obj1.free(); - return; + goto err1; } for (i = 0; i+1 < obj1.arrayGetLength(); i += 2) { if (!obj1.arrayGet(i, &obj2)->isNum()) { obj2.free(); obj1.free(); - return; + goto err1; } x1 = obj2.getNum(); obj2.free(); if (!obj1.arrayGet(i+1, &obj2)->isNum()) { obj2.free(); obj1.free(); - return; + goto err1; } y1 = obj2.getNum(); obj2.free(); @@ -692,23 +695,31 @@ void Annot::generatePolygonAppearance(Object *annotObj) { appearBuf->getLength(), &appearDict); appearance.free(); appearance.initStream(appearStream); + + err1: + annotObj.free(); } //~ this doesn't handle rich text //~ this doesn't handle the callout //~ this doesn't handle the RD field -void Annot::generateFreeTextAppearance(Object *annotObj) { - Object gfxStateDict, appearDict, obj1, obj2; +void Annot::generateFreeTextAppearance() { + Object annotObj, gfxStateDict, appearDict, obj1, obj2; Object resources, gsResources, fontResources, defaultFont; GString *text, *da; double lineWidth; int quadding, rot; MemStream *appearStream; + if (!getObject(&annotObj)->isDict()) { + annotObj.free(); + return; + } + appearBuf = new GString(); //----- check for transparency - if (annotObj->dictLookup("CA", &obj1)->isNum()) { + if (annotObj.dictLookup("CA", &obj1)->isNum()) { gfxStateDict.initDict(doc->getXRef()); gfxStateDict.dictAdd(copyString("ca"), obj1.copy(&obj2)); appearBuf->append("/GS1 gs\n"); @@ -716,19 +727,19 @@ void Annot::generateFreeTextAppearance(Object *annotObj) { obj1.free(); //----- draw the text - if (annotObj->dictLookup("Contents", &obj1)->isString()) { + if (annotObj.dictLookup("Contents", &obj1)->isString()) { text = obj1.getString()->copy(); } else { text = new GString(); } obj1.free(); - if (annotObj->dictLookup("Q", &obj1)->isInt()) { + if (annotObj.dictLookup("Q", &obj1)->isInt()) { quadding = obj1.getInt(); } else { quadding = 0; } obj1.free(); - if (annotObj->dictLookup("DA", &obj1)->isString()) { + if (annotObj.dictLookup("DA", &obj1)->isString()) { da = obj1.getString()->copy(); } else { da = new GString(); @@ -736,7 +747,7 @@ void Annot::generateFreeTextAppearance(Object *annotObj) { obj1.free(); // the "Rotate" field is not defined in the PDF spec, but Acrobat // looks at it - if (annotObj->dictLookup("Rotate", &obj1)->isInt()) { + if (annotObj.dictLookup("Rotate", &obj1)->isInt()) { rot = obj1.getInt(); } else { rot = 0; @@ -786,6 +797,8 @@ void Annot::generateFreeTextAppearance(Object *annotObj) { appearBuf->getLength(), &appearDict); appearance.free(); appearance.initStream(appearStream); + + annotObj.free(); } void Annot::setLineStyle(AnnotBorderStyle *bs, double *lineWidth) { @@ -1331,192 +1344,105 @@ Object *Annot::getObject(Object *obj) { } //------------------------------------------------------------------------ -// PageAnnots -//------------------------------------------------------------------------ - -class PageAnnots { -public: - - PageAnnots(); - ~PageAnnots(); - - GList *annots; // list of annots on the page [Annot] - GBool appearancesGenerated; // set after appearances have been generated -}; - -PageAnnots::PageAnnots() { - annots = new GList(); - appearancesGenerated = gFalse; -} - -PageAnnots::~PageAnnots() { - deleteGList(annots, Annot); -} - -//------------------------------------------------------------------------ // Annots //------------------------------------------------------------------------ -Annots::Annots(PDFDoc *docA) { - doc = docA; - pageAnnots = (PageAnnots **)gmallocn(doc->getNumPages(), sizeof(PageAnnots*)); - for (int page = 1; page <= doc->getNumPages(); ++page) { - pageAnnots[page - 1] = NULL; - } - formFieldRefsSize = 0; - formFieldRefs = NULL; -} - -Annots::~Annots() { - for (int page = 1; page <= doc->getNumPages(); ++page) { - delete pageAnnots[page - 1]; - } - gfree(pageAnnots); - gfree(formFieldRefs); -} - -void Annots::loadAnnots(int page) { - if (pageAnnots[page - 1]) { - return; - } - - pageAnnots[page - 1] = new PageAnnots(); - - Object annotsObj; - doc->getCatalog()->getPage(page)->getAnnots(&annotsObj); - if (!annotsObj.isArray()) { - annotsObj.free(); - return; - } - - loadFormFieldRefs(); - - for (int i = 0; i < annotsObj.arrayGetLength(); ++i) { - Object annotObj; - Ref annotRef; - if (annotsObj.arrayGetNF(i, &annotObj)->isRef()) { - annotRef = annotObj.getRef(); - annotObj.free(); - annotsObj.arrayGet(i, &annotObj); - } else { - annotRef.num = annotRef.gen = -1; - } - if (!annotObj.isDict()) { - annotObj.free(); - continue; - } - - // skip any annotations which are used as AcroForm fields -- - // they'll be rendered by the AcroForm module - if (annotRef.num >= 0 && annotRef.num < formFieldRefsSize && - formFieldRefs[annotRef.num]) { - annotObj.free(); - continue; - } - - Annot *annot = new Annot(doc, annotObj.getDict(), &annotRef); - annotObj.free(); - if (annot->isOk()) { - pageAnnots[page - 1]->annots->append(annot); - } else { - delete annot; - } - } - - annotsObj.free(); -} - -// Build a set of object refs for AcroForm fields. -void Annots::loadFormFieldRefs() { - if (formFieldRefs) { - return; - } - - AcroForm *form = doc->getCatalog()->getForm(); - if (!form) { - return; - } +Annots::Annots(PDFDoc *docA, Object *annotsObj) { + Annot *annot; + Object obj1, obj2; + Ref ref; + GBool drawWidgetAnnots; + int size; + int i; - int newFormFieldRefsSize = 256; - for (int i = 0; i < form->getNumFields(); ++i) { - AcroFormField *field = form->getField(i); - Object fieldRef; - field->getFieldRef(&fieldRef); - if (fieldRef.getRefNum() >= formFieldRefsSize) { - while (fieldRef.getRefNum() >= newFormFieldRefsSize && - newFormFieldRefsSize <= INT_MAX / 2) { - newFormFieldRefsSize *= 2; - } - if (fieldRef.getRefNum() >= newFormFieldRefsSize) { - continue; + doc = docA; + annots = NULL; + size = 0; + nAnnots = 0; + + if (annotsObj->isArray()) { + // Kludge: some PDF files define an empty AcroForm, but still + // include Widget-type annotations -- in that case, we want to + // draw the widgets (since the form code won't). This really + // ought to look for Widget-type annotations that are not included + // in any form field. + drawWidgetAnnots = !doc->getCatalog()->getForm() || + doc->getCatalog()->getForm()->getNumFields() == 0; + for (i = 0; i < annotsObj->arrayGetLength(); ++i) { + if (annotsObj->arrayGetNF(i, &obj1)->isRef()) { + ref = obj1.getRef(); + obj1.free(); + annotsObj->arrayGet(i, &obj1); + } else { + ref.num = ref.gen = -1; } - formFieldRefs = (char *)grealloc(formFieldRefs, newFormFieldRefsSize); - for (int j = formFieldRefsSize; j < newFormFieldRefsSize; ++j) { - formFieldRefs[j] = (char)0; + if (obj1.isDict()) { + if (drawWidgetAnnots || + !obj1.dictLookup("Subtype", &obj2)->isName("Widget")) { + annot = new Annot(doc, obj1.getDict(), &ref); + if (annot->isOk()) { + if (nAnnots >= size) { + size += 16; + annots = (Annot **)greallocn(annots, size, sizeof(Annot *)); + } + annots[nAnnots++] = annot; + } else { + delete annot; + } + } + obj2.free(); } - formFieldRefsSize = newFormFieldRefsSize; + obj1.free(); } - formFieldRefs[fieldRef.getRefNum()] = (char)1; - fieldRef.free(); } } -int Annots::getNumAnnots(int page) { - loadAnnots(page); - return pageAnnots[page - 1]->annots->getLength(); -} +Annots::~Annots() { + int i; -Annot *Annots::getAnnot(int page, int idx) { - loadAnnots(page); - return (Annot *)pageAnnots[page - 1]->annots->get(idx); + for (i = 0; i < nAnnots; ++i) { + delete annots[i]; + } + gfree(annots); } -Annot *Annots::find(int page, double x, double y) { - loadAnnots(page); - PageAnnots *pa = pageAnnots[page - 1]; - for (int i = pa->annots->getLength() - 1; i >= 0; --i) { - Annot *annot = (Annot *)pa->annots->get(i); - if (annot->inRect(x, y)) { - return annot; +Annot *Annots::find(double x, double y) { + int i; + + for (i = nAnnots - 1; i >= 0; --i) { + if (annots[i]->inRect(x, y)) { + return annots[i]; } } return NULL; } -int Annots::findIdx(int page, double x, double y) { - loadAnnots(page); - PageAnnots *pa = pageAnnots[page - 1]; - for (int i = pa->annots->getLength() - 1; i >= 0; --i) { - Annot *annot = (Annot *)pa->annots->get(i); - if (annot->inRect(x, y)) { +int Annots::findIdx(double x, double y) { + int i; + + for (i = nAnnots - 1; i >= 0; --i) { + if (annots[i]->inRect(x, y)) { return i; } } return -1; } -void Annots::add(int page, Object *annotObj) { - if (!annotObj->isDict()) { - return; - } - Ref annotRef = {-1, -1}; - Annot *annot = new Annot(doc, annotObj->getDict(), &annotRef); - if (annot->isOk()) { - annot->generateAnnotAppearance(annotObj); - pageAnnots[page - 1]->annots->append(annot); - } else { - delete annot; +void Annots::generateAnnotAppearances() { + int i; + + for (i = 0; i < nAnnots; ++i) { + annots[i]->generateAnnotAppearance(); } } -void Annots::generateAnnotAppearances(int page) { - loadAnnots(page); - PageAnnots *pa = pageAnnots[page - 1]; - if (!pa->appearancesGenerated) { - for (int i = 0; i < pa->annots->getLength(); ++i) { - Annot *annot = (Annot *)pa->annots->get(i); - annot->generateAnnotAppearance(NULL); +Annot *Annots::findAnnot(Ref *ref) { + int i; + + for (i = 0; i < nAnnots; ++i) { + if (annots[i]->match(ref)) { + return annots[i]; } - pa->appearancesGenerated = gTrue; } + return NULL; } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.h index 168061fc262..6ba5ff490da 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.h @@ -2,7 +2,7 @@ // // Annot.h // -// Copyright 2000-2022 Glyph & Cog, LLC +// Copyright 2000-2003 Glyph & Cog, LLC // //======================================================================== @@ -11,12 +11,15 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + class XRef; class Catalog; class Gfx; class GfxFontDict; class PDFDoc; -class PageAnnots; //------------------------------------------------------------------------ // AnnotBorderStyle @@ -102,14 +105,14 @@ public: GBool match(Ref *refA) { return ref.num == refA->num && ref.gen == refA->gen; } - void generateAnnotAppearance(Object *annotObj); + void generateAnnotAppearance(); private: - void generateLineAppearance(Object *annotObj); - void generatePolyLineAppearance(Object *annotObj); - void generatePolygonAppearance(Object *annotObj); - void generateFreeTextAppearance(Object *annotObj); + void generateLineAppearance(); + void generatePolyLineAppearance(); + void generatePolygonAppearance(); + void generateFreeTextAppearance(); void setLineStyle(AnnotBorderStyle *bs, double *lineWidth); void setStrokeColor(double *color, int nComps); GBool setFillColor(Object *colorObj); @@ -149,35 +152,34 @@ private: class Annots { public: - Annots(PDFDoc *docA); + // Build a list of Annot objects. + Annots(PDFDoc *docA, Object *annotsObj); ~Annots(); - // Iterate over annotations on a specific page. - int getNumAnnots(int page); - Annot *getAnnot(int page, int idx); + // Iterate through list of annotations. + int getNumAnnots() { return nAnnots; } + Annot *getAnnot(int i) { return annots[i]; } - // If point (<x>,<y>) is in an annotation, return the associated - // annotation (or annotation index); else return NULL (or -1). - Annot *find(int page, double x, double y); - int findIdx(int page, double x, double y); - - // Add an annotation [annotObj] on page [page]. - void add(int page, Object *annotObj); + // If point <x>,<y> is in an annotation, return the associated + // annotation; else return NULL. + Annot *find(double x, double y); + int findIdx(double x, double y); // Generate an appearance stream for any non-form-field annotation - // on the specified page that is missing an appearance. - void generateAnnotAppearances(int page); + // that is missing it. + void generateAnnotAppearances(); private: - void loadAnnots(int page); - void loadFormFieldRefs(); + void scanFieldAppearances(Dict *node, Ref *ref, Dict *parent, + Dict *acroForm); + + Annot *findAnnot(Ref *ref); PDFDoc *doc; - PageAnnots **pageAnnots; // list of annots for each page - int formFieldRefsSize; // number of entries in formFieldRefs[] - char *formFieldRefs; // set of AcroForm field refs + Annot **annots; + int nAnnots; }; #endif diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Array.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Array.cc index 2771186152a..2bf948ec65c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Array.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Array.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <stddef.h> #include "gmem.h" @@ -49,7 +53,7 @@ void Array::add(Object *elem) { Object *Array::get(int i, Object *obj, int recursion) { if (i < 0 || i >= length) { -#ifdef DEBUG_OBJECT_MEM +#ifdef DEBUG_MEM abort(); #else return obj->initNull(); @@ -60,7 +64,7 @@ Object *Array::get(int i, Object *obj, int recursion) { Object *Array::getNF(int i, Object *obj) { if (i < 0 || i >= length) { -#ifdef DEBUG_OBJECT_MEM +#ifdef DEBUG_MEM abort(); #else return obj->initNull(); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Array.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Array.h index 9a887f41e46..8d10eadc8dd 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Array.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Array.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #if MULTITHREADED #include "GMutex.h" #endif diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.cc index 51c2d33b3f9..d2f875e45fd 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <string.h> #include "gmem.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.h b/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.h index 042e4e0d634..f24cbf98f9f 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" struct BuiltinFont; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/CMap.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/CMap.cc index c898ac5737d..12632c5992c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/CMap.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/CMap.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/CMap.h b/Build/source/libs/xpdf/xpdf-src/xpdf/CMap.h index 5731ef09f01..55692b4f337 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/CMap.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/CMap.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "CharTypes.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc index 7a9b0701ca3..ddcbad55f07 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <string.h> #include <stddef.h> #include <limits.h> @@ -522,10 +526,7 @@ GBool Catalog::readPageTree(Object *catDict) { // because other code tries to fetch pages 1 through n. // In both cases: ignore the given page count and scan the tree // instead. - char *touchedObjs = (char *)gmalloc(xref->getNumObjects()); - memset(touchedObjs, 0, xref->getNumObjects()); - numPages = countPageTree(&topPagesRef, touchedObjs); - gfree(touchedObjs); + numPages = countPageTree(&topPagesObj); } } else { // assume we got a Page node instead of a Pages node @@ -552,53 +553,30 @@ GBool Catalog::readPageTree(Object *catDict) { return gTrue; } -int Catalog::countPageTree(Object *pagesNodeRef, char *touchedObjs) { - // check for invalid reference - if (pagesNodeRef->isRef() && - (pagesNodeRef->getRefNum() < 0 || - pagesNodeRef->getRefNum() >= xref->getNumObjects())) { +int Catalog::countPageTree(Object *pagesObj) { + Object kids, kid; + int n, n2, i; + + if (!pagesObj->isDict()) { return 0; } - - // check for a page tree loop; fetch the node object - Object pagesNode; - if (pagesNodeRef->isRef()) { - if (touchedObjs[pagesNodeRef->getRefNum()]) { - error(errSyntaxError, -1, "Loop in Pages tree"); - return 0; - } - touchedObjs[pagesNodeRef->getRefNum()] = 1; - xref->fetch(pagesNodeRef->getRefNum(), pagesNodeRef->getRefGen(), - &pagesNode); - } else { - pagesNodeRef->copy(&pagesNode); - } - - // count the subtree - int n = 0; - if (pagesNode.isDict()) { - Object kids; - if (pagesNode.dictLookup("Kids", &kids)->isArray()) { - for (int i = 0; i < kids.arrayGetLength(); ++i) { - Object kid; - kids.arrayGetNF(i, &kid); - int n2 = countPageTree(&kid, touchedObjs); - if (n2 < INT_MAX - n) { - n += n2; - } else { - error(errSyntaxError, -1, "Page tree contains too many pages"); - n = INT_MAX; - } - kid.free(); + if (pagesObj->dictLookup("Kids", &kids)->isArray()) { + n = 0; + for (i = 0; i < kids.arrayGetLength(); ++i) { + kids.arrayGet(i, &kid); + n2 = countPageTree(&kid); + if (n2 < INT_MAX - n) { + n += n2; + } else { + error(errSyntaxError, -1, "Page tree contains too many pages"); + n = INT_MAX; } - } else { - n = 1; + kid.free(); } - kids.free(); + } else { + n = 1; } - - pagesNode.free(); - + kids.free(); return n; } @@ -760,55 +738,37 @@ void Catalog::readEmbeddedFileList(Dict *catDict) { Object obj1, obj2; char *touchedObjs; - touchedObjs = (char *)gmalloc(xref->getNumObjects()); - memset(touchedObjs, 0, xref->getNumObjects()); - // read the embedded file name tree if (catDict->lookup("Names", &obj1)->isDict()) { - obj1.dictLookupNF("EmbeddedFiles", &obj2); - readEmbeddedFileTree(&obj2, touchedObjs); + if (obj1.dictLookup("EmbeddedFiles", &obj2)->isDict()) { + readEmbeddedFileTree(&obj2); + } obj2.free(); } obj1.free(); // look for file attachment annotations + touchedObjs = (char *)gmalloc(xref->getNumObjects()); + memset(touchedObjs, 0, xref->getNumObjects()); readFileAttachmentAnnots(catDict->lookupNF("Pages", &obj1), touchedObjs); obj1.free(); - gfree(touchedObjs); } -void Catalog::readEmbeddedFileTree(Object *nodeRef, char *touchedObjs) { - Object node, kidsObj, kidObj; +void Catalog::readEmbeddedFileTree(Object *node) { + Object kidsObj, kidObj; Object namesObj, nameObj, fileSpecObj; int i; - // check for an object loop - if (nodeRef->isRef()) { - if (nodeRef->getRefNum() < 0 || - nodeRef->getRefNum() >= xref->getNumObjects() || - touchedObjs[nodeRef->getRefNum()]) { - return; - } - touchedObjs[nodeRef->getRefNum()] = 1; - xref->fetch(nodeRef->getRefNum(), nodeRef->getRefGen(), &node); - } else { - nodeRef->copy(&node); - } - - if (!node.isDict()) { - node.free(); - return; - } - - if (node.dictLookup("Kids", &kidsObj)->isArray()) { + if (node->dictLookup("Kids", &kidsObj)->isArray()) { for (i = 0; i < kidsObj.arrayGetLength(); ++i) { - kidsObj.arrayGetNF(i, &kidObj); - readEmbeddedFileTree(&kidObj, touchedObjs); + if (kidsObj.arrayGet(i, &kidObj)->isDict()) { + readEmbeddedFileTree(&kidObj); + } kidObj.free(); } } else { - if (node.dictLookup("Names", &namesObj)->isArray()) { + if (node->dictLookup("Names", &namesObj)->isArray()) { for (i = 0; i+1 < namesObj.arrayGetLength(); ++i) { namesObj.arrayGet(i, &nameObj); namesObj.arrayGet(i+1, &fileSpecObj); @@ -820,8 +780,6 @@ void Catalog::readEmbeddedFileTree(Object *nodeRef, char *touchedObjs) { namesObj.free(); } kidsObj.free(); - - node.free(); } void Catalog::readFileAttachmentAnnots(Object *pageNodeRef, @@ -830,9 +788,8 @@ void Catalog::readFileAttachmentAnnots(Object *pageNodeRef, int i; // check for an invalid object reference (e.g., in a damaged PDF file) - if (pageNodeRef->isRef() && - (pageNodeRef->getRefNum() < 0 || - pageNodeRef->getRefNum() >= xref->getNumObjects())) { + if (pageNodeRef->getRefNum() < 0 || + pageNodeRef->getRefNum() >= xref->getNumObjects()) { return; } @@ -944,14 +901,10 @@ Object *Catalog::getEmbeddedFileStreamObj(int idx, Object *strObj) { void Catalog::readPageLabelTree(Object *root) { PageLabelNode *label0, *label1; - char *touchedObjs; int i; - touchedObjs = (char *)gmalloc(xref->getNumObjects()); - memset(touchedObjs, 0, xref->getNumObjects()); pageLabels = new GList(); - readPageLabelTree2(root, touchedObjs); - gfree(touchedObjs); + readPageLabelTree2(root); if (pageLabels->getLength() == 0) { deleteGList(pageLabels, PageLabelNode); @@ -969,29 +922,15 @@ void Catalog::readPageLabelTree(Object *root) { label0->lastPage = numPages; } -void Catalog::readPageLabelTree2(Object *nodeRef, char *touchedObjs) { - Object node, nums, num, labelObj, kids, kid; +void Catalog::readPageLabelTree2(Object *node) { + Object nums, num, labelObj, kids, kid; int i; - // check for an object loop - if (nodeRef->isRef()) { - if (nodeRef->getRefNum() < 0 || - nodeRef->getRefNum() >= xref->getNumObjects() || - touchedObjs[nodeRef->getRefNum()]) { - return; - } - touchedObjs[nodeRef->getRefNum()] = 1; - xref->fetch(nodeRef->getRefNum(), nodeRef->getRefGen(), &node); - } else { - nodeRef->copy(&node); - } - - if (!node.isDict()) { - node.free(); + if (!node->isDict()) { return; } - if (node.dictLookup("Nums", &nums)->isArray()) { + if (node->dictLookup("Nums", &nums)->isArray()) { for (i = 0; i < nums.arrayGetLength() - 1; i += 2) { if (nums.arrayGet(i, &num)->isInt()) { if (nums.arrayGet(i+1, &labelObj)->isDict()) { @@ -1005,16 +944,14 @@ void Catalog::readPageLabelTree2(Object *nodeRef, char *touchedObjs) { } nums.free(); - if (node.dictLookup("Kids", &kids)->isArray()) { + if (node->dictLookup("Kids", &kids)->isArray()) { for (i = 0; i < kids.arrayGetLength(); ++i) { - kids.arrayGetNF(i, &kid); - readPageLabelTree2(&kid, touchedObjs); + kids.arrayGet(i, &kid); + readPageLabelTree2(&kid); kid.free(); } } kids.free(); - - node.free(); } TextString *Catalog::getPageLabel(int pageNum) { @@ -1258,130 +1195,3 @@ GBool Catalog::convertPageLabelToInt(TextString *pageLabel, int prefixLength, } return gFalse; } - -GBool Catalog::usesJavaScript() { - Object catDict; - if (!xref->getCatalog(&catDict)->isDict()) { - catDict.free(); - return gFalse; - } - - GBool usesJS = gFalse; - - // check for Catalog.Names.JavaScript - Object namesObj; - if (catDict.dictLookup("Names", &namesObj)->isDict()) { - Object jsNamesObj; - namesObj.dictLookup("JavaScript", &jsNamesObj); - if (jsNamesObj.isDict()) { - usesJS = gTrue; - } - jsNamesObj.free(); - } - namesObj.free(); - - // look for JavaScript actionas in Page.AA - if (!usesJS) { - char *touchedObjs = (char *)gmalloc(xref->getNumObjects()); - memset(touchedObjs, 0, xref->getNumObjects()); - Object pagesObj; - usesJS = scanPageTreeForJavaScript(catDict.dictLookupNF("Pages", &pagesObj), - touchedObjs); - pagesObj.free(); - gfree(touchedObjs); - } - - catDict.free(); - - return usesJS; -} - -GBool Catalog::scanPageTreeForJavaScript(Object *pageNodeRef, - char *touchedObjs) { - // check for an invalid object reference (e.g., in a damaged PDF file) - if (pageNodeRef->isRef() && - (pageNodeRef->getRefNum() < 0 || - pageNodeRef->getRefNum() >= xref->getNumObjects())) { - return gFalse; - } - - // check for a page tree loop - Object pageNode; - if (pageNodeRef->isRef()) { - if (touchedObjs[pageNodeRef->getRefNum()]) { - return gFalse; - } - touchedObjs[pageNodeRef->getRefNum()] = 1; - xref->fetch(pageNodeRef->getRefNum(), pageNodeRef->getRefGen(), &pageNode); - } else { - pageNodeRef->copy(&pageNode); - } - - // scan the page tree node - GBool usesJS = gFalse; - if (pageNode.isDict()) { - Object kids; - if (pageNode.dictLookup("Kids", &kids)->isArray()) { - for (int i = 0; i < kids.arrayGetLength() && !usesJS; ++i) { - Object kid; - if (scanPageTreeForJavaScript(kids.arrayGetNF(i, &kid), touchedObjs)) { - usesJS = gTrue; - } - kid.free(); - } - } else { - - // scan Page.AA - Object pageAA; - if (pageNode.dictLookup("AA", &pageAA)->isDict()) { - if (scanAAForJavaScript(&pageAA)) { - usesJS = gTrue; - } - } - pageAA.free(); - - // scanPage.Annots - if (!usesJS) { - Object annots; - if (pageNode.dictLookup("Annots", &annots)->isArray()) { - for (int i = 0; i < annots.arrayGetLength() && !usesJS; ++i) { - Object annot; - if (annots.arrayGet(i, &annot)->isDict()) { - Object annotAA; - if (annot.dictLookup("AA", &annotAA)->isDict()) { - if (scanAAForJavaScript(&annotAA)) { - usesJS = gTrue; - } - } - annotAA.free(); - } - annot.free(); - } - } - annots.free(); - } - } - kids.free(); - } - - pageNode.free(); - - return usesJS; -} - -GBool Catalog::scanAAForJavaScript(Object *aaObj) { - GBool usesJS = gFalse; - for (int i = 0; i < aaObj->dictGetLength() && !usesJS; ++i) { - Object action; - if (aaObj->dictGetVal(i, &action)->isDict()) { - Object js; - if (!action.dictLookupNF("JS", &js)->isNull()) { - usesJS = gTrue; - } - js.free(); - } - action.free(); - } - return usesJS; -} - diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.h index 91597e54137..0acdd2d1574 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #if MULTITHREADED #include "GMutex.h" #endif @@ -114,9 +118,6 @@ public: Object *getViewerPreferences() { return &viewerPrefs; } - // Return true if the document uses JavaScript. - GBool usesJavaScript(); - private: PDFDoc *doc; @@ -145,23 +146,21 @@ private: Object *findDestInTree(Object *tree, GString *name, Object *obj); GBool readPageTree(Object *catDict); - int countPageTree(Object *pagesNodeRef, char *touchedObjs); + int countPageTree(Object *pagesObj); void loadPage(int pg); void loadPage2(int pg, int relPg, PageTreeNode *node); void readEmbeddedFileList(Dict *catDict); - void readEmbeddedFileTree(Object *nodeRef, char *touchedObjs); + void readEmbeddedFileTree(Object *node); void readFileAttachmentAnnots(Object *pageNodeRef, char *touchedObjs); void readEmbeddedFile(Object *fileSpec, Object *name1); void readPageLabelTree(Object *root); - void readPageLabelTree2(Object *node, char *touchedObjs); + void readPageLabelTree2(Object *node); PageLabelNode *findPageLabel(int pageNum); GString *makeRomanNumeral(int num, GBool uppercase); GString *makeLetterLabel(int num, GBool uppercase); GBool convertPageLabelToInt(TextString *pageLabel, int prefixLength, char style, int *n); - GBool scanPageTreeForJavaScript(Object *pageNodeRef, char *touchedObjs); - GBool scanAAForJavaScript(Object *aaObj); }; #endif diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc index 83720069e64..0a2100fde9b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <string.h> #include "gmem.h" @@ -270,18 +274,7 @@ GBool CharCodeToUnicode::parseCMap1(int (*getCharFunc)(void *), void *data, pst = new PSTokenizer(getCharFunc, data); pst->getToken(tok1, sizeof(tok1), &n1); while (pst->getToken(tok2, sizeof(tok2), &n2)) { - if (!strcmp(tok1, "begincodespacerange")) { - if (globalParams->getIgnoreWrongSizeToUnicode() && - tok2[0] == '<' && tok2[n2 - 1] == '>' && - n2 - 2 != nBits / 4) { - error(errSyntaxWarning, -1, - "Incorrect character size in ToUnicode CMap"); - ok = gFalse; - break; - } - while (pst->getToken(tok1, sizeof(tok1), &n1) && - strcmp(tok1, "endcodespacerange")) ; - } else if (!strcmp(tok2, "usecmap")) { + if (!strcmp(tok2, "usecmap")) { if (tok1[0] == '/') { name = new GString(tok1 + 1); if ((f = globalParams->findToUnicodeFile(name))) { @@ -472,7 +465,6 @@ GBool CharCodeToUnicode::parseCMap1(int (*getCharFunc)(void *), void *data, pst->getToken(tok1, sizeof(tok1), &n1); } else { strcpy(tok1, tok2); - n1 = n2; } } delete pst; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h index 7bbc97f834e..be9025107aa 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/CharCodeToUnicode.h @@ -13,6 +13,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "CharTypes.h" #if MULTITHREADED diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.cc index d36626dc344..d4f8d4ec336 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <string.h> #include "gmem.h" #include "gmempp.h" @@ -1488,14 +1492,14 @@ static void sha512(Guchar *msg, int msgLen, Guchar *hash) { SHA512Uint64 H[8]; int blkLen, i; - H[0] = 0x6a09e667f3bcc908ULL; - H[1] = 0xbb67ae8584caa73bULL; - H[2] = 0x3c6ef372fe94f82bULL; - H[3] = 0xa54ff53a5f1d36f1ULL; - H[4] = 0x510e527fade682d1ULL; - H[5] = 0x9b05688c2b3e6c1fULL; - H[6] = 0x1f83d9abfb41bd6bULL; - H[7] = 0x5be0cd19137e2179ULL; + H[0] = 0x6a09e667f3bcc908LL; + H[1] = 0xbb67ae8584caa73bLL; + H[2] = 0x3c6ef372fe94f82bLL; + H[3] = 0xa54ff53a5f1d36f1LL; + H[4] = 0x510e527fade682d1LL; + H[5] = 0x9b05688c2b3e6c1fLL; + H[6] = 0x1f83d9abfb41bd6bLL; + H[7] = 0x5be0cd19137e2179LL; blkLen = 0; for (i = 0; i + 128 <= msgLen; i += 128) { @@ -1554,14 +1558,14 @@ static void sha384(Guchar *msg, int msgLen, Guchar *hash) { SHA512Uint64 H[8]; int blkLen, i; - H[0] = 0xcbbb9d5dc1059ed8ULL; - H[1] = 0x629a292a367cd507ULL; - H[2] = 0x9159015a3070dd17ULL; - H[3] = 0x152fecd8f70e5939ULL; - H[4] = 0x67332667ffc00b31ULL; - H[5] = 0x8eb44a8768581511ULL; - H[6] = 0xdb0c2e0d64f98fa7ULL; - H[7] = 0x47b5481dbefa4fa4ULL; + H[0] = 0xcbbb9d5dc1059ed8LL; + H[1] = 0x629a292a367cd507LL; + H[2] = 0x9159015a3070dd17LL; + H[3] = 0x152fecd8f70e5939LL; + H[4] = 0x67332667ffc00b31LL; + H[5] = 0x8eb44a8768581511LL; + H[6] = 0xdb0c2e0d64f98fa7LL; + H[7] = 0x47b5481dbefa4fa4LL; blkLen = 0; for (i = 0; i + 128 <= msgLen; i += 128) { diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.h index d0f38409109..2b10abd050b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "GString.h" #include "Object.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.cc index 71ea377f8a7..c8c29736fe9 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stddef.h> #include <string.h> #include "gmem.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.h index 804fcdf1312..b05f729e0a8 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #if MULTITHREADED #include "GMutex.h" #endif diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/DisplayState.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/DisplayState.cc index f1e8dcffeac..e0d306857ca 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/DisplayState.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/DisplayState.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include "gmempp.h" #include "GString.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/DisplayState.h b/Build/source/libs/xpdf/xpdf-src/xpdf/DisplayState.h index a078c757d33..12c8170f0b3 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/DisplayState.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/DisplayState.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "SplashTypes.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Error.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Error.cc index 111f277d3c2..aec27dc5099 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Error.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Error.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stddef.h> #include <stdarg.h> diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Error.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Error.h index 574330f6446..39e7613e4e6 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Error.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Error.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include <stdio.h> #include "config.h" #include "gfile.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Function.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Function.cc index 966a3155c50..82f32b9dd93 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Function.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Function.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <string.h> #include <ctype.h> diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Function.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Function.h index 73c92abe30c..bf1f25e51cc 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Function.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Function.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "Object.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc index ea7951a75fc..1539b8404bc 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <stdio.h> #include <stddef.h> @@ -532,7 +536,6 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, out = outA; state = new GfxState(hDPI, vDPI, box, rotate, out->upsideDown()); fontChanged = gFalse; - haveSavedClipPath = gFalse; clip = clipNone; ignoreUndef = 0; out->startPage(pageNum, state); @@ -581,7 +584,6 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, out = outA; state = new GfxState(72, 72, box, 0, gFalse); fontChanged = gFalse; - haveSavedClipPath = gFalse; clip = clipNone; ignoreUndef = 0; for (i = 0; i < 6; ++i) { @@ -1827,20 +1829,15 @@ void Gfx::opFillStroke(Object args[], int numArgs) { } if (state->isPath()) { if (ocState) { - if (state->getFillColorSpace()->getMode() == csPattern || - state->getStrokeColorSpace()->getMode() == csPattern) { - if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gFalse); - } else { - out->fill(state); - } - if (state->getStrokeColorSpace()->getMode() == csPattern) { - doPatternStroke(); - } else { - out->stroke(state); - } + if (state->getFillColorSpace()->getMode() == csPattern) { + doPatternFill(gFalse); + } else { + out->fill(state); + } + if (state->getStrokeColorSpace()->getMode() == csPattern) { + doPatternStroke(); } else { - out->fillStroke(state, gFalse); + out->stroke(state); } } } @@ -1855,20 +1852,15 @@ void Gfx::opCloseFillStroke(Object args[], int numArgs) { if (state->isPath()) { state->closePath(); if (ocState) { - if (state->getFillColorSpace()->getMode() == csPattern || - state->getStrokeColorSpace()->getMode() == csPattern) { - if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gFalse); - } else { - out->fill(state); - } - if (state->getStrokeColorSpace()->getMode() == csPattern) { - doPatternStroke(); - } else { - out->stroke(state); - } + if (state->getFillColorSpace()->getMode() == csPattern) { + doPatternFill(gFalse); } else { - out->fillStroke(state, gFalse); + out->fill(state); + } + if (state->getStrokeColorSpace()->getMode() == csPattern) { + doPatternStroke(); + } else { + out->stroke(state); } } } @@ -1882,20 +1874,15 @@ void Gfx::opEOFillStroke(Object args[], int numArgs) { } if (state->isPath()) { if (ocState) { - if (state->getFillColorSpace()->getMode() == csPattern || - state->getStrokeColorSpace()->getMode() == csPattern) { - if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gTrue); - } else { - out->eoFill(state); - } - if (state->getStrokeColorSpace()->getMode() == csPattern) { - doPatternStroke(); - } else { - out->stroke(state); - } + if (state->getFillColorSpace()->getMode() == csPattern) { + doPatternFill(gTrue); + } else { + out->eoFill(state); + } + if (state->getStrokeColorSpace()->getMode() == csPattern) { + doPatternStroke(); } else { - out->fillStroke(state, gTrue); + out->stroke(state); } } } @@ -1910,20 +1897,15 @@ void Gfx::opCloseEOFillStroke(Object args[], int numArgs) { if (state->isPath()) { state->closePath(); if (ocState) { - if (state->getFillColorSpace()->getMode() == csPattern || - state->getStrokeColorSpace()->getMode() == csPattern) { - if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gTrue); - } else { - out->eoFill(state); - } - if (state->getStrokeColorSpace()->getMode() == csPattern) { - doPatternStroke(); - } else { - out->stroke(state); - } + if (state->getFillColorSpace()->getMode() == csPattern) { + doPatternFill(gTrue); } else { - out->fillStroke(state, gTrue); + out->eoFill(state); + } + if (state->getStrokeColorSpace()->getMode() == csPattern) { + doPatternStroke(); + } else { + out->stroke(state); } } } @@ -1984,7 +1966,7 @@ void Gfx::doPatternStroke() { } } -void Gfx::doPatternText(GBool stroke) { +void Gfx::doPatternText() { GfxPattern *pattern; // this is a bit of a kludge -- patterns can be really slow, so we @@ -1994,8 +1976,7 @@ void Gfx::doPatternText(GBool stroke) { return; } - pattern = stroke ? state->getStrokePattern() : state->getFillPattern(); - if (!pattern) { + if (!(pattern = state->getFillPattern())) { return; } switch (pattern->getType()) { @@ -2212,30 +2193,16 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat, if (bbox[1] > bbox[3]) { t = bbox[1]; bbox[1] = bbox[3]; bbox[3] = t; } - xstep = tPat->getXStep(); - ystep = tPat->getYStep(); - if (xstep == 0 || ystep == 0) { - error(errSyntaxError, getPos(), "Zero x or y step in tiling pattern fill"); - goto err; - } - if (xstep > 0) { - xi0 = (int)ceil((xMin - bbox[2]) / xstep); - xi1 = (int)floor((xMax - bbox[0]) / xstep) + 1; - } else { - xi0 = (int)ceil((xMax - bbox[0]) / xstep); - xi1 = (int)floor((xMin - bbox[2]) / xstep) + 1; - } - if (ystep > 0) { - yi0 = (int)ceil((yMin - bbox[3]) / ystep); - yi1 = (int)floor((yMax - bbox[1]) / ystep) + 1; - } else { - yi0 = (int)ceil((yMax - bbox[1]) / ystep); - yi1 = (int)floor((yMin - bbox[3]) / ystep) + 1; - } + xstep = fabs(tPat->getXStep()); + ystep = fabs(tPat->getYStep()); + xi0 = (int)ceil((xMin - bbox[2]) / xstep); + xi1 = (int)floor((xMax - bbox[0]) / xstep) + 1; + yi0 = (int)ceil((yMin - bbox[3]) / ystep); + yi1 = (int)floor((yMax - bbox[1]) / ystep) + 1; for (i = 0; i < 4; ++i) { m1[i] = m[i]; } - if (out->useTilingPatternFill() && !tPat->usesBlendMode(xref)) { + if (out->useTilingPatternFill()) { m1[4] = m[4]; m1[5] = m[5]; out->tilingPatternFill(state, this, tPat->getContentStreamRef(), @@ -3554,16 +3521,12 @@ void Gfx::fillPatch(GfxPatch *patch, GfxPatchMeshShading *shading, int depth) { } void Gfx::doEndPath() { - if (clip != clipNone) { - if (state->isCurPt()) { - state->clip(); - if (clip == clipNormal) { - out->clip(state); - } else { - out->eoClip(state); - } + if (state->isCurPt() && clip != clipNone) { + state->clip(); + if (clip == clipNormal) { + out->clip(state); } else { - error(errSyntaxError, getPos(), "Empty path in clip"); + out->eoClip(state); } } clip = clipNone; @@ -3592,15 +3555,9 @@ void Gfx::opBeginText(Object args[], int numArgs) { out->updateTextMat(state); out->updateTextPos(state); fontChanged = gTrue; - haveSavedClipPath = gFalse; } void Gfx::opEndText(Object args[], int numArgs) { - if (haveSavedClipPath) { - out->clipToSavedClipPath(state); - haveSavedClipPath = gFalse; - } - out->endTextObject(state); } @@ -3829,8 +3786,27 @@ void Gfx::opShowSpaceText(Object args[], int numArgs) { } void Gfx::doShowText(GString *s) { - GfxFont *font = state->getFont(); - int wMode = font->getWMode(); + GfxFont *font; + int wMode; + double riseX, riseY; + CharCode code; + Unicode u[8]; + double x, y, dx, dy, dx2, dy2, curX, curY, tdx, tdy, ddx, ddy; + double originX, originY, tOriginX, tOriginY; + double x0, y0, x1, y1; + double oldCTM[6], newCTM[6]; + double *mat; + Object charProcRef, charProc; + Dict *resDict; + Parser *oldParser; + GfxState *savedState; + char *p; + int render; + GBool patternFill; + int len, n, uLen, nChars, nSpaces, i; + + font = state->getFont(); + wMode = font->getWMode(); if (globalParams->isDroppedFont(font->getName() ? font->getName()->getCString() : "")) { @@ -3842,63 +3818,35 @@ void Gfx::doShowText(GString *s) { out->beginString(state, s); } - // figure out the drawing mode - // note: clipping, pattern fill, and pattern stroke are all handled - // by saving the path and then performing the appropriate - // actions in opEndText() - GBool doFill = gFalse; - GBool doStroke = gFalse; - GBool doMakePath = gFalse; - int render = state->getRender() & 7; - switch (render & 7) { - case 0: // fill - if (state->getFillColorSpace()->getMode() == csPattern) { - doMakePath = gTrue; - } else { - doFill = gTrue; - } - break; - case 1: // stroke - if (state->getStrokeColorSpace()->getMode() == csPattern) { - doMakePath = gTrue; + // if we're doing a pattern fill, set up clipping + render = state->getRender(); + if (!(render & 1) && + state->getFillColorSpace()->getMode() == csPattern) { + patternFill = gTrue; + saveState(); + // disable fill, enable clipping, leave stroke unchanged + if ((render ^ (render >> 1)) & 1) { + render = 5; } else { - doStroke = gTrue; + render = 7; } - break; - case 2: // fill + stroke - if (state->getFillColorSpace()->getMode() == csPattern || - state->getStrokeColorSpace()->getMode() == csPattern) { - doMakePath = gTrue; - } else { - doFill = gTrue; - doStroke = gTrue; - } - break; - case 3: // invisible - // nothing - break; - case 4: // fill + clip - case 5: // stroke + clip - case 6: // fill + stroke + clip - case 7: // clip - doMakePath = gTrue; - break; + state->setRender(render); + out->updateRender(state); + } else { + patternFill = gFalse; } - double riseX, riseY; state->textTransformDelta(0, state->getRise(), &riseX, &riseY); - double xMin = state->getCurX() + riseX; - double yMin = state->getCurY() + riseY; + x0 = state->getCurX() + riseX; + y0 = state->getCurY() + riseY; // handle a Type 3 char if (font->getType() == fontType3 && out->interpretType3Chars()) { - double *mat = state->getCTM(); - double oldCTM[6]; - for (int i = 0; i < 6; ++i) { + mat = state->getCTM(); + for (i = 0; i < 6; ++i) { oldCTM[i] = mat[i]; } mat = state->getTextMat(); - double newCTM[6]; newCTM[0] = mat[0] * oldCTM[0] + mat[1] * oldCTM[2]; newCTM[1] = mat[0] * oldCTM[1] + mat[1] * oldCTM[3]; newCTM[2] = mat[2] * oldCTM[0] + mat[3] * oldCTM[2]; @@ -3914,29 +3862,24 @@ void Gfx::doShowText(GString *s) { newCTM[3] *= state->getFontSize(); newCTM[0] *= state->getHorizScaling(); newCTM[1] *= state->getHorizScaling(); - double curX = state->getCurX(); - double curY = state->getCurY(); - Parser *oldParser = parser; - char *p = s->getCString(); - int len = s->getLength(); + curX = state->getCurX(); + curY = state->getCurY(); + oldParser = parser; + p = s->getCString(); + len = s->getLength(); while (len > 0) { - CharCode code; - Unicode u[8]; - int uLen; - double dx, dy, originX, originY; - int n = font->getNextChar(p, len, &code, - u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, - &dx, &dy, &originX, &originY); + n = font->getNextChar(p, len, &code, + u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, + &dx, &dy, &originX, &originY); dx = dx * state->getFontSize() + state->getCharSpace(); if (n == 1 && *p == ' ') { dx += state->getWordSpace(); } dx *= state->getHorizScaling(); dy *= state->getFontSize(); - double tdx, tdy, ddx, ddy, x, y; state->textTransformDelta(dx, dy, &tdx, &tdy); state->transform(curX + riseX, curY + riseY, &x, &y); - GfxState *savedState = saveStateStack(); + savedState = saveStateStack(); state->setCTM(newCTM[0], newCTM[1], newCTM[2], newCTM[3], x, y); //~ the CTM concat values here are wrong (but never used) out->updateCTM(state, 1, 0, 0, 1, 0, 0); @@ -3956,11 +3899,9 @@ void Gfx::doShowText(GString *s) { #endif if (!out->beginType3Char(state, curX + riseX, curY + riseY, ddx, ddy, code, u, uLen)) { - Object charProcRef, charProc; ((Gfx8BitFont *)font)->getCharProcNF(code, &charProcRef); charProcRef.fetch(xref, &charProc); - Dict *resDict = ((Gfx8BitFont *)font)->getResources(); - if (resDict) { + if ((resDict = ((Gfx8BitFont *)font)->getResources())) { pushResources(resDict); } if (charProc.isStream()) { @@ -3986,16 +3927,12 @@ void Gfx::doShowText(GString *s) { parser = oldParser; } else if (out->useDrawChar()) { - char *p = s->getCString(); - int len = s->getLength(); + p = s->getCString(); + len = s->getLength(); while (len > 0) { - CharCode code; - Unicode u[8]; - int uLen; - double dx, dy, originX, originY; - int n = font->getNextChar(p, len, &code, - u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, - &dx, &dy, &originX, &originY); + n = font->getNextChar(p, len, &code, + u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, + &dx, &dy, &originX, &originY); if (wMode) { dx *= state->getFontSize(); dy = dy * state->getFontSize() + state->getCharSpace(); @@ -4010,32 +3947,26 @@ void Gfx::doShowText(GString *s) { dx *= state->getHorizScaling(); dy *= state->getFontSize(); } - double tdx, tdy, tOriginX, tOriginY; state->textTransformDelta(dx, dy, &tdx, &tdy); originX *= state->getFontSize(); originY *= state->getFontSize(); state->textTransformDelta(originX, originY, &tOriginX, &tOriginY); out->drawChar(state, state->getCurX() + riseX, state->getCurY() + riseY, - tdx, tdy, tOriginX, tOriginY, code, n, u, uLen, - doFill, doStroke, doMakePath); + tdx, tdy, tOriginX, tOriginY, code, n, u, uLen); state->shift(tdx, tdy); p += n; len -= n; } } else { - double dx = 0, dy = 0; - char *p = s->getCString(); - int len = s->getLength(); - int nChars = 0, nSpaces = 0; + dx = dy = 0; + p = s->getCString(); + len = s->getLength(); + nChars = nSpaces = 0; while (len > 0) { - CharCode code; - Unicode u[8]; - int uLen; - double dx2, dy2, originX, originY; - int n = font->getNextChar(p, len, &code, - u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, - &dx2, &dy2, &originX, &originY); + n = font->getNextChar(p, len, &code, + u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, + &dx2, &dy2, &originX, &originY); dx += dx2; dy += dy2; if (n == 1 && *p == ' ') { @@ -4057,9 +3988,8 @@ void Gfx::doShowText(GString *s) { dx *= state->getHorizScaling(); dy *= state->getFontSize(); } - double tdx, tdy; state->textTransformDelta(dx, dy, &tdx, &tdy); - out->drawString(state, s, doFill, doStroke, doMakePath); + out->drawString(state, s); state->shift(tdx, tdy); } @@ -4067,70 +3997,40 @@ void Gfx::doShowText(GString *s) { out->endString(state); } - if (doMakePath) { - // compute the clipping bbox for the saved text path -- assume + if (patternFill) { + out->saveTextPos(state); + // tell the OutputDev to do the clipping + out->endTextObject(state); + // set up a clipping bbox so doPatternText will work -- assume // that the text bounding box does not extend past the baseline in // any direction by more than twice the font size - double xMax = state->getCurX() + riseX; - double yMax = state->getCurY() + riseY; - double t; - if (xMin > xMax) { - t = xMin; xMin = xMax; xMax = t; + x1 = state->getCurX() + riseX; + y1 = state->getCurY() + riseY; + if (x0 > x1) { + x = x0; x0 = x1; x1 = x; } - if (yMin > yMax) { - t = yMin; yMin = yMax; yMax = t; + if (y0 > y1) { + y = y0; y0 = y1; y1 = y; } - double dx1, dy1, dx2, dy2; - state->textTransformDelta(0, state->getFontSize(), &dx1, &dy1); + state->textTransformDelta(0, state->getFontSize(), &dx, &dy); state->textTransformDelta(state->getFontSize(), 0, &dx2, &dy2); - dx1 = fabs(dx1); + dx = fabs(dx); dx2 = fabs(dx2); - if (dx2 > dx1) { - dx1 = dx2; + if (dx2 > dx) { + dx = dx2; } - dy1 = fabs(dy1); + dy = fabs(dy); dy2 = fabs(dy2); - if (dy2 > dy1) { - dy1 = dy2; - } - xMin -= 2 * dx1; - yMin -= 2 * dy1; - xMax += 2 * dx1; - yMax += 2 * dy1; - - //--- fill - if ((render & 3) == 0 || (render & 3) == 2) { - if (state->getFillColorSpace()->getMode() == csPattern) { - saveState(); - state->clipToRect(xMin, yMin, xMax, yMax); - out->clipToTextPath(state); - doPatternText(gFalse); - restoreState(); - } else { - out->fillTextPath(state); - } - } - - //--- stroke - if ((render & 3) == 1 || (render & 3) == 2) { - if (state->getStrokeColorSpace()->getMode() == csPattern) { - saveState(); - state->clipToRect(xMin, yMin, xMax, yMax); - out->clipToTextStrokePath(state); - doPatternText(gTrue); - restoreState(); - } else { - out->strokeTextPath(state); - } - } - - //--- clip - if (render & 4) { - out->addTextPathToSavedClipPath(state); - haveSavedClipPath = gTrue; - } else { - out->clearTextPath(state); - } + if (dy2 > dy) { + dy = dy2; + } + state->clipToRect(x0 - 2 * dx, y0 - 2 * dy, x1 + 2 * dx, y1 + 2 * dy); + // set render mode to fill-only + state->setRender(0); + out->updateRender(state); + doPatternText(); + restoreState(); + out->restoreTextPos(state); } opCounter += 10 * s->getLength(); @@ -4216,7 +4116,6 @@ void Gfx::opXObject(Object args[], int numArgs) { xObj.streamGetDict()->lookup("Level1", &obj3); out->psXObject(xObj.getStream(), obj3.isStream() ? obj3.getStream() : (Stream *)NULL); - obj3.free(); } } else if (obj2.isName()) { error(errSyntaxError, getPos(), @@ -4292,14 +4191,10 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { obj1.free(); dict->lookup("W", &obj1); } - if (obj1.isInt()) { - width = obj1.getInt(); - } else if (obj1.isReal()) { - error(errSyntaxWarning, getPos(), "Non-integer image width"); - width = (int)obj1.getReal(); - } else { + if (!obj1.isInt()) { goto err2; } + width = obj1.getInt(); obj1.free(); if (width <= 0) { goto err1; @@ -4309,14 +4204,10 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { obj1.free(); dict->lookup("H", &obj1); } - if (obj1.isInt()) { - height = obj1.getInt(); - } else if (obj1.isReal()) { - error(errSyntaxWarning, getPos(), "Non-integer image height"); - height = (int)obj1.getReal(); - } else { + if (!obj1.isInt()) { goto err2; } + height = obj1.getInt(); obj1.free(); if (height <= 0) { goto err1; @@ -4342,14 +4233,8 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { obj1.free(); dict->lookup("BPC", &obj1); } - if (obj1.isNum()) { - if (obj1.isInt()) { - bits = obj1.getInt(); - } else if (obj1.isReal()) { - error(errSyntaxWarning, getPos(), - "Non-integer image bits per component"); - bits = (int)obj1.getReal(); - } + if (obj1.isInt()) { + bits = obj1.getInt(); if (bits < 1 || bits > 16) { goto err2; } @@ -4492,34 +4377,26 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { obj1.free(); maskDict->lookup("W", &obj1); } - if (obj1.isInt()) { - maskWidth = obj1.getInt(); - } else if (obj1.isReal()) { - error(errSyntaxWarning, getPos(), "Non-integer image mask width"); - maskWidth = (int)obj1.getReal(); - } else { + if (!obj1.isInt()) { delete colorMap; maskObj.free(); smaskObj.free(); goto err2; } + maskWidth = obj1.getInt(); obj1.free(); maskDict->lookup("Height", &obj1); if (obj1.isNull()) { obj1.free(); maskDict->lookup("H", &obj1); } - if (obj1.isInt()) { - maskHeight = obj1.getInt(); - } else if (obj1.isReal()) { - error(errSyntaxWarning, getPos(), "Non-integer image mask height"); - maskHeight = (int)obj1.getReal(); - } else { + if (!obj1.isInt()) { delete colorMap; maskObj.free(); smaskObj.free(); goto err2; } + maskHeight = obj1.getInt(); obj1.free(); if (maskWidth <= 0 || maskHeight <= 0) { delete colorMap; @@ -4532,18 +4409,13 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { obj1.free(); maskDict->lookup("BPC", &obj1); } - if (obj1.isInt()) { - maskBits = obj1.getInt(); - } else if (obj1.isReal()) { - error(errSyntaxWarning, getPos(), - "Non-integer image mask bits per component"); - maskBits = (int)obj1.getReal(); - } else { + if (!obj1.isInt()) { delete colorMap; maskObj.free(); smaskObj.free(); goto err2; } + maskBits = obj1.getInt(); obj1.free(); if (maskBits < 1 || maskBits > 16) { delete colorMap; @@ -4640,7 +4512,6 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } } else if (maskObj.isStream()) { // explicit mask - haveExplicitMask = gTrue; if (inlineImg) { delete colorMap; maskObj.free(); @@ -4655,31 +4526,32 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { obj1.free(); maskDict->lookup("W", &obj1); } - if (obj1.isInt()) { - maskWidth = obj1.getInt(); - } else if (obj1.isReal()) { - error(errSyntaxWarning, getPos(), "Non-integer image mask width"); - maskWidth = (int)obj1.getReal(); - } else { - haveExplicitMask = gFalse; + if (!obj1.isInt()) { + delete colorMap; + maskObj.free(); + smaskObj.free(); + goto err2; } + maskWidth = obj1.getInt(); obj1.free(); maskDict->lookup("Height", &obj1); if (obj1.isNull()) { obj1.free(); maskDict->lookup("H", &obj1); } - if (obj1.isInt()) { - maskHeight = obj1.getInt(); - } else if (obj1.isReal()) { - error(errSyntaxWarning, getPos(), "Non-integer image mask height"); - maskHeight = (int)obj1.getReal(); - } else { - haveExplicitMask = gFalse; + if (!obj1.isInt()) { + delete colorMap; + maskObj.free(); + smaskObj.free(); + goto err2; } + maskHeight = obj1.getInt(); obj1.free(); if (maskWidth <= 0 || maskHeight <= 0) { - haveExplicitMask = gFalse; + delete colorMap; + maskObj.free(); + smaskObj.free(); + goto err2; } maskDict->lookup("ImageMask", &obj1); if (obj1.isNull()) { @@ -4687,7 +4559,10 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { maskDict->lookup("IM", &obj1); } if (!obj1.isBool() || !obj1.getBool()) { - haveExplicitMask = gFalse; + delete colorMap; + maskObj.free(); + smaskObj.free(); + goto err2; } obj1.free(); maskInvert = gFalse; @@ -4701,12 +4576,13 @@ GBool Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { maskInvert = obj2.isNum() && obj2.getNum() == 1; obj2.free(); } else if (!obj1.isNull()) { - haveExplicitMask = gFalse; + delete colorMap; + maskObj.free(); + smaskObj.free(); + goto err2; } obj1.free(); - if (!haveExplicitMask) { - error(errSyntaxError, getPos(), "Bad image parameters"); - } + haveExplicitMask = gTrue; } // if drawing is disabled, skip over inline image data @@ -4892,8 +4768,6 @@ void Gfx::drawForm(Object *strRef, Dict *resDict, double oldBaseMatrix[6]; int i; - out->startStream(strRef->getRef(), state); - // push new resources on stack pushResources(resDict); @@ -5023,7 +4897,7 @@ void Gfx::drawForm(Object *strRef, Dict *resDict, delete blendingColorSpace; } - out->endStream(strRef->getRef()); + return; } void Gfx::takeContentStreamStack(Gfx *oldGfx) { @@ -5062,9 +4936,7 @@ void Gfx::opBeginImage(Object args[], int numArgs) { // if we have the stream length, skip to end-of-stream and then // skip 'EI' in the original stream } else if (haveLength) { - // NB: getUndecodedStream() returns the EmbedStream created by - // buildImageStream() - while ((c1 = str->getUndecodedStream()->getChar()) != EOF) ; + while ((c1 = str->getChar()) != EOF) ; delete str; str = parser->getStream(); c1 = str->getChar(); @@ -5219,28 +5091,15 @@ void Gfx::opBeginMarkedContent(Object args[], int numArgs) { } obj.free(); mcKind = gfxMCOptionalContent; - } else if (numArgs == 2 && args[1].isDict()) { - if (args[0].isName("Span")) { - if (args[1].dictLookup("ActualText", &obj)->isString()) { - s = new TextString(obj.getString()); - out->beginActualText(state, s->getUnicode(), s->getLength()); - delete s; - mcKind = gfxMCActualText; - } - obj.free(); - } - if (args[1].dictLookup("MCID", &obj)->isInt()) { - out->beginStructureItem(args[0].getName(), obj.getInt(), - args[1].getDict()); - if (mcKind == gfxMCActualText) { - mcKind = gfxMCStructureItemAndActualText; - } else { - mcKind = gfxMCStructureItem; - } + } else if (args[0].isName("Span") && numArgs == 2 && args[1].isDict()) { + if (args[1].dictLookup("ActualText", &obj)->isString()) { + s = new TextString(obj.getString()); + out->beginActualText(state, s->getUnicode(), s->getLength()); + delete s; + mcKind = gfxMCActualText; } obj.free(); } - mc = new GfxMarkedContent(mcKind, ocState); markedContentStack->append(mc); } @@ -5264,11 +5123,6 @@ void Gfx::opEndMarkedContent(Object args[], int numArgs) { } } else if (mcKind == gfxMCActualText) { out->endActualText(state); - } else if (mcKind == gfxMCStructureItem) { - out->endStructureItem(); - } else if (mcKind == gfxMCStructureItemAndActualText) { - out->endStructureItem(); - out->endActualText(state); } } else { error(errSyntaxWarning, getPos(), "Mismatched EMC operator"); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h index 0f288cf3b9d..14d7a608438 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "gfile.h" #include "GfxState.h" @@ -102,8 +106,6 @@ private: enum GfxMarkedContentKind { gfxMCOptionalContent, gfxMCActualText, - gfxMCStructureItem, - gfxMCStructureItemAndActualText, gfxMCOther }; @@ -192,7 +194,6 @@ private: GfxState *state; // current graphics state GBool fontChanged; // set if font or text matrix has changed - GBool haveSavedClipPath; GfxClipType clip; // do a clip? int ignoreUndef; // current BX/EX nesting level double baseMatrix[6]; // default matrix for most recent @@ -272,7 +273,7 @@ private: void opCloseEOFillStroke(Object args[], int numArgs); void doPatternFill(GBool eoFill); void doPatternStroke(); - void doPatternText(GBool stroke); + void doPatternText(); void doPatternImageMask(Object *ref, Stream *str, int width, int height, GBool invert, GBool inlineImg, GBool interpolate); void doTilingPatternFill(GfxTilingPattern *tPat, diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc index c3db4e8651b..30e8bd1c79c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -303,10 +307,26 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { obj2.initNull(); } - // NB: the PDF spec doesn't say anything about precedence, but Adobe - // uses FontFile3 over FontFile2 if both are present. if (fontDict2->lookup("FontDescriptor", &fontDesc)->isDict()) { - if (fontDesc.dictLookupNF("FontFile3", &obj3)->isRef()) { + if (fontDesc.dictLookupNF("FontFile", &obj3)->isRef()) { + *embID = obj3.getRef(); + if (expectedType != fontType1) { + err = gTrue; + } + } + obj3.free(); + if (embID->num == -1 && + fontDesc.dictLookupNF("FontFile2", &obj3)->isRef()) { + *embID = obj3.getRef(); + if (isType0) { + expectedType = fontCIDType2; + } else if (expectedType != fontTrueType) { + err = gTrue; + } + } + obj3.free(); + if (embID->num == -1 && + fontDesc.dictLookupNF("FontFile3", &obj3)->isRef()) { *embID = obj3.getRef(); if (obj3.fetch(xref, &obj4)->isStream()) { obj4.streamGetDict()->lookup("Subtype", &subtype); @@ -355,26 +375,6 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { obj4.free(); } obj3.free(); - if (embID->num == -1) { - if (fontDesc.dictLookupNF("FontFile2", &obj3)->isRef()) { - *embID = obj3.getRef(); - if (isType0) { - expectedType = fontCIDType2; - } else if (expectedType != fontTrueType) { - err = gTrue; - } - } - obj3.free(); - } - if (embID->num == -1) { - if (fontDesc.dictLookupNF("FontFile", &obj3)->isRef()) { - *embID = obj3.getRef(); - if (expectedType != fontType1) { - err = gTrue; - } - } - obj3.free(); - } } fontDesc.free(); @@ -533,33 +533,6 @@ void GfxFont::readFontDescriptor(XRef *xref, Dict *fontDict) { } obj1.free(); - - // scan font name for bold/italic tags and update the flags - if (name) { - i = name->getLength(); - if (i > 2 && !strncmp(name->getCString() + i - 2, "MT", 2)) { - i -= 2; - } - if (i > 6 && !strncmp(name->getCString() + i - 6, "Italic", 6)) { - flags |= fontItalic; - i -= 6; - } else if (i > 2 && !strncmp(name->getCString() + i - 2, "It", 2)) { - flags |= fontItalic; - i -= 2; - } else if (i > 7 && !strncmp(name->getCString() + i - 7, "Oblique", 7)) { - flags |= fontItalic; - i -= 7; - } - char c = name->getChar(i-1); - if (!((c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z') || - (c >= '0' && c <= '9'))) { - --i; - } - if (i > 4 && !strncmp(name->getCString() + i - 4, "Bold", 4)) { - flags |= fontBold; - } - } } CharCodeToUnicode *GfxFont::readToUnicodeCMap(Dict *fontDict, int nBits, @@ -1463,7 +1436,7 @@ CharCodeToUnicode *Gfx8BitFont::getToUnicode() { int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) { int *map; int cmapPlatform, cmapEncoding; - int unicodeCmap, macRomanCmap, macUnicodeCmap, msSymbolCmap, cmap; + int unicodeCmap, macRomanCmap, msSymbolCmap, cmap; GBool nonsymbolic, useMacRoman, useUnicode; char *charName; Unicode u; @@ -1477,16 +1450,15 @@ int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) { // This is based on the cmap/encoding selection algorithm in the PDF // 2.0 spec, but with some differences to match up with Adobe's // behavior. - unicodeCmap = macRomanCmap = macUnicodeCmap = msSymbolCmap = -1; + unicodeCmap = macRomanCmap = msSymbolCmap = -1; for (i = 0; i < ff->getNumCmaps(); ++i) { cmapPlatform = ff->getCmapPlatform(i); cmapEncoding = ff->getCmapEncoding(i); - if (cmapPlatform == 3 && cmapEncoding == 1) { + if ((cmapPlatform == 3 && cmapEncoding == 1) || + (cmapPlatform == 0 && cmapEncoding <= 4)) { unicodeCmap = i; } else if (cmapPlatform == 1 && cmapEncoding == 0) { macRomanCmap = i; - } else if (cmapPlatform == 0 && cmapEncoding <= 4) { - macUnicodeCmap = i; } else if (cmapPlatform == 3 && cmapEncoding == 0) { msSymbolCmap = i; } @@ -1494,25 +1466,24 @@ int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) { useMacRoman = gFalse; useUnicode = gFalse; nonsymbolic = !(flags & fontSymbolic); - if (embFontID.num < 0 && hasEncoding && unicodeCmap >= 0) { + if (usesMacRomanEnc && macRomanCmap >= 0) { + cmap = macRomanCmap; + useMacRoman = gTrue; + } else if (embFontID.num < 0 && hasEncoding && unicodeCmap >= 0) { cmap = unicodeCmap; useUnicode = gTrue; - } else if (!nonsymbolic && msSymbolCmap >= 0) { - cmap = msSymbolCmap; - } else if (unicodeCmap >= 0) { + } else if (nonsymbolic && unicodeCmap >= 0) { cmap = unicodeCmap; - useUnicode = nonsymbolic; - } else if (usesMacRomanEnc && macRomanCmap >= 0) { - // MacRoman cmap has higher precedence than Mac Unicode only if - // the font uses the MacRoman encoding + useUnicode = gTrue; + } else if (nonsymbolic && macRomanCmap >= 0) { cmap = macRomanCmap; useMacRoman = gTrue; - } else if (macUnicodeCmap >= 0) { - cmap = macUnicodeCmap; - useUnicode = nonsymbolic; + } else if (msSymbolCmap >= 0) { + cmap = msSymbolCmap; + } else if (unicodeCmap >= 0) { + cmap = unicodeCmap; } else if (macRomanCmap >= 0) { cmap = macRomanCmap; - useMacRoman = nonsymbolic; } else { cmap = 0; } @@ -2258,99 +2229,75 @@ GBool GfxCIDFont::problematicForUnicode() { // GfxFontDict //------------------------------------------------------------------------ -class GfxFontDictEntry { -public: - - GfxFontDictEntry(Ref refA, Object *fontObjA); - ~GfxFontDictEntry(); - void load(GfxFont *fontA); - - GBool loaded; - Ref ref; - Object fontObj; // valid if unloaded - GfxFont *font; // valid if loaded -}; - -GfxFontDictEntry::GfxFontDictEntry(Ref refA, Object *fontObjA) { - loaded = gFalse; - ref = refA; - fontObjA->copy(&fontObj); - font = NULL; -} - -GfxFontDictEntry::~GfxFontDictEntry() { - // NB: If the font has been loaded, font is non-NULL and is owned by - // GfxFontDict.uniqueFonts. - if (!loaded) { - fontObj.free(); - } -} - -void GfxFontDictEntry::load(GfxFont *fontA) { - loaded = gTrue; - font = fontA; - fontObj.free(); -} +GfxFontDict::GfxFontDict(XRef *xref, Ref *fontDictRef, Dict *fontDict) { + GfxFont *font; + char *tag; + Object obj1, obj2; + Ref r; + int i; -GfxFontDict::GfxFontDict(XRef *xrefA, Ref *fontDictRef, Dict *fontDict) { - xref = xrefA; fonts = new GHash(gTrue); uniqueFonts = new GList(); - - for (int i = 0; i < fontDict->getLength(); ++i) { - char *tag = fontDict->getKey(i); - Object fontObj; - fontDict->getValNF(i, &fontObj); - Ref r; - if (fontObj.isRef()) { - r = fontObj.getRef(); - } else if (fontDictRef) { - // legal generation numbers are five digits, so we use a - // 6-digit number here - r.gen = 100000 + fontDictRef->num; - r.num = i; + for (i = 0; i < fontDict->getLength(); ++i) { + tag = fontDict->getKey(i); + fontDict->getValNF(i, &obj1); + obj1.fetch(xref, &obj2); + if (!obj2.isDict()) { + error(errSyntaxError, -1, "font resource is not a dictionary"); + } else if (obj1.isRef() && (font = lookupByRef(obj1.getRef()))) { + fonts->add(new GString(tag), font); } else { - // no indirect reference for this font, or for the containing - // font dict, so hash the font and use that - r.gen = 100000; - r.num = hashFontObject(&fontObj); + if (obj1.isRef()) { + r = obj1.getRef(); + } else if (fontDictRef) { + // legal generation numbers are five digits, so we use a + // 6-digit number here + r.gen = 100000 + fontDictRef->num; + r.num = i; + } else { + // no indirect reference for this font, or for the containing + // font dict, so hash the font and use that + r.gen = 100000; + r.num = hashFontObject(&obj2); + } + if ((font = GfxFont::makeFont(xref, tag, r, obj2.getDict()))) { + if (!font->isOk()) { + delete font; + } else { + uniqueFonts->append(font); + fonts->add(new GString(tag), font); + } + } } - fonts->add(new GString(tag), new GfxFontDictEntry(r, &fontObj)); - fontObj.free(); + obj1.free(); + obj2.free(); } } GfxFontDict::~GfxFontDict() { deleteGList(uniqueFonts, GfxFont); - deleteGHash(fonts, GfxFontDictEntry); + delete fonts; } GfxFont *GfxFontDict::lookup(char *tag) { - GfxFontDictEntry *entry = (GfxFontDictEntry *)fonts->lookup(tag); - if (!entry) { - return NULL; - } - load(tag, entry); - return entry->font; + return (GfxFont *)fonts->lookup(tag); } GfxFont *GfxFontDict::lookupByRef(Ref ref) { - GHashIter *iter; - GString *tag; - GfxFontDictEntry *entry; - fonts->startIter(&iter); - while (fonts->getNext(&iter, &tag, (void **)&entry)) { - if (entry->ref.num == ref.num && entry->ref.gen == ref.gen) { - fonts->killIter(&iter); - load(tag->getCString(), entry); - return entry->font; + GfxFont *font; + int i; + + for (i = 0; i < uniqueFonts->getLength(); ++i) { + font = (GfxFont *)uniqueFonts->get(i); + if (font->getID()->num == ref.num && + font->getID()->gen == ref.gen) { + return font; } } return NULL; } int GfxFontDict::getNumFonts() { - loadAll(); return uniqueFonts->getLength(); } @@ -2358,52 +2305,6 @@ GfxFont *GfxFontDict::getFont(int i) { return (GfxFont *)uniqueFonts->get(i); } -void GfxFontDict::loadAll() { - GHashIter *iter; - GString *tag; - GfxFontDictEntry *entry; - fonts->startIter(&iter); - while (fonts->getNext(&iter, &tag, (void **)&entry)) { - load(tag->getCString(), entry); - } -} - -void GfxFontDict::load(char *tag, GfxFontDictEntry *entry) { - if (entry->loaded) { - return; - } - - // check for a duplicate that has already been loaded - // (don't do this for "synthetic" refs) - if (entry->fontObj.isRef()) { - for (int i = 0; i < uniqueFonts->getLength(); ++i) { - GfxFont *font = (GfxFont *)uniqueFonts->get(i); - if (font->getID()->num == entry->ref.num && - font->getID()->gen == entry->ref.gen) { - entry->load(font); - return; - } - } - } - - GfxFont *font = NULL; - Object obj; - entry->fontObj.fetch(xref, &obj); - if (obj.isDict()) { - font = GfxFont::makeFont(xref, tag, entry->ref, obj.getDict()); - if (font->isOk()) { - uniqueFonts->append(font); - } else { - delete font; - font = NULL; - } - } else { - error(errSyntaxError, -1, "font resource is not a dictionary"); - } - obj.free(); - entry->load(font); -} - // FNV-1a hash class FNVHash { public: diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h index ec6d3c3d246..e752ded62f8 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "GString.h" #include "Object.h" @@ -25,7 +29,6 @@ class FoFiTrueType; class FoFiType1C; struct GfxFontCIDWidths; struct Base14FontMapEntry; -class GfxFontDictEntry; class FNVHash; //------------------------------------------------------------------------ @@ -385,7 +388,7 @@ class GfxFontDict { public: // Build the font dictionary, given the PDF font dictionary. - GfxFontDict(XRef *xrefA, Ref *fontDictRef, Dict *fontDict); + GfxFontDict(XRef *xref, Ref *fontDictRef, Dict *fontDict); // Destructor. ~GfxFontDict(); @@ -402,18 +405,13 @@ private: friend class GfxFont; - void loadAll(); - void load(char *tag, GfxFontDictEntry *entry); static int hashFontObject(Object *obj); static void hashFontObject1(Object *obj, FNVHash *h); - XRef *xref; - GHash *fonts; // hash table of fonts, mapping from - // tag to GfxFontDictEntry; this may - // contain duplicates, i.e., two - // tags that map to the same font + GHash *fonts; // hash table of fonts -- this may + // include duplicates, i.e., when + // two tags map to the same font GList *uniqueFonts; // list of all unique font objects (no dups) - // that have been loaded }; #endif diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc index 9aed7345ad2..43503aaedb8 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stddef.h> #include <math.h> #include <string.h> @@ -932,15 +936,15 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, } nCompsA = obj2.getInt(); obj2.free(); - if (!dict->lookup("Alternate", &obj2)->isNull() && - (altA = GfxColorSpace::parse(&obj2, - recursion + 1))) { - if (altA->getNComps() != nCompsA) { - error(errSyntaxError, -1, - "Number of components in ICCBased color space doesn't match alternate color space"); - nCompsA = altA->getNComps(); - } - } else { + if (nCompsA > 4) { + error(errSyntaxError, -1, + "ICCBased color space with too many ({0:d} > 4) components", + nCompsA); + nCompsA = 4; + } + if (dict->lookup("Alternate", &obj2)->isNull() || + !(altA = GfxColorSpace::parse(&obj2, + recursion + 1))) { switch (nCompsA) { case 1: altA = GfxColorSpace::create(csDeviceGray); @@ -1780,258 +1784,6 @@ GfxPattern *GfxTilingPattern::copy() { &resDict, matrix, &contentStreamRef); } -GBool GfxTilingPattern::usesBlendMode(XRef *xref) { - char *scannedObjs = (char *)gmalloc(xref->getNumObjects()); - memset(scannedObjs, 0, xref->getNumObjects()); - GBool ret = scanResourcesForBlendMode(&resDict, scannedObjs, xref); - gfree(scannedObjs); - return ret; -} - -GBool GfxTilingPattern::scanResourcesForBlendMode(Object *resDict2, - char *scannedObjs, - XRef *xref) { - Object ref1, obj1, obj2; - - if (!resDict2->isDict()) { - return gFalse; - } - - //----- ExtGStates - resDict2->dictLookupNF("ExtGState", &ref1); - if (!ref1.isRef() || (ref1.getRefNum() < xref->getNumObjects() && - !scannedObjs[ref1.getRefNum()])) { - if (ref1.isRef()) { - scannedObjs[ref1.getRefNum()] = 1; - ref1.fetch(xref, &obj1); - } else { - ref1.copy(&obj1); - } - if (obj1.isDict()) { - for (int i = 0; i < obj1.dictGetLength(); ++i) { - if (scanExtGStateForBlendMode(obj1.dictGetValNF(i, &obj2), - scannedObjs, xref)) { - obj2.free(); - obj1.free(); - ref1.free(); - return gTrue; - } - obj2.free(); - } - } - obj1.free(); - } - ref1.free(); - - //----- patterns - resDict2->dictLookupNF("Pattern", &ref1); - if (!ref1.isRef() || (ref1.getRefNum() < xref->getNumObjects() && - !scannedObjs[ref1.getRefNum()])) { - if (ref1.isRef()) { - scannedObjs[ref1.getRefNum()] = 1; - ref1.fetch(xref, &obj1); - } else { - ref1.copy(&obj1); - } - if (obj1.isDict()) { - for (int i = 0; i < obj1.dictGetLength(); ++i) { - if (scanPatternForBlendMode(obj1.dictGetValNF(i, &obj2), - scannedObjs, xref)) { - obj2.free(); - obj1.free(); - ref1.free(); - return gTrue; - } - obj2.free(); - } - } - obj1.free(); - } - ref1.free(); - - //----- XObjects - resDict2->dictLookupNF("XObject", &ref1); - if (!ref1.isRef() || (ref1.getRefNum() < xref->getNumObjects() && - !scannedObjs[ref1.getRefNum()])) { - if (ref1.isRef()) { - scannedObjs[ref1.getRefNum()] = 1; - ref1.fetch(xref, &obj1); - } else { - ref1.copy(&obj1); - } - if (obj1.isDict()) { - for (int i = 0; i < obj1.dictGetLength(); ++i) { - if (scanXObjectForBlendMode(obj1.dictGetValNF(i, &obj2), - scannedObjs, xref)) { - obj2.free(); - obj1.free(); - ref1.free(); - return gTrue; - } - obj2.free(); - } - } - obj1.free(); - } - ref1.free(); - - return gFalse; -} - -GBool GfxTilingPattern::scanExtGStateForBlendMode(Object *gsObj, - char *scannedObjs, - XRef *xref) { - Object gsDict, obj1; - - if (gsObj->isRef()) { - if (gsObj->getRefNum() >= xref->getNumObjects() || - scannedObjs[gsObj->getRefNum()]) { - return gFalse; - } - scannedObjs[gsObj->getRefNum()] = 1; - gsObj->fetch(xref, &gsDict); - } else { - gsObj->copy(&gsDict); - } - if (!gsDict.isDict()) { - gsDict.free(); - return gFalse; - } - - gsDict.dictLookup("BM", &obj1); - if (obj1.isName() && !obj1.isName("Normal")) { - obj1.free(); - gsDict.free(); - return gTrue; - } - obj1.free(); - - if (!gsDict.dictLookupNF("SMask", &obj1)->isNull()) { - if (scanSoftMaskForBlendMode(&obj1, scannedObjs, xref)) { - obj1.free(); - gsDict.free(); - return gTrue; - } - } - obj1.free(); - - gsDict.free(); - - return gFalse; -} - -GBool GfxTilingPattern::scanSoftMaskForBlendMode(Object *softMaskObj, - char *scannedObjs, - XRef *xref) { - Object softMaskDict, obj1; - - if (softMaskObj->isRef()) { - if (softMaskObj->getRefNum() >= xref->getNumObjects() || - scannedObjs[softMaskObj->getRefNum()]) { - return gFalse; - } - scannedObjs[softMaskObj->getRefNum()] = 1; - softMaskObj->fetch(xref, &softMaskDict); - } else { - softMaskObj->copy(&softMaskDict); - } - if (!softMaskDict.isDict()) { - softMaskDict.free(); - return gFalse; - } - - if (!softMaskDict.dictLookupNF("G", &obj1)->isNull()) { - if (scanXObjectForBlendMode(&obj1, scannedObjs, xref)) { - obj1.free(); - softMaskDict.free(); - return gTrue; - } - } - obj1.free(); - - softMaskDict.free(); - - return gFalse; -} - -GBool GfxTilingPattern::scanPatternForBlendMode(Object *patternObj, - char *scannedObjs, - XRef *xref) { - Object patternObj2, obj1; - Dict *patternDict; - - if (patternObj->isRef()) { - if (patternObj->getRefNum() >= xref->getNumObjects() || - scannedObjs[patternObj->getRefNum()]) { - return gFalse; - } - scannedObjs[patternObj->getRefNum()] = 1; - patternObj->fetch(xref, &patternObj2); - } else { - patternObj->copy(&patternObj2); - } - if (patternObj2.isDict()) { - patternDict = patternObj2.getDict(); - } else if (patternObj2.isStream()) { - patternDict = patternObj2.streamGetDict(); - } else { - patternObj2.free(); - return gFalse; - } - - if (!patternDict->lookupNF("Resources", &obj1)->isNull()) { - if (scanResourcesForBlendMode(&obj1, scannedObjs, xref)) { - obj1.free(); - patternObj2.free(); - return gTrue; - } - } - obj1.free(); - - patternObj2.free(); - - return gFalse; -} - -GBool GfxTilingPattern::scanXObjectForBlendMode(Object *xObj, - char *scannedObjs, - XRef *xref) { - Object xObj2, obj1; - Dict *dict; - - if (xObj->isRef()) { - if (xObj->getRefNum() >= xref->getNumObjects() || - scannedObjs[xObj->getRefNum()]) { - return gFalse; - } - scannedObjs[xObj->getRefNum()] = 1; - xObj->fetch(xref, &xObj2); - } else { - xObj->copy(&xObj2); - } - if (xObj2.isDict()) { - dict = xObj2.getDict(); - } else if (xObj2.isStream()) { - dict = xObj2.streamGetDict(); - } else { - xObj2.free(); - return gFalse; - } - - if (!dict->lookupNF("Resources", &obj1)->isNull()) { - if (scanResourcesForBlendMode(&obj1, scannedObjs, xref)) { - obj1.free(); - xObj2.free(); - return gTrue; - } - } - obj1.free(); - - xObj2.free(); - - return gFalse; -} - //------------------------------------------------------------------------ // GfxShadingPattern //------------------------------------------------------------------------ @@ -3211,8 +2963,8 @@ void GfxGouraudTriangleShading::getTriangle( } } -void GfxGouraudTriangleShading::getBBox(double *xMinA, double *yMinA, - double *xMaxA, double *yMaxA) { +void GfxGouraudTriangleShading::getBBox(double *xMin, double *yMin, + double *xMax, double *yMax) { double xxMin = 0; double yyMin = 0; double xxMax = 0; @@ -3233,10 +2985,10 @@ void GfxGouraudTriangleShading::getBBox(double *xMinA, double *yMinA, yyMax = vertices[i].y; } } - *xMinA = xxMin; - *yMinA = yyMin; - *xMaxA = xxMax; - *yMaxA = yyMax; + *xMin = xxMin; + *yMin = yyMin; + *xMax = xxMax; + *yMax = yyMax; } void GfxGouraudTriangleShading::getColor(double *in, GfxColor *out) { @@ -3869,8 +3621,8 @@ GfxShading *GfxPatchMeshShading::copy() { return new GfxPatchMeshShading(this); } -void GfxPatchMeshShading::getBBox(double *xMinA, double *yMinA, - double *xMaxA, double *yMaxA) { +void GfxPatchMeshShading::getBBox(double *xMin, double *yMin, + double *xMax, double *yMax) { double xxMin = 0; double yyMin = 0; double xxMax = 0; @@ -3895,10 +3647,10 @@ void GfxPatchMeshShading::getBBox(double *xMinA, double *yMinA, } } } - *xMinA = xxMin; - *yMinA = yyMin; - *xMaxA = xxMax; - *yMaxA = yyMax; + *xMin = xxMin; + *yMin = yyMin; + *xMax = xxMax; + *yMax = yyMax; } void GfxPatchMeshShading::getColor(double *in, GfxColor *out) { @@ -4899,36 +4651,35 @@ void GfxState::clipToStrokePath() { // There are two cases for each point on the path: // (1) miter join, under miter limit => compute the miter point // (2) all other joins and caps => use the path point +/- 0.5 * line width - double uxMin = 0, uyMin = 0, uxMax = 0, uyMax = 0; + double xMin = 0, yMin = 0, xMax = 0, yMax = 0; double w = 0.5 * lineWidth; for (int i = 0; i < path->getNumSubpaths(); ++i) { GfxSubpath *subpath = path->getSubpath(i); - int nPoints; - if (subpath->isClosed()) { - nPoints = subpath->getNumPoints() - 1; - } else { - nPoints = subpath->getNumPoints(); - } - for (int j = 0; j < nPoints; ++j) { + for (int j = 0; j < subpath->getNumPoints(); ++j) { double x1 = subpath->getX(j); double y1 = subpath->getY(j); if (i == 0 && j == 0) { - uxMin = uxMax = x1; - uyMin = uyMax = y1; + xMin = xMax = x1; + yMin = yMax = y1; } GBool useMiter = gFalse; if (lineJoin == 0 && // miter join - (subpath->isClosed() || (j > 0 && j < subpath->getNumPoints() - 1))) { + ((j > 0 && j < subpath->getNumPoints() - 1) || subpath->isClosed())) { double x0, y0, x2, y2; - if (j == 0) { - x0 = subpath->getX(nPoints - 1); - y0 = subpath->getY(nPoints - 1); - } else { + if (j > 0) { x0 = subpath->getX(j - 1); y0 = subpath->getY(j - 1); + } else { + x0 = subpath->getLastX(); + y0 = subpath->getLastY(); + } + if (j < subpath->getNumPoints() - 1) { + x2 = subpath->getX(j + 1); + y2 = subpath->getY(j + 1); + } else { + x2 = subpath->getX(0); + y2 = subpath->getY(0); } - x2 = subpath->getX(j + 1); - y2 = subpath->getY(j + 1); if ((fabs(x1 - x0) > 0.0001 || fabs(y1 - y0) > 0.0001) && (fabs(x2 - x1) > 0.0001 || fabs(y2 - y1) > 0.0001)) { double d01 = 1 / sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)); @@ -4953,15 +4704,15 @@ void GfxState::clipToStrokePath() { } double mx = ax + m * w * ux; double my = ay + m * w * uy; - if (mx < uxMin) { - uxMin = mx; - } else if (mx > uxMax) { - uxMax = mx; + if (mx < xMin) { + xMin = mx; + } else if (mx > xMax) { + xMax = mx; } - if (my < uyMin) { - uyMin = my; - } else if (my > uyMax) { - uyMax = my; + if (my < yMin) { + yMin = my; + } else if (my > yMax) { + yMax = my; } useMiter = gTrue; } @@ -4969,71 +4720,66 @@ void GfxState::clipToStrokePath() { } } if (!useMiter) { - if (x1 - w < uxMin) { - uxMin = x1 - w; + if (x1 - w < xMin) { + xMin = x1 - w; } - if (x1 + w > uxMax) { - uxMax = x1 + w; + if (x1 + w > xMax) { + xMax = x1 + w; } - if (y1 - w < uyMin) { - uyMin = y1 - w; + if (y1 - w < yMin) { + yMin = y1 - w; } - if (y1 + w > uyMax) { - uyMax = y1 + w; + if (y1 + w > yMax) { + yMax = y1 + w; } } } } - double dxMin, dyMin, dxMax, dyMax, xx, yy; - transform(uxMin, uyMin, &xx, &yy); - dxMin = dxMax = xx; - dyMin = dyMax = yy; - transform(uxMin, uyMax, &xx, &yy); - if (xx < dxMin) { - dxMin = xx; - } else if (xx > dxMax) { - dxMax = xx; - } - if (yy < dyMin) { - dyMin = yy; - } else if (yy > dyMax) { - dyMax = yy; - } - transform(uxMax, uyMin, &xx, &yy); - if (xx < dxMin) { - dxMin = xx; - } else if (xx > dxMax) { - dxMax = xx; - } - if (yy < dyMin) { - dyMin = yy; - } else if (yy > dyMax) { - dyMax = yy; - } - transform(uxMax, uyMax, &xx, &yy); - if (xx < dxMin) { - dxMin = xx; - } else if (xx > dxMax) { - dxMax = xx; - } - if (yy < dyMin) { - dyMin = yy; - } else if (yy > dyMax) { - dyMax = yy; - } - - if (dxMin > clipXMin) { - clipXMin = dxMin; - } - if (dyMin > clipYMin) { - clipYMin = dyMin; - } - if (dxMax < clipXMax) { - clipXMax = dxMax; - } - if (dyMax < clipYMax) { - clipYMax = dyMax; + double xx, yy; + transform(xMin, yMin, &xx, &yy); + if (xx < clipXMin) { + clipXMin = xx; + } else if (xx > clipXMax) { + clipXMax = xx; + } + if (yy < clipYMin) { + clipYMin = yy; + } else if (yy > clipYMax) { + clipYMax = yy; + } + transform(xMin, yMax, &xx, &yy); + if (xx < clipXMin) { + clipXMin = xx; + } else if (xx > clipXMax) { + clipXMax = xx; + } + if (yy < clipYMin) { + clipYMin = yy; + } else if (yy > clipYMax) { + clipYMax = yy; + } + transform(xMax, yMin, &xx, &yy); + if (xx < clipXMin) { + clipXMin = xx; + } else if (xx > clipXMax) { + clipXMax = xx; + } + if (yy < clipYMin) { + clipYMin = yy; + } else if (yy > clipYMax) { + clipYMax = yy; + } + transform(xMax, yMax, &xx, &yy); + if (xx < clipXMin) { + clipXMin = xx; + } else if (xx > clipXMax) { + clipXMax = xx; + } + if (yy < clipYMin) { + clipYMin = yy; + } else if (yy > clipYMax) { + clipYMax = yy; } } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h index 57b57e06a66..60d48527c29 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "Object.h" #include "Function.h" @@ -659,7 +663,6 @@ public: { return resDict.isDict() ? resDict.getDict() : (Dict *)NULL; } double *getMatrix() { return matrix; } Object *getContentStreamRef() { return &contentStreamRef; } - GBool usesBlendMode(XRef *xref); private: @@ -667,16 +670,6 @@ private: double *bboxA, double xStepA, double yStepA, Object *resDictA, double *matrixA, Object *contentStreamA); - GBool scanResourcesForBlendMode(Object *resDict2, - char *scannedObjs, XRef *xref); - GBool scanExtGStateForBlendMode(Object *gsObj, - char *scannedObjs, XRef *xref); - GBool scanSoftMaskForBlendMode(Object *softMaskObj, - char *scannedObjs, XRef *xref); - GBool scanPatternForBlendMode(Object *patternObj, - char *scannedObjs, XRef *xref); - GBool scanXObjectForBlendMode(Object *xObj, - char *scannedObjs, XRef *xref); int paintType; int tilingType; @@ -890,7 +883,7 @@ public: void getTriangle(int i, double *x0, double *y0, double *color0, double *x1, double *y1, double *color1, double *x2, double *y2, double *color2); - void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA); + void getBBox(double *xMin, double *yMin, double *xMax, double *yMax); void getColor(double *in, GfxColor *out); private: @@ -930,7 +923,7 @@ public: int getNComps() { return nComps; } int getNPatches() { return nPatches; } GfxPatch *getPatch(int i) { return &patches[i]; } - void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA); + void getBBox(double *xMin, double *yMin, double *xMax, double *yMax); void getColor(double *in, GfxColor *out); private: diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc index fcacd7f1e71..e7cc594b12d 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <string.h> #include <stdio.h> #include <stdarg.h> @@ -40,12 +44,10 @@ #include "GlobalParams.h" #ifdef _WIN32 -#ifndef __GNUC__ # undef strcasecmp # undef strncasecmp # define strcasecmp _stricmp # define strncasecmp _strnicmp -#endif #else # include <strings.h> #endif @@ -103,14 +105,14 @@ static struct { {NULL} }; -static const char *displayFontDirs[] = { -#ifdef BASE14_FONT_DIR - BASE14_FONT_DIR, -#endif #ifdef _WIN32 +static const char *displayFontDirs[] = { "c:/windows/fonts", "c:/winnt/fonts", -#else // _WIN32 + NULL +}; +#else +static const char *displayFontDirs[] = { "/usr/share/ghostscript/fonts", "/usr/local/share/ghostscript/fonts", "/usr/share/fonts/default/Type1", @@ -119,9 +121,9 @@ static const char *displayFontDirs[] = { #if defined(__sun) && defined(__SVR4) "/usr/sfw/share/ghostscript/fonts", #endif -#endif // _WIN32 NULL }; +#endif #ifdef __APPLE__ static const char *macSystemFontPath = "/System/Library/Fonts"; @@ -181,7 +183,7 @@ public: ~SysFontInfo(); GString *mungeName1(GString *in); GString *mungeName2(GString *in); - void mungeName3(GString *nameA, GBool *bold, GBool *italic); + void mungeName3(GString *name, GBool *bold, GBool *italic); int match(GString *nameA); }; @@ -258,24 +260,24 @@ GString *SysFontInfo::mungeName2(GString *in) { // Remove trailing bold/italic/regular/roman tags from the name. // (Note: the names have already been uppercased by mungeName1/2.) -void SysFontInfo::mungeName3(GString *nameA, GBool *bold, GBool *italic) { +void SysFontInfo::mungeName3(GString *name, GBool *bold, GBool *italic) { *bold = gFalse; *italic = gFalse; - int n = nameA->getLength(); + int n = name->getLength(); while (1) { - if (n >= 4 && !strcmp(nameA->getCString() + n - 4, "BOLD")) { - nameA->del(n - 4, 4); + if (n >= 4 && !strcmp(name->getCString() + n - 4, "BOLD")) { + name->del(n - 4, 4); n -= 4; *bold = gTrue; - } else if (n >= 6 && !strcmp(nameA->getCString() + n - 6, "ITALIC")) { - nameA->del(n - 6, 6); + } else if (n >= 6 && !strcmp(name->getCString() + n - 6, "ITALIC")) { + name->del(n - 6, 6); n -= 6; *italic = gTrue; - } else if (n >= 7 && !strcmp(nameA->getCString() + n - 7, "REGULAR")) { - nameA->del(n - 7, 7); + } else if (n >= 7 && !strcmp(name->getCString() + n - 7, "REGULAR")) { + name->del(n - 7, 7); n -= 7; - } else if (n >= 5 && !strcmp(nameA->getCString() + n - 5, "ROMAN")) { - nameA->del(n - 5, 5); + } else if (n >= 5 && !strcmp(name->getCString() + n - 5, "ROMAN")) { + name->del(n - 5, 5); n -= 5; } else { break; @@ -657,7 +659,7 @@ GlobalParams::GlobalParams(const char *cfgFileName) { base14SysFonts = new GHash(gTrue); sysFonts = new SysFontList(); #if HAVE_PAPER_H - const char *paperName; + char *paperName; const struct paper *paperType; paperinit(); if ((paperName = systempapername())) { @@ -713,21 +715,6 @@ GlobalParams::GlobalParams(const char *cfgFileName) { textKeepTinyChars = gTrue; initialZoom = new GString("125"); defaultFitZoom = 0; - zoomScaleFactor = 1; - zoomValues = new GList(); - zoomValues->append(new GString("25")); - zoomValues->append(new GString("50")); - zoomValues->append(new GString("75")); - zoomValues->append(new GString("100")); - zoomValues->append(new GString("110")); - zoomValues->append(new GString("125")); - zoomValues->append(new GString("150")); - zoomValues->append(new GString("175")); - zoomValues->append(new GString("200")); - zoomValues->append(new GString("300")); - zoomValues->append(new GString("400")); - zoomValues->append(new GString("600")); - zoomValues->append(new GString("800")); initialDisplayMode = new GString("continuous"); initialToolbarState = gTrue; initialSidebarState = gTrue; @@ -761,7 +748,6 @@ GlobalParams::GlobalParams(const char *cfgFileName) { fullScreenMatteColor = new GString("#000000"); selectionColor = new GString("#8080ff"); reverseVideoInvertImages = gFalse; - allowLinksToChangeZoom = gTrue; launchCommand = NULL; movieCommand = NULL; defaultPrinter = NULL; @@ -769,15 +755,10 @@ GlobalParams::GlobalParams(const char *cfgFileName) { mapUnknownCharNames = gFalse; mapExtTrueTypeFontsViaUnicode = gTrue; useTrueTypeUnicodeMapping = gFalse; - ignoreWrongSizeToUnicode = gFalse; droppedFonts = new GHash(gTrue); - separateRotatedText = gFalse; createDefaultKeyBindings(); popupMenuCmds = new GList(); -#ifndef PDF_PARSER_ONLY - initStateFilePaths(); -#endif - saveSessionOnQuit = gTrue; + tabStateFile = appendToPath(getHomeDir(), ".xpdf.tab-state"); savePageNumbers = gTrue; printCommands = gFalse; printStatusInfo = gFalse; @@ -1036,27 +1017,6 @@ void GlobalParams::createDefaultKeyBindings() { xpdfKeyContextAny, "zoomFitWidth")); } -#ifndef PDF_PARSER_ONLY -void GlobalParams::initStateFilePaths() { -#ifdef _WIN32 - char path[MAX_PATH]; - if (SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, - SHGFP_TYPE_CURRENT, path) != S_OK) { - return; - } - GString *dir = appendToPath(new GString(path), "xpdf"); - CreateDirectoryA(dir->getCString(), NULL); - pagesFile = appendToPath(dir->copy(), "xpdf.pages"); - tabStateFile = appendToPath(dir->copy(), "xpdf.tab-state"); - sessionFile = appendToPath(dir, "xpdf.session"); -#else - pagesFile = appendToPath(getHomeDir(), ".xpdf.pages"); - tabStateFile = appendToPath(getHomeDir(), ".xpdf.tab-state"); - sessionFile = appendToPath(getHomeDir(), ".xpdf.session"); -#endif -} -#endif - void GlobalParams::parseFile(GString *fileName, FILE *f) { int line; char buf[512]; @@ -1197,10 +1157,6 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { parseString("initialZoom", &initialZoom, tokens, fileName, line); } else if (!cmd->cmp("defaultFitZoom")) { parseInteger("defaultFitZoom", &defaultFitZoom, tokens, fileName, line); - } else if (!cmd->cmp("zoomScaleFactor")) { - parseZoomScaleFactor(tokens, fileName, line); - } else if (!cmd->cmp("zoomValues")) { - parseZoomValues(tokens, fileName, line); } else if (!cmd->cmp("initialDisplayMode")) { parseString("initialDisplayMode", &initialDisplayMode, tokens, fileName, line); @@ -1288,9 +1244,6 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { } else if (!cmd->cmp("reverseVideoInvertImages")) { parseYesNo("reverseVideoInvertImages", &reverseVideoInvertImages, tokens, fileName, line); - } else if (!cmd->cmp("allowLinksToChangeZoom")) { - parseYesNo("allowLinksToChangeZoom", &allowLinksToChangeZoom, - tokens, fileName, line); } else if (!cmd->cmp("launchCommand")) { parseString("launchCommand", &launchCommand, tokens, fileName, line); } else if (!cmd->cmp("movieCommand")) { @@ -1308,16 +1261,11 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { &mapExtTrueTypeFontsViaUnicode, tokens, fileName, line); } else if (!cmd->cmp("useTrueTypeUnicodeMapping")) { - parseYesNo("useTrueTypeUnicodeMapping", &useTrueTypeUnicodeMapping, - tokens, fileName, line); - } else if (!cmd->cmp("ignoreWrongSizeToUnicode")) { - parseYesNo("ignoreWrongSizeToUnicode", &ignoreWrongSizeToUnicode, + parseYesNo("useTrueTypeUnicodeMapping", + &useTrueTypeUnicodeMapping, tokens, fileName, line); } else if (!cmd->cmp("dropFont")) { parseDropFont(tokens, fileName, line); - } else if (!cmd->cmp("separateRotatedText")) { - parseYesNo("separateRotatedText", &separateRotatedText, - tokens, fileName, line); } else if (!cmd->cmp("bind")) { parseBind(tokens, fileName, line); } else if (!cmd->cmp("unbind")) { @@ -1326,11 +1274,6 @@ void GlobalParams::parseLine(char *buf, GString *fileName, int line) { parsePopupMenuCmd(tokens, fileName, line); } else if (!cmd->cmp("tabStateFile")) { parseString("tabStateFile", &tabStateFile, tokens, fileName, line); - } else if (!cmd->cmp("sessionFile")) { - parseString("sessionFile", &sessionFile, tokens, fileName, line); - } else if (!cmd->cmp("saveSessionOnQuit")) { - parseYesNo("saveSessionOnQuit", &saveSessionOnQuit, - tokens, fileName, line); } else if (!cmd->cmp("savePageNumbers")) { parseYesNo("savePageNumbers", &savePageNumbers, tokens, fileName, line); } else if (!cmd->cmp("printCommands")) { @@ -2030,59 +1973,6 @@ void GlobalParams::parsePopupMenuCmd(GList *tokens, cmds)); } -void GlobalParams::parseZoomScaleFactor(GList *tokens, - GString *fileName, int line) { - if (tokens->getLength() != 2) { - error(errConfig, -1, "Bad 'zoomScaleFactor' config file command ({0:t}:{1:d})", - fileName, line); - return; - } - GString *tok = (GString *)tokens->get(1); - if (tok->getLength() == 0) { - error(errConfig, -1, "Bad 'zoomScaleFactor' config file command ({0:t}:{1:d})", - fileName, line); - return; - } - if (tok->cmp("actual") == 0) { - zoomScaleFactor = -1; - } else { - for (int i = 0; i < tok->getLength(); ++i) { - if (!((tok->getChar(i) >= '0' && tok->getChar(i) <= '9') || - tok->getChar(i) == '.')) { - error(errConfig, -1, "Bad 'zoomScaleFactor' config file command ({0:t}:{1:d})", - fileName, line); - return; - } - } - zoomScaleFactor = atof(tok->getCString()); - } -} - -void GlobalParams::parseZoomValues(GList *tokens, - GString *fileName, int line) { - if (tokens->getLength() < 2) { - error(errConfig, -1, "Bad 'zoomValues' config file command ({0:t}:{1:d})", - fileName, line); - return; - } - for (int i = 1; i < tokens->getLength(); ++i) { - GString *tok = (GString *)tokens->get(i); - for (int j = 0; j < tok->getLength(); ++j) { - if (tok->getChar(j) < '0' || tok->getChar(j) > '9') { - error(errConfig, -1, "Bad 'zoomValues' config file command ({0:t}:{1:d})", - fileName, line); - return; - } - } - } - deleteGList(zoomValues, GString); - zoomValues = new GList(); - for (int i = 1; i < tokens->getLength(); ++i) { - GString *tok = (GString *)tokens->get(i); - zoomValues->append(tok->copy()); - } -} - void GlobalParams::parseYesNo(const char *cmdName, GBool *flag, GList *tokens, GString *fileName, int line) { GString *tok; @@ -2214,7 +2104,6 @@ GlobalParams::~GlobalParams() { deleteGList(psResidentFontsCC, PSFontParam16); delete textEncoding; delete initialZoom; - deleteGList(zoomValues, GString); delete initialDisplayMode; delete initialSelectMode; if (paperColor) { @@ -2241,9 +2130,7 @@ GlobalParams::~GlobalParams() { delete droppedFonts; deleteGList(keyBindings, KeyBinding); deleteGList(popupMenuCmds, PopupMenuCmd); - delete pagesFile; delete tabStateFile; - delete sessionFile; delete debugLogFile; cMapDirs->startIter(&iter); @@ -3072,19 +2959,6 @@ int GlobalParams::getDefaultFitZoom() { return z; } -double GlobalParams::getZoomScaleFactor() { - double z; - - lockGlobalParams; - z = zoomScaleFactor; - unlockGlobalParams; - return z; -} - -GList *GlobalParams::getZoomValues() { - return zoomValues; -} - GString *GlobalParams::getInitialDisplayMode() { GString *s; @@ -3376,15 +3250,6 @@ GBool GlobalParams::getReverseVideoInvertImages() { return invert; } -GBool GlobalParams::getAllowLinksToChangeZoom() { - GBool allow; - - lockGlobalParams; - allow = allowLinksToChangeZoom; - unlockGlobalParams; - return allow; -} - GString *GlobalParams::getDefaultPrinter() { GString *s; @@ -3430,15 +3295,6 @@ GBool GlobalParams::getUseTrueTypeUnicodeMapping() { return use; } -GBool GlobalParams::getIgnoreWrongSizeToUnicode() { - GBool ignore; - - lockGlobalParams; - ignore = ignoreWrongSizeToUnicode; - unlockGlobalParams; - return ignore; -} - GBool GlobalParams::isDroppedFont(const char *fontName) { GBool isDropped; @@ -3448,15 +3304,6 @@ GBool GlobalParams::isDroppedFont(const char *fontName) { return isDropped; } -GBool GlobalParams::getSeparateRotatedText() { - GBool sep; - - lockGlobalParams; - sep = separateRotatedText; - unlockGlobalParams; - return sep; -} - GList *GlobalParams::getKeyBinding(int code, int mods, int context) { KeyBinding *binding; GList *cmds; @@ -3509,15 +3356,6 @@ PopupMenuCmd *GlobalParams::getPopupMenuCmd(int idx) { return cmd; } -GString *GlobalParams::getPagesFile() { - GString *s; - - lockGlobalParams; - s = pagesFile->copy(); - unlockGlobalParams; - return s; -} - GString *GlobalParams::getTabStateFile() { GString *s; @@ -3527,15 +3365,6 @@ GString *GlobalParams::getTabStateFile() { return s; } -GString *GlobalParams::getSessionFile() { - GString *s; - - lockGlobalParams; - s = sessionFile->copy(); - unlockGlobalParams; - return s; -} - GBool GlobalParams::getSavePageNumbers() { GBool s; @@ -3545,15 +3374,6 @@ GBool GlobalParams::getSavePageNumbers() { return s; } -GBool GlobalParams::getSaveSessionOnQuit() { - GBool s; - - lockGlobalParams; - s = saveSessionOnQuit; - unlockGlobalParams; - return s; -} - GBool GlobalParams::getPrintCommands() { GBool p; @@ -3892,12 +3712,6 @@ void GlobalParams::setInitialZoom(char *s) { unlockGlobalParams; } -void GlobalParams::setDefaultFitZoom(int z) { - lockGlobalParams; - defaultFitZoom = z; - unlockGlobalParams; -} - GBool GlobalParams::setEnableFreeType(char *s) { GBool ok; @@ -4001,13 +3815,6 @@ void GlobalParams::setTabStateFile(char *tabStateFileA) { unlockGlobalParams; } -void GlobalParams::setSessionFile(char *sessionFileA) { - lockGlobalParams; - delete sessionFile; - sessionFile = new GString(sessionFileA); - unlockGlobalParams; -} - void GlobalParams::setPrintCommands(GBool printCommandsA) { lockGlobalParams; printCommands = printCommandsA; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h b/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h index c9b4c7bdc09..d72473f2a46 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h @@ -14,6 +14,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include <stdio.h> #ifdef _WIN32 # include <windows.h> @@ -299,8 +303,6 @@ public: GBool getTextKeepTinyChars(); GString *getInitialZoom(); int getDefaultFitZoom(); - double getZoomScaleFactor(); - GList *getZoomValues(); GString *getInitialDisplayMode(); GBool getInitialToolbarState(); GBool getInitialSidebarState(); @@ -334,7 +336,6 @@ public: GString *getFullScreenMatteColor(); GString *getSelectionColor(); GBool getReverseVideoInvertImages(); - GBool getAllowLinksToChangeZoom(); GString *getLaunchCommand() { return launchCommand; } GString *getMovieCommand() { return movieCommand; } GString *getDefaultPrinter(); @@ -342,17 +343,12 @@ public: GBool getMapUnknownCharNames(); GBool getMapExtTrueTypeFontsViaUnicode(); GBool getUseTrueTypeUnicodeMapping(); - GBool getIgnoreWrongSizeToUnicode(); GBool isDroppedFont(const char *fontName); - GBool getSeparateRotatedText(); GList *getKeyBinding(int code, int mods, int context); GList *getAllKeyBindings(); int getNumPopupMenuCmds(); PopupMenuCmd *getPopupMenuCmd(int idx); - GString *getPagesFile(); GString *getTabStateFile(); - GString *getSessionFile(); - GBool getSaveSessionOnQuit(); GBool getSavePageNumbers(); GBool getPrintCommands(); GBool getPrintStatusInfo(); @@ -394,7 +390,6 @@ public: void setTextPageBreaks(GBool pageBreaks); void setTextKeepTinyChars(GBool keep); void setInitialZoom(char *s); - void setDefaultFitZoom(int z); GBool setEnableFreeType(char *s); GBool setAntialias(char *s); GBool setVectorAntialias(char *s); @@ -410,7 +405,6 @@ public: void setMapUnknownCharNames(GBool map); void setMapExtTrueTypeFontsViaUnicode(GBool map); void setTabStateFile(char *tabStateFileA); - void setSessionFile(char *sessionFileA); void setPrintCommands(GBool printCommandsA); void setPrintStatusInfo(GBool printStatusInfoA); void setErrQuiet(GBool errQuietA); @@ -426,9 +420,6 @@ private: void setDataDirVar(); void createDefaultKeyBindings(); -#ifndef PDF_PARSER_ONLY - void initStateFilePaths(); -#endif void parseFile(GString *fileName, FILE *f); GList *parseLineTokens(char *buf, GString *fileName, int line); void parseNameToUnicode(GList *tokens, GString *fileName, int line); @@ -459,8 +450,6 @@ private: const char *cmdName, GList *tokens, GString *fileName, int line); void parsePopupMenuCmd(GList *tokens, GString *fileName, int line); - void parseZoomScaleFactor(GList *tokens, GString *fileName, int line); - void parseZoomValues(GList *tokens, GString *fileName, int line); void parseYesNo(const char *cmdName, GBool *flag, GList *tokens, GString *fileName, int line); GBool parseYesNo2(char *token, GBool *flag); @@ -559,9 +548,7 @@ private: GBool textKeepTinyChars; // keep all characters in text output GString *initialZoom; // initial zoom level int defaultFitZoom; // default zoom factor if initialZoom is - // 'page' or 'width' - double zoomScaleFactor; // displayed zoom values are scaled by this - GList *zoomValues; // zoom values for the combo box + // 'page' or 'width'. GString *initialDisplayMode; // initial display mode (single, // continuous, etc.) GBool initialToolbarState; // initial toolbar state - open (true) @@ -599,7 +586,6 @@ private: GString *fullScreenMatteColor; // matte color in full-screen mode GString *selectionColor; // selection color GBool reverseVideoInvertImages; // invert images in reverse video mode - GBool allowLinksToChangeZoom; // allow clicking on a link to change the zoom GString *launchCommand; // command executed for 'launch' links GString *movieCommand; // command executed for movie annotations GString *defaultPrinter; // default printer (for interactive printing @@ -611,16 +597,10 @@ private: GBool useTrueTypeUnicodeMapping; // use the Unicode cmaps in TrueType // fonts, rather than the PDF // ToUnicode mapping - GBool ignoreWrongSizeToUnicode; // ignore ToUnicode CMaps if their size - // (8-bit vs 16-bit) doesn't match the font GHash *droppedFonts; // dropped fonts [int] - GBool separateRotatedText; // separate text at each rotation GList *keyBindings; // key & mouse button bindings [KeyBinding] GList *popupMenuCmds; // popup menu commands [PopupMenuCmd] - GString *pagesFile; // path for the page number save file GString *tabStateFile; // path for the tab state save file - GString *sessionFile; // path for the session save file - GBool saveSessionOnQuit; // save session info when xpdf is quit GBool savePageNumbers; // save page number when file is closed // and restore page number when opened GBool printCommands; // print the drawing commands diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc index 0183d3a14f4..a077655ef43 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc @@ -21,6 +21,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <png.h> #include "gmem.h" @@ -31,7 +35,6 @@ #include "PDFDoc.h" #include "GfxFont.h" #include "AcroForm.h" -#include "TextString.h" #include "TextOutputDev.h" #include "SplashOutputDev.h" #include "ErrorCodes.h" @@ -39,11 +42,9 @@ #include "HTMLGen.h" #ifdef _WIN32 -#ifndef __GNUC__ # define strcasecmp stricmp # define strncasecmp strnicmp #endif -#endif //------------------------------------------------------------------------ @@ -296,7 +297,6 @@ HTMLGen::HTMLGen(double backgroundResolutionA, GBool tableMode) { convertFormFields = gFalse; embedBackgroundImage = gFalse; embedFonts = gFalse; - includeMetadata = gFalse; // set up the TextOutputDev textOutControl.mode = tableMode ? textOutTableLayout : textOutReadingOrder; @@ -312,10 +312,6 @@ HTMLGen::HTMLGen(double backgroundResolutionA, GBool tableMode) { splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse, paperColor); fontDefns = NULL; - - nVisibleChars = 0; - nInvisibleChars = 0; - nRemovedDupChars = 0; } HTMLGen::~HTMLGen() { @@ -466,11 +462,11 @@ int HTMLGen::convertPage( llyI = bitmap->getHeight() - 1; } if (uryI <= llyI && llxI <= urxI) { - SplashColorPtr pix = bitmap->getDataPtr() - + uryI * bitmap->getRowSize() + llxI * 3; - for (y = uryI; y <= llyI; ++y) { - memset(pix, 0xff, (urxI - llxI + 1) * 3); - pix += bitmap->getRowSize(); + SplashColorPtr p = bitmap->getDataPtr() + + uryI * bitmap->getRowSize() + llxI * 3; + for (int y = uryI; y <= llyI; ++y) { + memset(p, 0xff, (urxI - llxI + 1) * 3); + p += bitmap->getRowSize(); } } @@ -487,9 +483,6 @@ int HTMLGen::convertPage( pr(writeHTML, htmlStream, "<html>\n"); pr(writeHTML, htmlStream, "<head>\n"); pr(writeHTML, htmlStream, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"); - if (includeMetadata) { - genDocMetadata(writeHTML, htmlStream); - } pr(writeHTML, htmlStream, "<style type=\"text/css\">\n"); pr(writeHTML, htmlStream, ".txt { white-space:nowrap; }\n"); if (convertFormFields) { @@ -578,9 +571,6 @@ int HTMLGen::convertPage( // generate the HTML text nextFieldID = 0; cols = text->makeColumns(); - nVisibleChars = text->getNumVisibleChars(); - nInvisibleChars = text->getNumInvisibleChars(); - nRemovedDupChars = text->getNumRemovedDupChars(); for (colIdx = 0; colIdx < cols->getLength(); ++colIdx) { col = (TextColumn *)cols->get(colIdx); pars = col->getParagraphs(); @@ -1128,47 +1118,3 @@ void HTMLGen::getFontDetails(TextFontInfo *font, const char **family, *weight = bold ? "bold" : "normal"; *style = italic ? "italic" : "normal"; } - -void HTMLGen::genDocMetadata(int (*writeHTML)(void *stream, - const char *data, int size), - void *htmlStream) { - Object info; - doc->getDocInfo(&info); - if (info.isDict()) { - genDocMetadataItem(writeHTML, htmlStream, info.getDict(), "Title"); - genDocMetadataItem(writeHTML, htmlStream, info.getDict(), "Subject"); - genDocMetadataItem(writeHTML, htmlStream, info.getDict(), "Keywords"); - genDocMetadataItem(writeHTML, htmlStream, info.getDict(), "Author"); - genDocMetadataItem(writeHTML, htmlStream, info.getDict(), "Creator"); - genDocMetadataItem(writeHTML, htmlStream, info.getDict(), "Producer"); - genDocMetadataItem(writeHTML, htmlStream, info.getDict(), "CreationDate"); - genDocMetadataItem(writeHTML, htmlStream, info.getDict(), "ModDate"); - } - info.free(); -} - -void HTMLGen::genDocMetadataItem(int (*writeHTML)(void *stream, - const char *data, int size), - void *htmlStream, - Dict *infoDict, const char *key) { - Object val; - if (infoDict->lookup(key, &val)->isString()) { - GString *s = GString::format("<meta name=\"{0:s}\" content=\"", key); - TextString *ts = new TextString(val.getString()); - Unicode *u = ts->getUnicode(); - for (int i = 0; i < ts->getLength(); ++i) { - if (u[i] == '"') { - s->append("""); - } else if (u[i] == '&') { - s->append("&"); - } else { - appendUTF8(u[i], s); - } - } - delete ts; - s->append("\">\n"); - writeHTML(htmlStream, s->getCString(), s->getLength()); - delete s; - } - val.free(); -} diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.h b/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.h index 47e361f78fa..66ee2d27406 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + class GString; class PDFDoc; class TextOutputDev; @@ -57,9 +61,6 @@ public: void setEmbedFonts(GBool embedFontsA) { embedFonts = embedFontsA; } - void setIncludeMetadata(GBool includeMetadataA) - { includeMetadata = includeMetadataA; } - void startDoc(PDFDoc *docA); int convertPage(int pg, const char *pngURL, const char *htmlDir, int (*writeHTML)(void *stream, const char *data, int size), @@ -67,11 +68,6 @@ public: int (*writePNG)(void *stream, const char *data, int size), void *pngStream); - // Get the counter values. - int getNumVisibleChars() { return nVisibleChars; } - int getNumInvisibleChars() { return nInvisibleChars; } - int getNumRemovedDupChars() { return nRemovedDupChars; } - private: int findDirSpan(GList *words, int firstWordIdx, int primaryDir, @@ -86,13 +82,6 @@ private: void getFontDetails(TextFontInfo *font, const char **family, const char **weight, const char **style, double *scale); - void genDocMetadata(int (*writeHTML)(void *stream, - const char *data, int size), - void *htmlStream); - void genDocMetadataItem(int (*writeHTML)(void *stream, - const char *data, int size), - void *htmlStream, - Dict *infoDict, const char *key); double backgroundResolution; double zoom; @@ -103,7 +92,6 @@ private: GBool convertFormFields; GBool embedBackgroundImage; GBool embedFonts; - GBool includeMetadata; PDFDoc *doc; TextOutputDev *textOut; @@ -119,10 +107,6 @@ private: GList *formFieldInfo; // [HTMLGenFormFieldInfo] int nextFieldID; - int nVisibleChars; // number of visible chars on the page - int nInvisibleChars; // number of invisible chars on the page - int nRemovedDupChars; // number of duplicate chars removed - GBool ok; }; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.cc index 2c2db13fa4d..5a694d7b665 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -18,7 +22,6 @@ #include "config.h" #include "Error.h" #include "GfxState.h" -#include "Gfx.h" #include "Object.h" #include "Stream.h" #include "ImageOutputDev.h" @@ -49,8 +52,7 @@ void ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, double *mat, double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { - // draw the tile once, just in case it contains image(s) - gfx->drawForm(strRef, resDict, mat, bbox); + // do nothing -- this avoids the potentially slow loop in Gfx.cc } void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.h b/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.h index 0abe6f1bb55..5a72925aee9 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include <stdio.h> #include "gtypes.h" #include "OutputDev.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.cc index f00063e8ec2..3d10cb4acad 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include "gmempp.h" #include "Object.h" #include "Stream.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.h b/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.h index 8714b46a9ef..c0f773fb107 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.h @@ -13,6 +13,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" class Stream; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc index 8d71e17f96c..02450b4f816 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <limits.h> #include "gmempp.h" @@ -1794,11 +1798,6 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, break; } } - if (refAggNum <= 0 || refAggNum > 10000) { - error(errSyntaxError, getPos(), - "Invalid refinement/aggregation instance count in JBIG2 symbol dictionary"); - goto syntaxError; - } #if 0 //~ This special case was added about a year before the final draft //~ of the JBIG2 spec was released. I have encountered some old //~ JBIG2 images that predate it. @@ -2441,18 +2440,6 @@ JBIG2Bitmap *JBIG2Stream::readTextRegion(GBool huff, GBool refine, refDX = ((rdw >= 0) ? rdw : rdw - 1) / 2 + rdx; refDY = ((rdh >= 0) ? rdh : rdh - 1) / 2 + rdy; - if (rdw > INT_MAX - syms[symID]->getWidth() || - rdh > INT_MAX - syms[symID]->getHeight()) { - error(errSyntaxError, getPos(), - "Invalid refinement size in JBIG2 text region"); - continue; - } - // sanity check - if (rdw > 1000 || rdh > 1000) { - error(errSyntaxError, getPos(), - "Invalid refinement size in JBIG2 text region"); - continue; - } symbolBitmap = readGenericRefinementRegion(rdw + syms[symID]->getWidth(), rdh + syms[symID]->getHeight(), @@ -2540,8 +2527,7 @@ void JBIG2Stream::readPatternDictSeg(Guint segNum, Guint length) { !readULong(&grayMax)) { goto eofError; } - if (patternW == 0 || patternH == 0 || - grayMax > UINT_MAX / patternW - 1) { + if (patternW == 0 || patternH == 0) { error(errSyntaxError, getPos(), "Bad size in JBIG2 pattern dictionary segment"); return; @@ -3962,9 +3948,7 @@ void JBIG2Stream::readPageInfoSeg(Guint length) { !readUByte(&flags) || !readUWord(&striping)) { goto eofError; } - if (pageW == 0 || pageH == 0 || - pageW > INT_MAX || pageH > INT_MAX || - pageH > INT_MAX / pageW) { + if (pageW == 0 || pageH == 0 || pageW > INT_MAX / pageW) { error(errSyntaxError, getPos(), "Bad page size in JBIG2 stream"); return; } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.h b/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.h index 4964255bbf7..bb44ba1ab01 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "Object.h" #include "Stream.h" @@ -41,7 +45,6 @@ public: virtual GString *getPSFilter(int psLevel, const char *indent, GBool okToReadStream); virtual GBool isBinary(GBool last = gTrue); - virtual GBool hasStrongCompression() { return gTrue; } private: diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc index 5ed1890a1d3..a1f7395dd57 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <limits.h> #include "gmem.h" #include "gmempp.h" @@ -1113,7 +1117,6 @@ JPXDecodeResult JPXStream::readCodestream(Guint len) { "JPX COC marker segment before COD segment"); return jpxDecodeFatalError; } - comp = 0; if ((img.nComps > 256 && !readUWord(&comp)) || (img.nComps <= 256 && !readUByte(&comp)) || comp >= img.nComps || @@ -1266,7 +1269,6 @@ JPXDecodeResult JPXStream::readCodestream(Guint len) { "JPX QCC marker segment before QCD segment"); return jpxDecodeFatalError; } - comp = 0; if ((img.nComps > 256 && !readUWord(&comp)) || (img.nComps <= 256 && !readUByte(&comp)) || comp >= img.nComps || @@ -1639,7 +1641,6 @@ GBool JPXStream::readTilePart() { error(errSyntaxError, getPos(), "Extraneous JPX COC marker segment"); return gFalse; } - comp = 0; if ((img.nComps > 256 && !readUWord(&comp)) || (img.nComps <= 256 && !readUByte(&comp)) || comp >= img.nComps || @@ -1773,7 +1774,6 @@ GBool JPXStream::readTilePart() { error(errSyntaxError, getPos(), "Extraneous JPX QCC marker segment"); return gFalse; } - comp = 0; if ((img.nComps > 256 && !readUWord(&comp)) || (img.nComps <= 256 && !readUByte(&comp)) || comp >= img.nComps || @@ -2619,12 +2619,7 @@ GBool JPXStream::readCodeBlockData(JPXTileComp *tileComp, if (cb->arithDecoder) { cover(63); - if (tileComp->codeBlockStyle & 0x04) { - cb->arithDecoder->setStream(bufStr, cb->dataLen[0]); - cb->arithDecoder->start(); - } else { - cb->arithDecoder->restart(cb->dataLen[0]); - } + cb->arithDecoder->restart(cb->dataLen[0]); } else { cover(64); cb->arithDecoder = new JArithmeticDecoder(); @@ -3324,7 +3319,7 @@ void JPXStream::inverseTransform1D(JPXTileComp *tileComp, int *data, // converts fixed point samples back to integers. GBool JPXStream::inverseMultiCompAndDC(JPXTile *tile) { JPXTileComp *tileComp; - int coeff, d0, d1, d2, t, minVal, maxVal, zeroVal, shift, rounding; + int coeff, d0, d1, d2, t, minVal, maxVal, zeroVal; int *dataPtr; Guint j, comp, x, y; @@ -3409,14 +3404,12 @@ GBool JPXStream::inverseMultiCompAndDC(JPXTile *tile) { maxVal = (1 << tileComp->prec) - 1; zeroVal = 1 << (tileComp->prec - 1); dataPtr = tileComp->data; - shift = fracBits - tileComp->prec; - rounding = 1 << (shift - 1); for (y = 0; y < tileComp->h; ++y) { for (x = 0; x < tileComp->w; ++x) { coeff = *dataPtr; if (tileComp->transform == 0) { cover(112); - coeff = (coeff + rounding) >> shift; + coeff >>= fracBits - tileComp->prec; } coeff += zeroVal; if (coeff < 0) { diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.h b/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.h index ce12427ced9..4b8587b0fb2 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "Object.h" #include "Stream.h" @@ -287,7 +291,6 @@ public: virtual GString *getPSFilter(int psLevel, const char *indent, GBool okToReadStream); virtual GBool isBinary(GBool last = gTrue); - virtual GBool hasStrongCompression() { return gTrue; } virtual void getImageParams(int *bitsPerComponent, StreamColorSpaceMode *csMode); void reduceResolution(int reductionA) { reduction = reductionA; } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc index d1066d33837..0c74dbb04ea 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <stddef.h> #include <string.h> @@ -109,7 +113,7 @@ Object *Lexer::getObj(Object *obj) { char *p; int c, c2; GBool comment, neg, doubleMinus, done, invalid; - int numParen, nErrors; + int numParen; int xi; double xf, scale; GString *s; @@ -430,8 +434,7 @@ Object *Lexer::getObj(Object *obj) { m = n = 0; c2 = 0; s = NULL; - nErrors = 0; - while (nErrors < 100) { + while (1) { c = getChar(); if (c == '>') { break; @@ -440,17 +443,15 @@ Object *Lexer::getObj(Object *obj) { break; } else if (specialChars[c] != 1) { c2 = c2 << 4; - if (c >= '0' && c <= '9') { + if (c >= '0' && c <= '9') c2 += c - '0'; - } else if (c >= 'A' && c <= 'F') { + else if (c >= 'A' && c <= 'F') c2 += c - 'A' + 10; - } else if (c >= 'a' && c <= 'f') { + else if (c >= 'a' && c <= 'f') c2 += c - 'a' + 10; - } else { + else error(errSyntaxError, getPos(), "Illegal character <{0:02x}> in hex string", c); - ++nErrors; - } if (++m == 2) { if (n == tokBufSize) { if (!s) diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.h index 458a5851584..d481c2c5a2b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "Object.h" #include "Stream.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Link.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Link.cc index 60f20867338..900f79ddf85 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Link.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Link.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stddef.h> #include <string.h> #include "gmem.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Link.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Link.h index d6155447e92..480496ad176 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Link.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Link.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "Object.h" class GString; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/NameToCharCode.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/NameToCharCode.cc index 0088986d2f0..f846d8e940d 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/NameToCharCode.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/NameToCharCode.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <string.h> #include "gmem.h" #include "gmempp.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/NameToCharCode.h b/Build/source/libs/xpdf/xpdf-src/xpdf/NameToCharCode.h index cf2170bfd46..6548133cdcd 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/NameToCharCode.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/NameToCharCode.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "CharTypes.h" struct NameToCharCodeEntry; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Object.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Object.cc index dbb785868c8..898fbc99e2b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Object.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Object.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stddef.h> #include "gmempp.h" #include "Object.h" @@ -38,7 +42,7 @@ const char *objTypeNames[numObjTypes] = { "none" }; -#ifdef DEBUG_OBJECT_MEM +#ifdef DEBUG_MEM #if MULTITHREADED GAtomicCounter Object::numAlloc[numObjTypes] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -46,7 +50,7 @@ GAtomicCounter Object::numAlloc[numObjTypes] = long Object::numAlloc[numObjTypes] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; #endif -#endif // DEBUG_OBJECT_MEM +#endif // DEBUG_MEM Object *Object::initArray(XRef *xref) { initObj(objArray); @@ -97,7 +101,7 @@ Object *Object::copy(Object *obj) { default: break; } -#ifdef DEBUG_OBJECT_MEM +#ifdef DEBUG_MEM #if MULTITHREADED gAtomicIncrement(&numAlloc[type]); #else @@ -139,7 +143,7 @@ void Object::free() { default: break; } -#ifdef DEBUG_OBJECT_MEM +#ifdef DEBUG_MEM #if MULTITHREADED gAtomicDecrement(&numAlloc[type]); #else @@ -221,7 +225,7 @@ void Object::print(FILE *f) { } void Object::memCheck(FILE *f) { -#ifdef DEBUG_OBJECT_MEM +#ifdef DEBUG_MEM int i; long t; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Object.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Object.h index 17c082041b7..cb636510149 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Object.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Object.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include <stdio.h> #include <string.h> #include "gtypes.h" @@ -67,7 +71,7 @@ enum ObjType { // Object //------------------------------------------------------------------------ -#ifdef DEBUG_OBJECT_MEM +#ifdef DEBUG_MEM # if MULTITHREADED # define initObj(t) gAtomicIncrement(&numAlloc[type = t]) # else @@ -212,7 +216,7 @@ private: char *cmd; // command }; -#ifdef DEBUG_OBJECT_MEM +#ifdef DEBUG_MEM #if MULTITHREADED static GAtomicCounter // number of each type of object numAlloc[numObjTypes]; // currently allocated diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.cc index 501ad2d1220..a0fbb1b06c2 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include "gmempp.h" #include "GString.h" #include "GList.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.h b/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.h index f4eb1e95cb7..f00ef296a0c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "Object.h" #include "CharTypes.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Outline.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Outline.cc index 09e3b754bef..9593956f8d0 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Outline.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Outline.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include "gmem.h" #include "gmempp.h" #include "GString.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Outline.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Outline.h index 80943ab8be9..e9bce83cdad 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Outline.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Outline.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "Object.h" #include "CharTypes.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.cc index 93dc1bc1273..f2be88edfdc 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stddef.h> #include "gmempp.h" #include "Object.h" @@ -72,15 +76,6 @@ void OutputDev::updateAll(GfxState *state) { updateFont(state); } -void OutputDev::fillStroke(GfxState *state, GBool eo) { - if (eo) { - eoFill(state); - } else { - fill(state); - } - stroke(state); -} - GBool OutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h b/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h index 0b31d14a50c..54483cfcc43 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "CharTypes.h" @@ -95,10 +99,6 @@ public: // End a page. virtual void endPage() {} - // Start/end a sub-page stream (Form XObject, annotation). - virtual void startStream(Ref streamRef, GfxState *state) {} - virtual void endStream(Ref streamRef) {} - //----- coordinate conversion // Convert between device and user coordinates. @@ -147,12 +147,13 @@ public: virtual void updateHorizScaling(GfxState *state) {} virtual void updateTextPos(GfxState *state) {} virtual void updateTextShift(GfxState *state, double shift) {} + virtual void saveTextPos(GfxState *state) {} + virtual void restoreTextPos(GfxState *state) {} //----- path painting virtual void stroke(GfxState *state) {} virtual void fill(GfxState *state) {} virtual void eoFill(GfxState *state) {} - virtual void fillStroke(GfxState *state, GBool eo); virtual void tilingPatternFill(GfxState *state, Gfx *gfx, Object *strRef, int paintType, int tilingType, Dict *resDict, double *mat, double *bbox, @@ -174,17 +175,8 @@ public: virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen, - GBool fill, GBool stroke, GBool makePath) {} - virtual void drawString(GfxState *state, GString *s, - GBool fill, GBool stroke, GBool makePath) {} - virtual void fillTextPath(GfxState *state) {} - virtual void strokeTextPath(GfxState *state) {} - virtual void clipToTextPath(GfxState *state) {} - virtual void clipToTextStrokePath(GfxState *state) {} - virtual void clearTextPath(GfxState *state) {} - virtual void addTextPathToSavedClipPath(GfxState *state) {} - virtual void clipToSavedClipPath(GfxState *state) {} + CharCode code, int nBytes, Unicode *u, int uLen) {} + virtual void drawString(GfxState *state, GString *s) {} virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen); @@ -250,10 +242,6 @@ public: //----- links virtual void processLink(Link *link) {} - //----- structure tree - virtual void beginStructureItem(const char *tag, int mcid, Dict *dict) {} - virtual void endStructureItem() {} - private: double defCTM[6]; // default coordinate transform matrix diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.cc index bb273b6161d..0dd35ee4902 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <math.h> #include "gtypes.h" #include "GString.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h b/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h index c86f1df4508..8166865280b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + class GString; // Draw a PDF417 barcode: diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc index baf2353de1c..b833d5dabf0 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <math.h> #include "gmempp.h" #include "GString.h" @@ -43,6 +47,9 @@ PDFCore::PDFCore(SplashColorMode colorMode, int bitmapRowPad, linksPage = 0; links = NULL; + annotsPage = 0; + annots = NULL; + textPage = 0; textDPI = 0; textRotate = 0; @@ -109,7 +116,6 @@ PDFCore::~PDFCore() { delete state; clearPage(); if (doc) { - aboutToDeleteDoc(); delete doc; } for (i = 0; i < pdfHistorySize; ++i) { @@ -195,7 +201,6 @@ int PDFCore::loadFile2(PDFDoc *newDoc) { // NB: do not delete doc until after DisplayState::setDoc() returns state->setDoc(newDoc); if (doc) { - aboutToDeleteDoc(); delete doc; } doc = newDoc; @@ -214,7 +219,6 @@ void PDFCore::clear() { // no document // NB: do not delete doc until after DisplayState::setDoc() returns state->setDoc(NULL); - aboutToDeleteDoc(); delete doc; doc = NULL; clearPage(); @@ -296,8 +300,6 @@ void PDFCore::displayDest(LinkDest *dest) { page = 1; } - GBool changeZoom = globalParams->getAllowLinksToChangeZoom(); - switch (dest->getKind()) { case destXYZ: cvtUserToDev(page, dest->getLeft(), dest->getTop(), &dx, &dy); @@ -315,9 +317,7 @@ void PDFCore::displayDest(LinkDest *dest) { break; case destFit: case destFitB: - if (changeZoom) { - state->setZoom(zoomPage); - } + state->setZoom(zoomPage); scrollX = tileMap->getPageLeftX(page); scrollY = tileMap->getPageTopY(page); startUpdate(); @@ -326,9 +326,7 @@ void PDFCore::displayDest(LinkDest *dest) { break; case destFitH: case destFitBH: - if (changeZoom) { - state->setZoom(zoomWidth); - } + state->setZoom(zoomWidth); scrollX = tileMap->getPageLeftX(page); scrollY = tileMap->getPageTopY(page); if (dest->getChangeTop()) { @@ -341,9 +339,7 @@ void PDFCore::displayDest(LinkDest *dest) { break; case destFitV: case destFitBV: - if (changeZoom) { - state->setZoom(zoomHeight); - } + state->setZoom(zoomHeight); scrollX = tileMap->getPageLeftX(page); scrollY = tileMap->getPageTopY(page); if (dest->getChangeTop()) { @@ -355,13 +351,8 @@ void PDFCore::displayDest(LinkDest *dest) { finishUpdate(gTrue, gTrue); break; case destFitR: - if (changeZoom) { - zoomToRect(page, dest->getLeft(), dest->getTop(), - dest->getRight(), dest->getBottom()); - } else { - scrollToCentered(page, 0.5 * (dest->getLeft() + dest->getRight()), - 0.5 * (dest->getTop(), dest->getBottom())); - } + zoomToRect(page, dest->getLeft(), dest->getTop(), + dest->getRight(), dest->getBottom()); break; } } @@ -435,16 +426,9 @@ void PDFCore::finishUpdate(GBool addToHist, GBool checkForChangedFile) { // tileDone or tick (incremental update) to avoid "flashing" the // screen (drawing a blank background, followed by the actual // content slightly later) - // - this postponement actually causes flickering in certain cases - // (the Qt QML backend) -- don't do it if alwaysInvalidateOnUpdate() - // returns true - if (alwaysInvalidateOnUpdate()) { + getWindowBitmap(gTrue); + if (bitmapFinished) { invalidateWholeWindow(); - } else { - getWindowBitmap(gTrue); - if (bitmapFinished) { - invalidateWholeWindow(); - } } updateScrollbars(); @@ -1653,50 +1637,6 @@ GList *PDFCore::findAll(Unicode *u, int len, GBool caseSensitive, return results; } -GList *AsyncFindAll::run(PDFDoc *doc, Unicode *u, int len, GBool caseSensitive, - GBool wholeWord, int firstPage, int lastPage) { - GList *results = new GList(); - - TextOutputDev *textOut = new TextOutputDev(NULL, &core->textOutCtrl, gFalse); - if (!textOut->isOk()) { - delete textOut; - return results; - } - - for (int pg = firstPage; pg <= lastPage && !canceled; ++pg) { - doc->displayPage(textOut, pg, 72, 72, 0, gFalse, gTrue, gFalse); - GBool first = gTrue; - while (!canceled) { - double xMin, yMin, xMax, yMax; - if (!textOut->findText(u, len, first, gTrue, !first, gFalse, - caseSensitive, gFalse, wholeWord, - &xMin, &yMin, &xMax, &yMax)) { - break; - } - double uxMin, uyMin, uxMax, uyMax, t; - textOut->cvtDevToUser(xMin, yMin, &uxMin, &uyMin); - textOut->cvtDevToUser(xMax, yMax, &uxMax, &uyMax); - if (uxMin > uxMax) { - t = uxMin; uxMin = uxMax; uxMax = t; - } - if (uyMin > uyMax) { - t = uyMin; uyMin = uyMax; uyMax = t; - } - results->append(new FindResult(pg, uxMin, uyMin, uxMax, uyMax)); - first = gFalse; - } - } - - delete textOut; - - if (canceled) { - deleteGList(results, FindResult); - return NULL; - } - - return results; -} - GBool PDFCore::cvtWindowToUser(int xw, int yw, int *pg, double *xu, double *yu) { @@ -1811,11 +1751,23 @@ LinkAction *PDFCore::findLink(int pg, double x, double y) { } Annot *PDFCore::findAnnot(int pg, double x, double y) { - return doc->getAnnots()->find(pg, x, y); + loadAnnots(pg); + return annots->find(x, y); } int PDFCore::findAnnotIdx(int pg, double x, double y) { - return doc->getAnnots()->findIdx(pg, x, y); + loadAnnots(pg); + return annots->findIdx(x, y); +} + +Annot *PDFCore::getAnnot(int idx) { + if (!annots) { + return NULL; + } + if (idx < 0 || idx >= annots->getNumAnnots()) { + return NULL; + } + return annots->getAnnot(idx); } AcroFormField *PDFCore::findFormField(int pg, double x, double y) { @@ -1864,8 +1816,7 @@ void PDFCore::setWindowSize(int winWidth, int winHeight) { startUpdate(); - page = wx0 = wy0 = 0; // make gcc happy - ux = uy = 0; + wx0 = wy0 = 0; // make gcc happy doScroll = gFalse; if (state->getZoom() < 0 && state->displayModeIsContinuous()) { // save the user coordinates of the appropriate edge of the window @@ -1928,6 +1879,12 @@ void PDFCore::clearPage() { links = NULL; linksPage = 0; + if (annots) { + delete annots; + } + annots = NULL; + annotsPage = 0; + if (text) { delete text; } @@ -1949,6 +1906,22 @@ void PDFCore::loadLinks(int pg) { linksPage = pg; } +// Load the annotations for <pg>. +void PDFCore::loadAnnots(int pg) { + Object annotsObj; + + if (annots && annotsPage == pg) { + return; + } + if (annots) { + delete annots; + } + doc->getCatalog()->getPage(pg)->getAnnots(&annotsObj); + annots = new Annots(doc, &annotsObj); + annotsObj.free(); + annotsPage = pg; +} + // Extract text from <pg>. void PDFCore::loadText(int pg) { TextOutputDev *textOut; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h index 56ecd958c21..accf19d82ef 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h @@ -11,10 +11,11 @@ #include <aconf.h> -#include <stdlib.h> -#ifndef PDF_PARSER_ONLY -#include <atomic> +#ifdef USE_GCC_PRAGMAS +#pragma interface #endif + +#include <stdlib.h> #include "SplashTypes.h" #include "CharTypes.h" #include "DisplayState.h" @@ -30,6 +31,7 @@ class Links; class LinkDest; class LinkAction; class Annot; +class Annots; class AcroFormField; class TextPage; class HighlightFile; @@ -75,34 +77,6 @@ struct FindResult { }; //------------------------------------------------------------------------ -// AsyncFindAll -//------------------------------------------------------------------------ -#ifndef PDF_PARSER_ONLY -class AsyncFindAll { -public: - - AsyncFindAll(PDFCore *coreA): core(coreA), canceled(gFalse) {} - - void reset() { canceled = false; } - - // Run the search, returning a list of FindResults -- same as - // PDFCore::findAll(). This can be run on a separate thread. If - // cancel() is called while the search is running, this function - // returns null. - GList *run(PDFDoc *doc, Unicode *u, int len, GBool caseSensitive, - GBool wholeWord, int firstPage, int lastPage); - - // Cancel a running search, causing run() to return null. - void cancel() { canceled = true; } - -private: - - PDFCore *core; - std::atomic<bool> canceled; -}; -#endif - -//------------------------------------------------------------------------ // PDFCore //------------------------------------------------------------------------ @@ -282,6 +256,7 @@ public: LinkAction *findLink(int pg, double x, double y); Annot *findAnnot(int pg, double x, double y); int findAnnotIdx(int pg, double x, double y); + Annot *getAnnot(int idx); AcroFormField *findFormField(int pg, double x, double y); int findFormFieldIdx(int pg, double x, double y); AcroFormField *getFormField(int idx); @@ -313,11 +288,6 @@ protected: //--- callbacks to PDFCore subclass - // Subclasses can return true here to force PDFCore::finishUpdate() - // to always invalidate the window. This is necessary to avoid - // flickering on some backends. - virtual GBool alwaysInvalidateOnUpdate() { return gFalse; } - // Invalidate the specified rectangle (in window coordinates). virtual void invalidate(int x, int y, int w, int h) = 0; @@ -334,17 +304,13 @@ protected: // This is called just after a PDF file is loaded. virtual void postLoad() {} - // This is called just before deleting the PDFDoc. The PDFCore - // subclass must shut down any secondary threads that are using the - // PDFDoc pointer. - virtual void aboutToDeleteDoc() {} - //--- internal int loadFile2(PDFDoc *newDoc); void addToHistory(); void clearPage(); void loadLinks(int pg); + void loadAnnots(int pg); void loadText(int pg); void getSelectionBBox(int *wxMin, int *wyMin, int *wxMax, int *wyMax); void getSelectRectListBBox(GList *rects, int *wxMin, int *wyMin, @@ -352,13 +318,14 @@ protected: void checkInvalidate(int x, int y, int w, int h); void invalidateWholeWindow(); - friend class AsyncFindAll; - PDFDoc *doc; int linksPage; // cached links for one page Links *links; + int annotsPage; // cached annotations for one page + Annots *annots; + int textPage; // cached extracted text for one page double textDPI; int textRotate; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc index 7030904214f..a6663ea4222 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -22,7 +26,6 @@ #include "GlobalParams.h" #include "Page.h" #include "Catalog.h" -#include "Annot.h" #include "Stream.h" #include "XRef.h" #include "Link.h" @@ -175,7 +178,6 @@ PDFDoc::PDFDoc(char *fileNameA, GString *ownerPassword, int i, j; #endif #endif /* 0 */ - init(coreA); fileName = new GString(fileNameA); @@ -202,7 +204,7 @@ PDFDoc::PDFDoc(char *fileNameA, GString *ownerPassword, file = _wfopen(fileNameU, wfopenReadMode); } else { #endif /* 0 */ - file = fopen(fileName->getCString(), fopenReadMode); + file = fopen(fileName->getCString(), fopenReadMode); #if 0 } #endif /* 0 */ @@ -261,7 +263,6 @@ void PDFDoc::init(PDFCore *coreA) { str = NULL; xref = NULL; catalog = NULL; - annots = NULL; #ifndef DISABLE_OUTLINE outline = NULL; #endif @@ -334,9 +335,6 @@ GBool PDFDoc::setup2(GString *ownerPassword, GString *userPassword, return gFalse; } - // initialize the Annots object - annots = new Annots(this); - return gTrue; } @@ -349,9 +347,6 @@ PDFDoc::~PDFDoc() { delete outline; } #endif - if (annots) { - delete annots; - } if (catalog) { delete catalog; } @@ -490,7 +485,6 @@ void PDFDoc::displayPageSlice(OutputDev *out, int page, abortCheckCbk, abortCheckCbkData); } - Links *PDFDoc::getLinks(int page) { return catalog->getPage(page)->getLinks(); } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h index 3c1c71c41ed..2b8eba2cba7 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include <stdio.h> #include "XRef.h" #include "Catalog.h" @@ -19,7 +23,6 @@ class GString; class BaseStream; class OutputDev; -class Annots; class Links; class LinkAction; class LinkDest; @@ -71,9 +74,6 @@ public: // Get catalog. Catalog *getCatalog() { return catalog; } - // Get annotations. - Annots *getAnnots() { return annots; } - // Get base stream. BaseStream *getBaseStream() { return str; } @@ -121,7 +121,6 @@ public: GBool (*abortCheckCbk)(void *data) = NULL, void *abortCheckCbkData = NULL); - // Find a page, given its object ID. Returns page number, or 0 if // not found. int findPage(int num, int gen) { return catalog->findPage(num, gen); } @@ -196,9 +195,6 @@ public: #endif char *getEmbeddedFileMem(int idx, int *size); - // Return true if the document uses JavaScript. - GBool usesJavaScript() { return catalog->usesJavaScript(); } - private: @@ -220,7 +216,6 @@ private: double pdfVersion; XRef *xref; Catalog *catalog; - Annots *annots; #ifndef DISABLE_OUTLINE Outline *outline; #endif diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc index 4cb4304e172..b9fff4ffaed 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stddef.h> #include <stdarg.h> @@ -104,8 +108,7 @@ static const char *prolog[] = { "/pdfOpNames [", " /pdfFill /pdfStroke /pdfLastFill /pdfLastStroke", " /pdfTextMat /pdfFontSize /pdfCharSpacing /pdfTextRender", - " /pdfTextRise /pdfWordSpacing /pdfHorizScaling /pdfTextPath", - " /pdfTextClipPath", + " /pdfTextRise /pdfWordSpacing /pdfHorizScaling /pdfTextClipPath", "] def", "~123ngs", "/pdfStartPage {", @@ -142,7 +145,6 @@ static const char *prolog[] = { " /pdfTextRise 0 def", " /pdfWordSpacing 0 def", " /pdfHorizScaling 1 def", - " /pdfTextPath [] def", " /pdfTextClipPath [] def", "} def", "/pdfEndPage { end } def", @@ -473,34 +475,32 @@ static const char *prolog[] = { "/Tj {", " fCol", // because stringwidth has to draw Type 3 chars " 0 pdfTextRise pdfTextMat dtransform rmoveto", - " xyshow2", - " 0 pdfTextRise neg pdfTextMat dtransform rmoveto", - "} def", - "/TjS {", - " fCol", // because stringwidth has to draw Type 3 chars - " 0 pdfTextRise pdfTextMat dtransform rmoveto", - " currentfont /FontType get 3 eq { fCol } { sCol } ifelse", - " xycp currentpoint stroke moveto", - " 0 pdfTextRise neg pdfTextMat dtransform rmoveto", - "} def", - "/TjFS {", - " 2 copy currentpoint 4 2 roll Tj moveto TjS", - "} def", - "/TjSave {", - " fCol", // because stringwidth has to draw Type 3 chars - " 0 pdfTextRise pdfTextMat dtransform rmoveto", - " xycp", - " /pdfTextPath [ pdfTextPath aload pop", - " {/moveto cvx}", - " {/lineto cvx}", - " {/curveto cvx}", - " {/closepath cvx}", - " pathforall ] def", - " currentpoint newpath moveto", + " currentpoint 4 2 roll", + " pdfTextRender 1 and 0 eq {", + " 2 copy xyshow2", + " } if", + " pdfTextRender 3 and dup 1 eq exch 2 eq or {", + " 3 index 3 index moveto", + " 2 copy", + " currentfont /FontType get 3 eq { fCol } { sCol } ifelse", + " xycp currentpoint stroke moveto", + " } if", + " pdfTextRender 4 and 0 ne {", + " 4 2 roll moveto xycp", + " /pdfTextClipPath [ pdfTextClipPath aload pop", + " {/moveto cvx}", + " {/lineto cvx}", + " {/curveto cvx}", + " {/closepath cvx}", + " pathforall ] def", + " currentpoint newpath moveto", + " } {", + " pop pop pop pop", + " } ifelse", " 0 pdfTextRise neg pdfTextMat dtransform rmoveto", "} def", "/Tj3 {", - " pdfTextRender 3 and 3 ne {", + " pdfTextRender 3 and 3 ne {" " fCol", // because stringwidth has to draw Type 3 chars " 0 pdfTextRise pdfTextMat dtransform rmoveto", " xyshow2", @@ -513,18 +513,8 @@ static const char *prolog[] = { " pdfTextMat dtransform rmoveto } def", "/TJmV { 0.001 mul pdfFontSize mul neg 0 exch", " pdfTextMat dtransform rmoveto } def", - "/Tfill { fCol pdfTextPath cvx exec fill } def", - "/Tstroke { sCol pdfTextPath cvx exec stroke } def", - "/Tclip { pdfTextPath cvx exec clip newpath } def", - "/Tstrokeclip { pdfTextPath cvx exec strokepath clip newpath } def", - "/Tclear { /pdfTextPath [] def } def", - "/Tsave {", - " /pdfTextClipPath [ pdfTextClipPath aload pop pdfTextPath aload pop ] def", - "} def", - "/Tclip2 {", - " pdfTextClipPath cvx exec clip newpath", - " /pdfTextClipPath [] def", - "} def", + "/Tclip { pdfTextClipPath cvx exec clip newpath", + " /pdfTextClipPath [] def } def", "~1ns", "% Level 1 image operators", "~1n", @@ -1319,8 +1309,7 @@ PSOutputDev::PSOutputDev(char *fileName, PDFDoc *docA, paperSizes = NULL; embFontList = NULL; customColors = NULL; - haveSavedTextPath = gFalse; - haveSavedClipPath = gFalse; + haveTextClip = gFalse; t3String = NULL; // open file or pipe @@ -1387,8 +1376,7 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, paperSizes = NULL; embFontList = NULL; customColors = NULL; - haveSavedTextPath = gFalse; - haveSavedClipPath = gFalse; + haveTextClip = gFalse; t3String = NULL; init(outputFuncA, outputStreamA, psGeneric, @@ -1760,6 +1748,7 @@ void PSOutputDev::writeXpdfProcset() { void PSOutputDev::writeDocSetup(Catalog *catalog) { Page *page; Dict *resDict; + Annots *annots; AcroForm *form; Object obj1, obj2, obj3; GString *s; @@ -1785,7 +1774,6 @@ void PSOutputDev::writeDocSetup(Catalog *catalog) { } else { writePS("xpdf begin\n"); } - Annots *annots = doc->getAnnots(); needDefaultFont = gFalse; for (pg = firstPage; pg <= lastPage; ++pg) { if (rasterizePage[pg - firstPage]) { @@ -1795,12 +1783,13 @@ void PSOutputDev::writeDocSetup(Catalog *catalog) { if ((resDict = page->getResourceDict())) { setupResources(resDict); } - int nAnnots = annots->getNumAnnots(pg); - if (nAnnots > 0) { + annots = new Annots(doc, page->getAnnots(&obj1)); + obj1.free(); + if (annots->getNumAnnots()) { needDefaultFont = gTrue; } - for (i = 0; i < nAnnots; ++i) { - if (annots->getAnnot(pg, i)->getAppearance(&obj1)->isStream()) { + for (i = 0; i < annots->getNumAnnots(); ++i) { + if (annots->getAnnot(i)->getAppearance(&obj1)->isStream()) { obj1.streamGetDict()->lookup("Resources", &obj2); if (obj2.isDict()) { setupResources(obj2.getDict()); @@ -1809,6 +1798,7 @@ void PSOutputDev::writeDocSetup(Catalog *catalog) { } obj1.free(); } + delete annots; } if ((form = catalog->getForm())) { if (form->getNumFields() > 0) { @@ -2160,9 +2150,6 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { case fontType1: fi->ff = setupExternalType1Font(font, fontLoc->path); break; - case fontType1COT: - fi->ff = setupExternalOpenTypeT1CFont(font, fontLoc->path); - break; case fontTrueType: case fontTrueTypeOT: fi->ff = setupExternalTrueTypeFont(font, fontLoc->path, @@ -2586,48 +2573,6 @@ PSFontFileInfo *PSOutputDev::setupEmbeddedOpenTypeT1CFont(GfxFont *font, return ff; } -PSFontFileInfo *PSOutputDev::setupExternalOpenTypeT1CFont(GfxFont *font, - GString *fileName) { - GString *psName; - PSFontFileInfo *ff; - FoFiTrueType *ffTT; - - if (font->getName()) { - // check if font is already embedded - if ((ff = (PSFontFileInfo *)fontFileInfo->lookup(font->getName()))) { - return ff; - } - // this assumes that the PS font name matches the PDF font name - psName = font->getName()->copy(); - } else { - // generate name - psName = makePSFontName(font, font->getID()); - } - - // beginning comment - writePSFmt("%%BeginResource: font {0:t}\n", psName); - embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); - embFontList->append("\n"); - - // convert it to a Type 1 font - if ((ffTT = FoFiTrueType::load(fileName->getCString(), 0, gTrue))) { - if (ffTT->isOpenTypeCFF()) { - ffTT->convertToType1(psName->getCString(), NULL, gTrue, - outputFunc, outputStream); - } - delete ffTT; - } - - // ending comment - writePS("%%EndResource\n"); - - ff = new PSFontFileInfo(psName, font->getType(), psFontFileExternal); - ff->extFileName = fileName->copy(); - fontFileInfo->add(ff->psName, ff); - return ff; -} - PSFontFileInfo *PSOutputDev::setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id) { GString *psName; PSFontFileInfo *ff; @@ -3922,14 +3867,8 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask, } else { s = str->getPSFilter(level < psLevel3 ? 2 : 3, "", gTrue); if (s) { - if (globalParams->getPSLZW() && !str->hasStrongCompression()) { - useRLE = gFalse; - useLZW = gTrue; - useCompressed = gFalse; - } else { - useLZW = useRLE = gFalse; - useCompressed = gTrue; - } + useLZW = useRLE = gFalse; + useCompressed = gTrue; delete s; } else { if (globalParams->getPSLZW()) { @@ -4602,21 +4541,10 @@ void PSOutputDev::startPage(int pageNum, GfxState *state) { tx -= xScale * x1; ty -= yScale * y1; } - // offset or center + // center if (tx0 >= 0 && ty0 >= 0) { - if (rotate == 0) { - tx += tx0; - ty += ty0; - } else if (rotate == 90) { - tx += ty0; - ty += (imgWidth - yScale * height) - tx0; - } else if (rotate == 180) { - tx += (imgWidth - xScale * width) - tx0; - ty += (imgHeight - yScale * height) - ty0; - } else { // rotate == 270 - tx += (imgHeight - xScale * width) - ty0; - ty += tx0; - } + tx += (rotate == 0 || rotate == 180) ? tx0 : ty0; + ty += (rotate == 0 || rotate == 180) ? ty0 : -tx0; } else if (globalParams->getPSCenter()) { if (clipLLX0 < clipURX0 && clipLLY0 < clipURY0) { tx += (imgWidth2 - xScale * (clipURX0 - clipLLX0)) / 2; @@ -5175,6 +5103,16 @@ void PSOutputDev::updateTextShift(GfxState *state, double shift) { noStateChanges = gFalse; } +void PSOutputDev::saveTextPos(GfxState *state) { + writePS("currentpoint\n"); + noStateChanges = gFalse; +} + +void PSOutputDev::restoreTextPos(GfxState *state) { + writePS("m\n"); + noStateChanges = gFalse; +} + void PSOutputDev::stroke(GfxState *state) { doPath(state->getPath()); if (inType3Char && t3FillColorOnly) { @@ -5828,10 +5766,23 @@ void PSOutputDev::doPath(GfxPath *path) { } } -void PSOutputDev::drawString(GfxState *state, GString *s, - GBool fill, GBool stroke, GBool makePath) { +void PSOutputDev::drawString(GfxState *state, GString *s) { + GfxFont *font; + int wMode; + int *codeToGID; + GString *s2; + double dx, dy, originX, originY, originX0, originY0, tOriginX0, tOriginY0; + char *p; + PSFontInfo *fi; + UnicodeMap *uMap; + CharCode code; + Unicode u[8]; + char buf[8]; + double *dxdy; + int dxdySize, len, nChars, uLen, n, m, i, j; + // check for invisible text -- this is used by Acrobat Capture - if (!fill && !stroke && !makePath) { + if (state->getRender() == 3) { return; } @@ -5841,14 +5792,13 @@ void PSOutputDev::drawString(GfxState *state, GString *s, } // get the font - GfxFont *font = state->getFont(); - if (!font) { + if (!(font = state->getFont())) { return; } - int wMode = font->getWMode(); + wMode = font->getWMode(); - PSFontInfo *fi = NULL; - for (int i = 0; i < fontInfo->getLength(); ++i) { + fi = NULL; + for (i = 0; i < fontInfo->getLength(); ++i) { fi = (PSFontInfo *)fontInfo->get(i); if (fi->fontID.num == font->getID()->num && fi->fontID.gen == font->getID()->gen) { @@ -5858,8 +5808,8 @@ void PSOutputDev::drawString(GfxState *state, GString *s, } // check for a subtitute 16-bit font - UnicodeMap *uMap = NULL; - int *codeToGID = NULL; + uMap = NULL; + codeToGID = NULL; if (font->isCIDFont()) { if (!(fi && fi->ff)) { // font substitution failed, so don't output any text @@ -5877,21 +5827,17 @@ void PSOutputDev::drawString(GfxState *state, GString *s, } // compute the positioning (dx, dy) for each char in the string - int nChars = 0; - char *p = s->getCString(); - int len = s->getLength(); - GString *s2 = new GString(); - int dxdySize = font->isCIDFont() ? 8 : s->getLength(); - double *dxdy = (double *)gmallocn(2 * dxdySize, sizeof(double)); - double originX0 = 0, originY0 = 0; + nChars = 0; + p = s->getCString(); + len = s->getLength(); + s2 = new GString(); + dxdySize = font->isCIDFont() ? 8 : s->getLength(); + dxdy = (double *)gmallocn(2 * dxdySize, sizeof(double)); + originX0 = originY0 = 0; // make gcc happy while (len > 0) { - CharCode code; - Unicode u[8]; - int uLen; - double dx, dy, originX, originY; - int n = font->getNextChar(p, len, &code, - u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, - &dx, &dy, &originX, &originY); + n = font->getNextChar(p, len, &code, + u, (int)(sizeof(u) / sizeof(Unicode)), &uLen, + &dx, &dy, &originX, &originY); //~ this doesn't handle the case where the origin offset changes //~ within a string of characters -- which could be fixed by //~ modifying dx,dy as needed for each character @@ -5921,10 +5867,9 @@ void PSOutputDev::drawString(GfxState *state, GString *s, } while (nChars + uLen > dxdySize); dxdy = (double *)greallocn(dxdy, 2 * dxdySize, sizeof(double)); } - char buf[8]; - for (int i = 0; i < uLen; ++i) { - int m = uMap->mapUnicode(u[i], buf, (int)sizeof(buf)); - for (int j = 0; j < m; ++j) { + for (i = 0; i < uLen; ++i) { + m = uMap->mapUnicode(u[i], buf, (int)sizeof(buf)); + for (j = 0; j < m; ++j) { s2->append(buf[j]); } //~ this really needs to get the number of chars in the target @@ -5961,45 +5906,25 @@ void PSOutputDev::drawString(GfxState *state, GString *s, } originX0 *= state->getFontSize(); originY0 *= state->getFontSize(); - double tOriginX0, tOriginY0; state->textTransformDelta(originX0, originY0, &tOriginX0, &tOriginY0); if (nChars > 0) { if (wMode) { writePSFmt("{0:.6g} {1:.6g} rmoveto\n", -tOriginX0, -tOriginY0); } - writePSString(s2); writePS("\n["); - for (int i = 0; i < 2 * nChars; ++i) { + for (i = 0; i < 2 * nChars; ++i) { if (i > 0) { writePS("\n"); } writePSFmt("{0:.6g}", dxdy[i]); } - writePS("] "); - - // the possible operations are: - // - fill - // - stroke - // - fill + stroke - // - makePath - if (font->getType() == fontType3) { - writePS("Tj3\n"); + writePS("] Tj3\n"); } else { - if (fill && stroke) { - writePS("TjFS\n"); - } else if (fill) { - writePS("Tj\n"); - } else if (stroke) { - writePS("TjS\n"); - } else if (makePath) { - writePS("TjSave\n"); - haveSavedTextPath = gTrue; - } + writePS("] Tj\n"); } - if (wMode) { writePSFmt("{0:.6g} {1:.6g} rmoveto\n", tOriginX0, tOriginY0); } @@ -6007,49 +5932,19 @@ void PSOutputDev::drawString(GfxState *state, GString *s, gfree(dxdy); delete s2; - noStateChanges = gFalse; -} - -void PSOutputDev::fillTextPath(GfxState *state) { - writePS("Tfill\n"); -} - -void PSOutputDev::strokeTextPath(GfxState *state) { - writePS("Tstroke\n"); -} - -void PSOutputDev::clipToTextPath(GfxState *state) { - writePS("Tclip\n"); -} - -void PSOutputDev::clipToTextStrokePath(GfxState *state) { - writePS("Tstrokeclip\n"); -} - -void PSOutputDev::clearTextPath(GfxState *state) { - if (haveSavedTextPath) { - writePS("Tclear\n"); - haveSavedTextPath = gFalse; + if ((state->getRender() & 4) && font->getType() != fontType3) { + haveTextClip = gTrue; } -} -void PSOutputDev::addTextPathToSavedClipPath(GfxState *state) { - if (haveSavedTextPath) { - writePS("Tsave\n"); - haveSavedTextPath = gFalse; - haveSavedClipPath = gTrue; - } -} - -void PSOutputDev::clipToSavedClipPath(GfxState *state) { - if (!haveSavedClipPath) { - return; - } - writePS("Tclip2\n"); - haveSavedClipPath = gFalse; + noStateChanges = gFalse; } void PSOutputDev::endTextObject(GfxState *state) { + if (haveTextClip) { + writePS("Tclip\n"); + haveTextClip = gFalse; + noStateChanges = gFalse; + } } void PSOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, @@ -6501,11 +6396,6 @@ void PSOutputDev::doImageL2(Object *ref, GfxState *state, } useASCII = !(mode == psModeForm || inType3Char || preload); useCompressed = gFalse; - } else if (globalParams->getPSLZW() && !str->hasStrongCompression()) { - useRLE = gFalse; - useLZW = gTrue; - useASCII = !(mode == psModeForm || inType3Char || preload); - useCompressed = gFalse; } else { useLZW = useRLE = gFalse; useASCII = str->isBinary() && @@ -6979,11 +6869,6 @@ void PSOutputDev::doImageL3(Object *ref, GfxState *state, } maskUseASCII = !(mode == psModeForm || inType3Char || preload); maskUseCompressed = gFalse; - } else if (globalParams->getPSLZW() && !maskStr->hasStrongCompression()) { - maskUseRLE = gFalse; - maskUseLZW = gTrue; - maskUseASCII = !(mode == psModeForm || inType3Char || preload); - maskUseCompressed = gFalse; } else { maskUseLZW = maskUseRLE = gFalse; maskUseASCII = maskStr->isBinary() && @@ -7212,11 +7097,6 @@ void PSOutputDev::doImageL3(Object *ref, GfxState *state, } useASCII = !(mode == psModeForm || inType3Char || preload); useCompressed = gFalse; - } else if (globalParams->getPSLZW() && !str->hasStrongCompression()) { - useRLE = gFalse; - useLZW = gTrue; - useASCII = !(mode == psModeForm || inType3Char || preload); - useCompressed = gFalse; } else { useLZW = useRLE = gFalse; useASCII = str->isBinary() && diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h b/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h index 95908dbe675..b7223c6cdd8 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include <stddef.h> #include "config.h" #include "Object.h" @@ -195,6 +199,8 @@ public: virtual void updateHorizScaling(GfxState *state); virtual void updateTextPos(GfxState *state); virtual void updateTextShift(GfxState *state, double shift); + virtual void saveTextPos(GfxState *state); + virtual void restoreTextPos(GfxState *state); //----- path painting virtual void stroke(GfxState *state); @@ -213,15 +219,7 @@ public: virtual void clipToStrokePath(GfxState *state); //----- text drawing - virtual void drawString(GfxState *state, GString *s, - GBool fill, GBool stroke, GBool makePath); - virtual void fillTextPath(GfxState *state); - virtual void strokeTextPath(GfxState *state); - virtual void clipToTextPath(GfxState *state); - virtual void clipToTextStrokePath(GfxState *state); - virtual void clearTextPath(GfxState *state); - virtual void addTextPathToSavedClipPath(GfxState *state); - virtual void clipToSavedClipPath(GfxState *state); + virtual void drawString(GfxState *state, GString *s); virtual void endTextObject(GfxState *state); //----- image drawing @@ -297,8 +295,6 @@ private: PSFontFileInfo *setupExternalType1Font(GfxFont *font, GString *fileName); PSFontFileInfo *setupEmbeddedType1CFont(GfxFont *font, Ref *id); PSFontFileInfo *setupEmbeddedOpenTypeT1CFont(GfxFont *font, Ref *id); - PSFontFileInfo *setupExternalOpenTypeT1CFont(GfxFont *font, - GString *fileName); PSFontFileInfo *setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id); PSFontFileInfo *setupExternalTrueTypeFont(GfxFont *font, GString *fileName, int fontNum); @@ -493,11 +489,8 @@ private: PSOutCustomColor // used custom colors *customColors; - GBool haveSavedTextPath; // set if text has been drawn with the - // 'makePath' argument - GBool haveSavedClipPath; // set if the text path has been added - // to the saved clipping path (with - // addTextPathToSavedClipPath) + GBool haveTextClip; // set if text has been drawn with a + // clipping render mode GBool inType3Char; // inside a Type 3 CharProc GString *t3String; // Type 3 content string diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.cc index cb525f1be60..bbdb0ec44d5 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stdlib.h> #include "gmempp.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.h b/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.h index 3f3c8f4066d..4d5ee97f4dd 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" //------------------------------------------------------------------------ diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Page.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Page.cc index 322f07063e7..368bc68dd8a 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Page.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Page.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stddef.h> #include "gmempp.h" #include "Trace.h" @@ -377,6 +381,7 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI, PDFRectangle box; Gfx *gfx; Object obj; + Annots *annotList; AcroForm *form; int i; @@ -421,20 +426,21 @@ void Page::displaySlice(OutputDev *out, double hDPI, double vDPI, // draw (non-form) annotations if (globalParams->getDrawAnnotations()) { - Annots *annots2 = doc->getAnnots(); - annots2->generateAnnotAppearances(num); - int n = annots2->getNumAnnots(num); - if (n > 0) { + annotList = new Annots(doc, getAnnots(&obj)); + obj.free(); + annotList->generateAnnotAppearances(); + if (annotList->getNumAnnots() > 0) { if (globalParams->getPrintCommands()) { printf("***** Annotations\n"); } - for (i = 0; i < n; ++i) { + for (i = 0; i < annotList->getNumAnnots(); ++i) { if (abortCheckCbk && (*abortCheckCbk)(abortCheckCbkData)) { break; } - annots2->getAnnot(num, i)->draw(gfx, printing); + annotList->getAnnot(i)->draw(gfx, printing); } } + delete annotList; } // draw form fields @@ -546,4 +552,3 @@ void Page::getDefaultCTM(double *ctm, double hDPI, double vDPI, delete state; #endif } - diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Page.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Page.h index 0a862265d0f..fe579e7b3af 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Page.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Page.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "Object.h" class Dict; @@ -188,7 +192,6 @@ public: void getDefaultCTM(double *ctm, double hDPI, double vDPI, int rotate, GBool useMediaBox, GBool upsideDown); - private: PDFDoc *doc; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Parser.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Parser.cc index c594cf9413b..4fad6afae13 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Parser.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Parser.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stddef.h> #include <string.h> #include "gmempp.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Parser.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Parser.h index 6e175eb1cea..bfe5a52bdfc 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Parser.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Parser.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "Lexer.h" //------------------------------------------------------------------------ diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc index e844e49142f..29f26c00cee 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <math.h> #include "gmempp.h" #include "GlobalParams.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.h b/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.h index 703026ba19f..ee21e98b148 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "GfxState.h" #include "OutputDev.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc index 6f614496859..a61a84e8fa2 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include "gmempp.h" #include "GString.h" #include "PDFDoc.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.h b/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.h index 05e58cf64c3..63462339bff 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/SecurityHandler.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "Object.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.cc index b40c05d52e1..d8dc24e0fc6 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <math.h> #include "Trace.h" #include "GfxState.h" @@ -66,14 +70,6 @@ SplashBitmap *ShadingImage::generateBitmap(GfxState *state, } } -static double max4(double x0, double x1, double x2, double x3) { - double t = x0; - t = (x1 > t) ? x1 : t; - t = (x2 > t) ? x2 : t; - t = (x3 > t) ? x3 : t; - return t; -} - SplashBitmap *ShadingImage::generateFunctionBitmap(GfxState *state, GfxFunctionShading *shading, SplashColorMode mode, @@ -208,8 +204,7 @@ SplashBitmap *ShadingImage::generateAxialBitmap(GfxState *state, // compute the inverse CTM double *ctm = state->getCTM(); double det = ctm[0] * ctm[3] - ctm[1] * ctm[2]; - if (fabs(det) < 1e-10 * max4(fabs(ctm[0]), fabs(ctm[1]), - fabs(ctm[2]), fabs(ctm[3]))) { + if (fabs(det) < 0.000001) { return NULL; } det = 1 / det; @@ -473,8 +468,7 @@ SplashBitmap *ShadingImage::generateRadialBitmap(GfxState *state, // compute the inverse CTM double *ctm = state->getCTM(); double det = ctm[0] * ctm[3] - ctm[1] * ctm[2]; - if (fabs(det) < 1e-10 * max4(fabs(ctm[0]), fabs(ctm[1]), - fabs(ctm[2]), fabs(ctm[3]))) { + if (fabs(det) < 0.000001) { return NULL; } det = 1 / det; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.h b/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.h index 54f193a9c89..3bbff6922a4 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/ShadingImage.h @@ -13,6 +13,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "SplashTypes.h" class GfxState; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc index 581b804f3b0..d758e25b306 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <string.h> #include <math.h> #include <limits.h> @@ -594,8 +598,6 @@ struct SplashTransparencyGroup { SplashBitmap *tBitmap; // bitmap for transparency group GfxColorSpace *blendingColorSpace; GBool isolated; - GBool inSoftMask; // true if this, or any containing - // group, is a soft mask //----- modified region in tBitmap int modXMin, modYMin, modXMax, modYMax; @@ -652,8 +654,7 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, font = NULL; needFontUpdate = gFalse; - savedTextPath = NULL; - savedClipPath = NULL; + textClipPath = NULL; transpGroupStack = NULL; @@ -730,11 +731,8 @@ SplashOutputDev::~SplashOutputDev() { if (bitmap) { delete bitmap; } - if (savedTextPath) { - delete savedTextPath; - } - if (savedClipPath) { - delete savedClipPath; + if (textClipPath) { + delete textClipPath; } } @@ -1076,10 +1074,7 @@ void SplashOutputDev::setOverprintMask(GfxState *state, Guint mask; GfxCMYK cmyk; - // Adobe ignores overprint in soft masks. - if (overprintFlag && - !(transpGroupStack && transpGroupStack->inSoftMask) && - globalParams->getOverprintPreview()) { + if (overprintFlag && globalParams->getOverprintPreview()) { mask = colorSpace->getOverprintMask(); // The OPM (overprintMode) setting is only relevant when the color // space is DeviceCMYK or is "implicitly converted to DeviceCMYK". @@ -2223,24 +2218,27 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, CharCode code, int nBytes, - Unicode *u, int uLen, - GBool fill, GBool stroke, GBool makePath) { + Unicode *u, int uLen) { + SplashPath *path; + int render; + GBool doFill, doStroke, doClip; + SplashStrokeAdjustMode strokeAdjust; + double m[4]; + GBool horiz; + if (skipHorizText || skipRotatedText) { - double m[4]; state->getFontTransMat(&m[0], &m[1], &m[2], &m[3]); // this matches the 'diagonal' test in TextPage::updateFont() - GBool horiz = m[0] > 0 && fabs(m[1]) < 0.001 && - fabs(m[2]) < 0.001 && m[3] < 0; + horiz = m[0] > 0 && fabs(m[1]) < 0.001 && + fabs(m[2]) < 0.001 && m[3] < 0; if ((skipHorizText && horiz) || (skipRotatedText && !horiz)) { return; } } - fill = fill && !state->getFillColorSpace()->isNonMarking(); - stroke = stroke && !state->getStrokeColorSpace()->isNonMarking(); - // check for invisible text -- this is used by Acrobat Capture - if (!fill && !stroke && !makePath) { + render = state->getRender(); + if (render == 3) { return; } @@ -2254,8 +2252,13 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, x -= originX; y -= originY; - SplashPath *path = NULL; - if (stroke || makePath) { + doFill = !(render & 1) && !state->getFillColorSpace()->isNonMarking(); + doStroke = ((render & 3) == 1 || (render & 3) == 2) && + !state->getStrokeColorSpace()->isNonMarking(); + doClip = render & 4; + + path = NULL; + if (doStroke || doClip) { if ((path = font->getGlyphPath(code))) { path->offset((SplashCoord)x, (SplashCoord)y); } @@ -2264,19 +2267,14 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, // don't use stroke adjustment when stroking text -- the results // tend to be ugly (because characters with horizontal upper or // lower edges get misaligned relative to the other characters) - SplashStrokeAdjustMode savedStrokeAdjust = splashStrokeAdjustOff; - if (stroke) { - savedStrokeAdjust = splash->getStrokeAdjust(); + strokeAdjust = splashStrokeAdjustOff; // make gcc happy + if (doStroke) { + strokeAdjust = splash->getStrokeAdjust(); splash->setStrokeAdjust(splashStrokeAdjustOff); } - // the possible operations are: - // - fill - // - stroke - // - fill + stroke - // - makePath - - if (fill && stroke) { + // fill and stroke + if (doFill && doStroke) { if (path) { setOverprintMask(state, state->getFillColorSpace(), state->getFillOverprint(), state->getOverprintMode(), @@ -2288,33 +2286,37 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, splash->stroke(path); } - } else if (fill) { + // fill + } else if (doFill) { setOverprintMask(state, state->getFillColorSpace(), state->getFillOverprint(), state->getOverprintMode(), state->getFillColor()); splash->fillChar((SplashCoord)x, (SplashCoord)y, code, font); - } else if (stroke) { + // stroke + } else if (doStroke) { if (path) { setOverprintMask(state, state->getStrokeColorSpace(), state->getStrokeOverprint(), state->getOverprintMode(), state->getStrokeColor()); splash->stroke(path); } + } - } else if (makePath) { + // clip + if (doClip) { if (path) { - if (savedTextPath) { - savedTextPath->append(path); + if (textClipPath) { + textClipPath->append(path); } else { - savedTextPath = path; + textClipPath = path; path = NULL; } } } - if (stroke) { - splash->setStrokeAdjust(savedStrokeAdjust); + if (doStroke) { + splash->setStrokeAdjust(strokeAdjust); } if (path) { @@ -2322,73 +2324,6 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, } } -void SplashOutputDev::fillTextPath(GfxState *state) { - if (!savedTextPath) { - return; - } - setOverprintMask(state, state->getFillColorSpace(), - state->getFillOverprint(), state->getOverprintMode(), - state->getFillColor()); - splash->fill(savedTextPath, gFalse); -} - -void SplashOutputDev::strokeTextPath(GfxState *state) { - if (!savedTextPath) { - return; - } - setOverprintMask(state, state->getStrokeColorSpace(), - state->getStrokeOverprint(), state->getOverprintMode(), - state->getStrokeColor()); - splash->stroke(savedTextPath); -} - -void SplashOutputDev::clipToTextPath(GfxState *state) { - if (!savedTextPath) { - return; - } - splash->clipToPath(savedTextPath, gFalse); -} - -void SplashOutputDev::clipToTextStrokePath(GfxState *state) { - if (!savedTextPath) { - return; - } - SplashPath *path = splash->makeStrokePath(savedTextPath, - state->getLineWidth(), - state->getLineCap(), - state->getLineJoin()); - splash->clipToPath(path, gFalse); - delete path; -} - -void SplashOutputDev::clearTextPath(GfxState *state) { - if (savedTextPath) { - delete savedTextPath; - savedTextPath = NULL; - } -} - -void SplashOutputDev::addTextPathToSavedClipPath(GfxState *state) { - if (savedTextPath) { - if (savedClipPath) { - savedClipPath->append(savedTextPath); - delete savedTextPath; - } else { - savedClipPath = savedTextPath; - } - savedTextPath = NULL; - } -} - -void SplashOutputDev::clipToSavedClipPath(GfxState *state) { - if (!savedClipPath) { - return; - } - splash->clipToPath(savedClipPath, gFalse); - delete savedClipPath; - savedClipPath = NULL; -} - GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { @@ -2744,6 +2679,11 @@ void SplashOutputDev::drawType3Glyph(GfxState *state, T3FontCache *t3Font, } void SplashOutputDev::endTextObject(GfxState *state) { + if (textClipPath) { + splash->clipToPath(textClipPath, gFalse); + delete textClipPath; + textClipPath = NULL; + } } struct SplashOutImageMaskData { @@ -3915,7 +3855,7 @@ GBool SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, SplashBitmap *backdropBitmap; SplashColor color; double xMin, yMin, xMax, yMax, x, y; - int bw, bh, tx, ty, w, h, xx, yy, i; + int bw, bh, tx, ty, w, h, i; // transform the bbox state->transform(bbox[0], bbox[1], &x, &y); @@ -3988,23 +3928,21 @@ GBool SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, } else if (ty >= bh) { ty = bh - 1; } - xx = (int)ceil(xMax); - if (xx < tx) { - w = 1; - } else if (xx > bw - 1) { - // NB bw and tx are both non-negative, so 'bw - tx' can't overflow + w = (int)ceil(xMax) - tx + 1; + // NB bw and tx are both non-negative, so 'bw - tx' can't overflow + if (bw - tx < w) { w = bw - tx; - } else { - w = xx - tx + 1; } - yy = (int)ceil(yMax); - if (yy < ty) { - h = 1; - } else if (yy > bh - 1) { - // NB bh and ty are both non-negative, so 'bh - ty' can't overflow + if (w < 1) { + w = 1; + } + h = (int)ceil(yMax) - ty + 1; + // NB bh and ty are both non-negative, so 'bh - ty' can't overflow + if (bh - ty < h) { h = bh - ty; - } else { - h = yy - ty + 1; + } + if (h < 1) { + h = 1; } // optimization: a non-isolated group drawn with alpha=1 and @@ -4035,8 +3973,6 @@ GBool SplashOutputDev::beginTransparencyGroup(GfxState *state, double *bbox, transpGroup->ty = ty; transpGroup->blendingColorSpace = blendingColorSpace; transpGroup->isolated = isolated; - transpGroup->inSoftMask = (transpGroupStack && transpGroupStack->inSoftMask) - || forSoftMask; transpGroup->next = transpGroupStack; transpGroupStack = transpGroup; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h b/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h index d021d8922b0..5ec70e95509 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "SplashTypes.h" #include "config.h" @@ -125,15 +129,7 @@ public: virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode code, int nBytes, Unicode *u, int uLen, - GBool fill, GBool stroke, GBool makePath); - virtual void fillTextPath(GfxState *state); - virtual void strokeTextPath(GfxState *state); - virtual void clipToTextPath(GfxState *state); - virtual void clipToTextStrokePath(GfxState *state); - virtual void clearTextPath(GfxState *state); - virtual void addTextPathToSavedClipPath(GfxState *state); - virtual void clipToSavedClipPath(GfxState *state); + CharCode code, int nBytes, Unicode *u, int uLen); virtual GBool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen); @@ -310,8 +306,7 @@ private: SplashFont *font; // current font GBool needFontUpdate; // set when the font needs to be updated - SplashPath *savedTextPath; // path built for text string - SplashPath *savedClipPath; // clipping path built with text object + SplashPath *textClipPath; // clipping path built with text object SplashTransparencyGroup * // transparency group stack transpGroupStack; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc index 8387e55d0b0..383ac5478ff 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -2669,7 +2673,6 @@ DCTStream::DCTStream(Stream *strA, GBool colorXformA): frameBuf[i] = NULL; } rowBuf = NULL; - memset(quantTables, 0, sizeof(quantTables)); memset(dcHuffTables, 0, sizeof(dcHuffTables)); memset(acHuffTables, 0, sizeof(acHuffTables)); @@ -2891,7 +2894,7 @@ void DCTStream::prepare() { bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth; bufHeight = ((height + mcuHeight - 1) / mcuHeight) * mcuHeight; if (bufWidth <= 0 || bufHeight <= 0 || - bufWidth > INT_MAX / bufHeight / (int)sizeof(int)) { + bufWidth > INT_MAX / bufWidth / (int)sizeof(int)) { error(errSyntaxError, getPos(), "Invalid image size in DCT stream"); y = height; prepared = gTrue; @@ -2939,13 +2942,7 @@ void DCTStream::prepare() { // allocate a buffer for one row of MCUs bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth; - if (bufWidth <= 0 || bufWidth > INT_MAX / numComps / mcuHeight) { - error(errSyntaxError, getPos(), "Invalid image size in DCT stream"); - y = height; - prepared = gTrue; - return; - } - rowBuf = (Guchar *)gmallocn(bufWidth, numComps * mcuHeight); + rowBuf = (Guchar *)gmallocn(numComps * mcuHeight, bufWidth); rowBufPtr = rowBufEnd = rowBuf; // initialize counters @@ -3851,12 +3848,11 @@ int DCTStream::readBit() { } GBool DCTStream::readHeader(GBool frame) { - GBool haveSOF, doScan; + GBool doScan; int n, i; int c = 0; // read headers - haveSOF = gFalse; doScan = gFalse; while (!doScan) { c = readMarker(); @@ -3871,7 +3867,6 @@ GBool DCTStream::readHeader(GBool frame) { if (!readBaselineSOF()) { return gFalse; } - haveSOF = gTrue; break; case 0xc2: // SOF2 (progressive) if (!frame) { @@ -3882,7 +3877,6 @@ GBool DCTStream::readHeader(GBool frame) { if (!readProgressiveSOF()) { return gFalse; } - haveSOF = gTrue; break; case 0xc4: // DHT if (!readHuffmanTables()) { @@ -3899,10 +3893,6 @@ GBool DCTStream::readHeader(GBool frame) { case 0xd9: // EOI return gFalse; case 0xda: // SOS - if (frame && !haveSOF) { - error(errSyntaxError, getPos(), "Missing SOF in DCT stream"); - return gFalse; - } if (!readScanInfo()) { return gFalse; } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h index dc850151bc5..9d084c94895 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include <stdio.h> #if HAVE_JPEGLIB #include <jpeglib.h> @@ -126,10 +130,6 @@ public: // Does this stream type potentially contain non-printable chars? virtual GBool isBinary(GBool last = gTrue) = 0; - // Does this stream include a "strong" compression filter (anything - // other than RLE)? - virtual GBool hasStrongCompression() { return gFalse; } - // Get the BaseStream of this stream. virtual BaseStream *getBaseStream() = 0; @@ -490,7 +490,6 @@ public: virtual GString *getPSFilter(int psLevel, const char *indent, GBool okToReadStream); virtual GBool isBinary(GBool last = gTrue); - virtual GBool hasStrongCompression() { return gTrue; } private: @@ -574,7 +573,6 @@ public: virtual GString *getPSFilter(int psLevel, const char *indent, GBool okToReadStream); virtual GBool isBinary(GBool last = gTrue); - virtual GBool hasStrongCompression() { return gTrue; } private: @@ -674,7 +672,6 @@ public: virtual GString *getPSFilter(int psLevel, const char *indent, GBool okToReadStream); virtual GBool isBinary(GBool last = gTrue); - virtual GBool hasStrongCompression() { return gTrue; } Stream *getRawStream() { return str; } private: @@ -816,7 +813,6 @@ public: virtual GString *getPSFilter(int psLevel, const char *indent, GBool okToReadStream); virtual GBool isBinary(GBool last = gTrue); - virtual GBool hasStrongCompression() { return gTrue; } private: diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc index 86d08414476..e2da940bb41 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <stdlib.h> #include <stddef.h> @@ -61,11 +65,7 @@ // A large character has a font size larger than // largeCharThreshold * avgFontSize. -#define largeCharThreshold 2.0 - -// Max ratio of large-to-total chars to prefer a large char split over -// a line split. -#define largeCharRatio 0.2 +#define largeCharThreshold 1.5 // A block will be split vertically only if the resulting chunk widths // are greater than minChunkWidth * avgFontSize. However, Blocks of @@ -83,9 +83,9 @@ #define maxWordGapSize 2.5 #define tableModeMaxWordGapSize 1.1 -// Chars whose baseline is within baselineRange * avgFontSize of a -// line's current average baseline are added to the line. -#define baselineRange 0.5 +// Adjacent lines can overlap by at most lineOverlapThreshold * +// lineHeight. +#define lineOverlapThreshold 0.33 // Subscripts (superscripts) must overlap the next (previous) line by // minSubSuperscriptVertOverlap * fontSize. @@ -214,14 +214,12 @@ public: static int cmpX(const void *p1, const void *p2); static int cmpY(const void *p1, const void *p2); - static int cmpBase(const void *p1, const void *p2); static int cmpCharPos(const void *p1, const void *p2); Unicode c; int charPos; int charLen; double xMin, yMin, xMax, yMax; - double base; TextFontInfo *font; double fontSize; double colorR, @@ -251,50 +249,38 @@ TextChar::TextChar(Unicode cA, int charPosA, int charLenA, yMin = yMinA; xMax = xMaxA; yMax = yMaxA; - switch (rotA) { - case 0: - default: base = yMax + fontSizeA * fontA->getDescent(); break; - case 1: base = xMin - fontSizeA * fontA->getDescent(); break; - case 2: base = yMin - fontSizeA * fontA->getDescent(); break; - case 3: base = xMax + fontSizeA * fontA->getDescent(); break; + // this can happen with vertical writing mode, or with odd values + // for the char/word spacing parameters + if (xMin > xMax) { + t = xMin; xMin = xMax; xMax = t; + } + if (yMin > yMax) { + t = yMin; yMin = yMax; yMax = t; } // TextPage::findGaps uses integer coordinates, so clip the char // bbox to fit in a 32-bit int (this is generally only a problem in // damaged PDF files) if (xMin < -1e8) { xMin = -1e8; - } else if (xMin > 1e8) { - xMin = 1e8; } - if (xMax < -1e8) { - xMax = -1e8; - } else if (xMax > 1e8) { + if (xMax > 1e8) { xMax = 1e8; } if (yMin < -1e8) { yMin = -1e8; - } else if (yMin > 1e8) { - yMin = 1e8; } - if (yMax < -1e8) { - yMax = -1e8; - } else if (yMax > 1e8) { + if (yMax > 1e8) { yMax = 1e8; } - // this can happen with vertical writing mode, or with odd values - // for the char/word spacing parameters - if (xMin > xMax) { - t = xMin; xMin = xMax; xMax = t; - } - if (yMin > yMax) { - t = yMin; yMin = yMax; yMax = t; - } - // zero-width/height characters will cause problems in the splitting code - if (xMax - xMin < 1e-6) { - xMax = xMin + 1e-6; - } - if (yMax - yMin < 1e-6) { - yMax = yMin + 1e-6; + // zero-width characters will cause problems in the splitting code + if (rotA & 1) { + if (yMax - yMin < 1e-6) { + yMax = yMin + 1e-6; + } + } else { + if (xMax - xMin < 1e-6) { + xMax = xMin + 1e-6; + } } rot = (Guchar)rotA; rotated = (char)rotatedA; @@ -335,19 +321,6 @@ int TextChar::cmpY(const void *p1, const void *p2) { } } -int TextChar::cmpBase(const void *p1, const void *p2) { - const TextChar *ch1 = *(const TextChar **)p1; - const TextChar *ch2 = *(const TextChar **)p2; - - if (ch1->base < ch2->base) { - return -1; - } else if (ch1->base > ch2->base) { - return 1; - } else { - return ch1->charPos - ch2->charPos; - } -} - int TextChar::cmpCharPos(const void *p1, const void *p2) { const TextChar *ch1 = *(const TextChar **)p1; const TextChar *ch2 = *(const TextChar **)p2; @@ -1012,8 +985,7 @@ TextLine::TextLine(GList *wordsA, double xMinA, double yMinA, } } //~ need to check for other Unicode chars used as hyphens - hyphenated = text[len - 1] == (Unicode)'-' || - text[len - 1] == (Unicode)0xad; + hyphenated = text[len - 1] == (Unicode)'-'; } TextLine::~TextLine() { @@ -1240,7 +1212,6 @@ TextPage::TextPage(TextOutputControl *controlA) { chars = new GList(); fonts = new GList(); - primaryRot = 0; underlines = new GList(); links = new GList(); @@ -1269,15 +1240,6 @@ void TextPage::startPage(GfxState *state) { if (state) { pageWidth = state->getPageWidth(); pageHeight = state->getPageHeight(); - // When rotating characters, the coordinates are flipped using the - // page size. See the comment in TextChar::TextChar() about - // integer coordinates. - if (pageWidth > 1e8) { - pageWidth = 1e8; - } - if (pageHeight > 1e8) { - pageHeight = 1e8; - } } else { pageWidth = pageHeight = 0; } @@ -1304,9 +1266,6 @@ void TextPage::clear() { underlines = new GList(); deleteGList(links, TextLink); links = new GList(); - nVisibleChars = 0; - nInvisibleChars = 0; - nRemovedDupChars = 0; if (findCols) { deleteGList(findCols, TextColumn); @@ -1601,18 +1560,13 @@ void TextPage::addChar(GfxState *state, double x, double y, } else { j = i; } - GBool invisible = state->getRender() == 3 || alpha < 0.001; chars->append(new TextChar(uBuf[j], charPos, nBytes, xMin, yMin, xMax, yMax, - curRot, rotated, clipped, invisible, + curRot, rotated, clipped, + state->getRender() == 3 || alpha < 0.001, curFont, curFontSize, colToDbl(rgb.r), colToDbl(rgb.g), colToDbl(rgb.b))); - if (invisible) { - ++nInvisibleChars; - } else { - ++nVisibleChars; - } } } @@ -1776,7 +1730,7 @@ void TextPage::writeReadingOrder(void *outputStream, GList *columns; GBool primaryLR; GString *s; - int colIdx, parIdx, lineIdx, n; + int colIdx, parIdx, lineIdx, rot, n; #if 0 //~debug dumpChars(chars); @@ -1786,7 +1740,7 @@ void TextPage::writeReadingOrder(void *outputStream, } else { overlappingChars = NULL; } - primaryRot = rotateChars(chars); + rot = rotateChars(chars); primaryLR = checkPrimaryLR(chars); tree = splitChars(chars); #if 0 //~debug @@ -1794,14 +1748,14 @@ void TextPage::writeReadingOrder(void *outputStream, #endif if (!tree) { // no text - unrotateChars(chars, primaryRot); + unrotateChars(chars, rot); return; } columns = buildColumns(tree, primaryLR); delete tree; - unrotateChars(chars, primaryRot); + unrotateChars(chars, rot); if (control.html) { - rotateUnderlinesAndLinks(primaryRot); + rotateUnderlinesAndLinks(rot); generateUnderlinesAndLinks(columns); } if (overlappingChars) { @@ -1845,10 +1799,10 @@ GList *TextPage::makeColumns() { GList *overlappingChars; GList *columns; GBool primaryLR; + int rot; if (control.mode == textOutSimple2Layout) { primaryLR = checkPrimaryLR(chars); - primaryRot = 0; rotateCharsToZero(chars); columns = buildSimple2Columns(chars); unrotateCharsFromZero(chars); @@ -1859,7 +1813,7 @@ GList *TextPage::makeColumns() { } else { overlappingChars = NULL; } - primaryRot = rotateChars(chars); + rot = rotateChars(chars); primaryLR = checkPrimaryLR(chars); if ((tree = splitChars(chars))) { columns = buildColumns(tree, primaryLR); @@ -1868,8 +1822,8 @@ GList *TextPage::makeColumns() { // no text columns = new GList(); } - unrotateChars(chars, primaryRot); - unrotateColumns(columns, primaryRot); + unrotateChars(chars, rot); + unrotateColumns(columns, rot); if (control.html) { generateUnderlinesAndLinks(columns); } @@ -1898,7 +1852,7 @@ void TextPage::writePhysLayout(void *outputStream, GList *overlappingChars; GList *columns; GBool primaryLR; - int ph, colIdx, parIdx, lineIdx, y, i; + int ph, colIdx, parIdx, lineIdx, rot, y, i; #if 0 //~debug dumpChars(chars); @@ -1911,7 +1865,7 @@ void TextPage::writePhysLayout(void *outputStream, } else { overlappingChars = NULL; } - primaryRot = rotateChars(chars); + rot = rotateChars(chars); primaryLR = checkPrimaryLR(chars); tree = splitChars(chars); #if 0 //~debug @@ -1919,15 +1873,15 @@ void TextPage::writePhysLayout(void *outputStream, #endif if (!tree) { // no text - unrotateChars(chars, primaryRot); + unrotateChars(chars, rot); return; } //~ this doesn't correctly handle the right-to-left case columns = buildColumns(tree, gTrue); delete tree; - unrotateChars(chars, primaryRot); + unrotateChars(chars, rot); if (control.html) { - rotateUnderlinesAndLinks(primaryRot); + rotateUnderlinesAndLinks(rot); generateUnderlinesAndLinks(columns); } ph = assignPhysLayoutPositions(columns); @@ -1986,7 +1940,7 @@ void TextPage::writePhysLayout(void *outputStream, if (overlappingChars) { if (overlappingChars->getLength() > 0) { - col = buildOverlappingTextColumn(overlappingChars); + TextColumn *col = buildOverlappingTextColumn(overlappingChars); (*outputFunc)(outputStream, eol, eolLen); for (parIdx = 0; parIdx < col->paragraphs->getLength(); ++parIdx) { par = (TextParagraph *)col->paragraphs->get(parIdx); @@ -2019,12 +1973,12 @@ void TextPage::writeSimpleLayout(void *outputStream, GList *superLines; GString *out; GBool primaryLR; - int x, i, j; + int rot, x, i, j; #if 0 //~debug dumpChars(chars); #endif - primaryRot = rotateChars(chars); + rot = rotateChars(chars); primaryLR = checkPrimaryLR(chars); tree = splitChars(chars); #if 0 //~debug @@ -2032,13 +1986,13 @@ void TextPage::writeSimpleLayout(void *outputStream, #endif if (!tree) { // no text - unrotateChars(chars, primaryRot); + unrotateChars(chars, rot); return; } superLines = new GList(); buildSuperLines(tree, superLines); delete tree; - unrotateChars(chars, primaryRot); + unrotateChars(chars, rot); assignSimpleLayoutPositions(superLines, uMap); for (i = 0; i < superLines->getLength(); ++i) { @@ -2082,7 +2036,6 @@ void TextPage::writeSimple2Layout(void *outputStream, int colIdx, parIdx, lineIdx; primaryLR = checkPrimaryLR(chars); - primaryRot = 0; rotateCharsToZero(chars); #if 0 //~debug dumpChars(chars); @@ -2121,9 +2074,9 @@ void TextPage::writeLinePrinter(void *outputStream, double pitch, lineSpacing, delta; double yMin0, yShift, xMin0, xShift; double y, x; - int n, i, j, k; + int rot, n, i, j, k; - primaryRot = rotateChars(chars); + rot = rotateChars(chars); chars->sort(&TextChar::cmpX); // don't call removeDuplicates here, because it expects to be // working on a secondary list that doesn't own the TextChar objects @@ -2233,7 +2186,7 @@ void TextPage::writeLinePrinter(void *outputStream, delete line; } - unrotateChars(chars, primaryRot); + unrotateChars(chars, rot); } void TextPage::writeRaw(void *outputStream, @@ -2498,7 +2451,6 @@ int TextPage::rotateChars(GList *charsA) { ch->xMax = xMax; ch->yMin = yMin; ch->yMax = yMax; - ch->base = pageWidth - ch->base; ch->rot = (ch->rot + 3) & 3; } t = pageWidth; @@ -2516,7 +2468,6 @@ int TextPage::rotateChars(GList *charsA) { ch->xMax = xMax; ch->yMin = yMin; ch->yMax = yMax; - ch->base = pageHeight - ch->base; ch->rot = (ch->rot + 2) & 3; } break; @@ -2564,7 +2515,6 @@ void TextPage::rotateCharsToZero(GList *charsA) { ch->xMax = xMax; ch->yMin = yMin; ch->yMax = yMax; - ch->base = pageWidth - ch->base; break; case 2: xMin = pageWidth - ch->xMax; @@ -2575,7 +2525,6 @@ void TextPage::rotateCharsToZero(GList *charsA) { ch->xMax = xMax; ch->yMin = yMin; ch->yMax = yMax; - ch->base = pageHeight - ch->base; break; case 3: xMin = pageHeight - ch->yMax; @@ -2705,7 +2654,6 @@ void TextPage::unrotateChars(GList *charsA, int rot) { ch->xMax = xMax; ch->yMin = yMin; ch->yMax = yMax; - ch->base = pageWidth - ch->base; ch->rot = (ch->rot + 1) & 3; } break; @@ -2720,7 +2668,6 @@ void TextPage::unrotateChars(GList *charsA, int rot) { ch->xMax = xMax; ch->yMin = yMin; ch->yMax = yMax; - ch->base = pageHeight - ch->base; ch->rot = (ch->rot + 2) & 3; } break; @@ -3273,7 +3220,7 @@ GBool TextPage::checkPrimaryLR(GList *charsA) { // by x for rot=0,2; by y for rot=1,3. void TextPage::removeDuplicates(GList *charsA, int rot) { TextChar *ch, *ch2; - double xDelta, yDelta, xDelta2, yDelta2; + double xDelta, yDelta; int i, j; if (rot & 1) { @@ -3282,10 +3229,6 @@ void TextPage::removeDuplicates(GList *charsA, int rot) { ch = (TextChar *)charsA->get(i); xDelta = dupMaxSecDelta * ch->fontSize; yDelta = dupMaxPriDelta * ch->fontSize; - yDelta2 = 0.5 * (ch->yMax - ch->yMin); - if (yDelta2 < yDelta) { - yDelta = yDelta2; - } j = i + 1; while (j < charsA->getLength()) { ch2 = (TextChar *)charsA->get(j); @@ -3298,7 +3241,6 @@ void TextPage::removeDuplicates(GList *charsA, int rot) { fabs(ch2->yMax - ch->yMax) < yDelta) { if (ch->invisible && !ch2->invisible) { charsA->del(i); - ++nRemovedDupChars; --i; break; } @@ -3306,7 +3248,6 @@ void TextPage::removeDuplicates(GList *charsA, int rot) { ch->spaceAfter = (char)gTrue; } charsA->del(j); - ++nRemovedDupChars; } else { ++j; } @@ -3318,10 +3259,6 @@ void TextPage::removeDuplicates(GList *charsA, int rot) { while (i < charsA->getLength()) { ch = (TextChar *)charsA->get(i); xDelta = dupMaxPriDelta * ch->fontSize; - xDelta2 = 0.5 * (ch->xMax - ch->xMin); - if (xDelta2 < xDelta) { - xDelta = xDelta2; - } yDelta = dupMaxSecDelta * ch->fontSize; j = i + 1; while (j < charsA->getLength()) { @@ -3335,7 +3272,6 @@ void TextPage::removeDuplicates(GList *charsA, int rot) { fabs(ch2->yMax - ch->yMax) < yDelta) { if (ch->invisible && !ch2->invisible) { charsA->del(i); - ++nRemovedDupChars; --i; break; } @@ -3343,7 +3279,6 @@ void TextPage::removeDuplicates(GList *charsA, int rot) { ch->spaceAfter = (char)gTrue; } charsA->del(j); - ++nRemovedDupChars; } else { ++j; } @@ -3624,7 +3559,7 @@ TextBlock *TextPage::splitChars(GList *charsA) { } } if (chars2->getLength() > 0) { - tree[rot] = split(chars2, rot); + tree[rot] = split(chars2, rot, gFalse); } } delete chars2; @@ -3655,11 +3590,9 @@ TextBlock *TextPage::splitChars(GList *charsA) { } // merge non-primary-rotation text into the primary-rotation tree - GBool doReorder = control.mode == textOutReadingOrder && - globalParams->getSeparateRotatedText(); for (rot = 1; rot < 4; ++rot) { if (tree[rot]) { - insertIntoTree(tree[rot], tree[0], doReorder); + insertIntoTree(tree[rot], tree[0]); tree[rot] = NULL; } } @@ -3677,7 +3610,7 @@ TextBlock *TextPage::splitChars(GList *charsA) { } // Generate a tree of TextBlocks, marked as columns, lines, and words. -TextBlock *TextPage::split(GList *charsA, int rot) { +TextBlock *TextPage::split(GList *charsA, int rot, GBool vertOnly) { TextBlock *blk; GList *chars2, *chars3; GList *splitLines; @@ -3829,13 +3762,18 @@ TextBlock *TextPage::split(GList *charsA, int rot) { doHorizSplit = doVertSplit = doLineSplit = doLargeCharSplit = gFalse; smallSplit = gFalse; if (rot & 1) { - if (control.mode == textOutSimpleLayout) { + if (vertOnly) { + if (nHorizGaps > 0 && horizGapSize > minGapSize * minFontSize) { + doHorizSplit = gTrue; + smallSplit = horizGapSize < smallSplitThreshold; + } + } else if (control.mode == textOutSimpleLayout) { if (nVertGaps > 0) { doVertSplit = gTrue; } else if (nHorizGaps > 0 && horizGapSize > minGapSize * minFontSize) { doHorizSplit = gTrue; smallSplit = horizGapSize < smallSplitThreshold; - } else if (splitLines->getLength() > 1) { + } else if (!vertOnly && splitLines->getLength() > 1) { doLineSplit = gTrue; } } else if (nHorizGaps > 0 && @@ -3848,15 +3786,19 @@ TextBlock *TextPage::split(GList *charsA, int rot) { smallSplit = horizGapSize < smallSplitThreshold; } else if (nVertGaps > 0) { doVertSplit = gTrue; - } else if (nLargeChars > 0 && - ((nLargeChars < largeCharRatio * charsA->getLength()) || - splitLines->getLength() <= 1)) { + } else if (nLargeChars > 0) { doLargeCharSplit = gTrue; } else if (splitLines->getLength() > 1) { doLineSplit = gTrue; } } else { - if (control.mode == textOutSimpleLayout) { + if (vertOnly) { + if (nVertGaps > 0 && + vertGapSize > minGapSize * minFontSize) { + doVertSplit = gTrue; + smallSplit = vertGapSize < smallSplitThreshold; + } + } else if (control.mode == textOutSimpleLayout) { if (nHorizGaps > 0) { doHorizSplit = gTrue; } else if (nVertGaps > 0 && vertGapSize > minGapSize * minFontSize) { @@ -3875,9 +3817,7 @@ TextBlock *TextPage::split(GList *charsA, int rot) { smallSplit = vertGapSize < smallSplitThreshold; } else if (nHorizGaps > 0) { doHorizSplit = gTrue; - } else if (nLargeChars > 0 && - ((nLargeChars < largeCharRatio * charsA->getLength()) || - splitLines->getLength() <= 1)) { + } else if (nLargeChars > 0) { doLargeCharSplit = gTrue; } else if (splitLines->getLength() > 1) { doLineSplit = gTrue; @@ -3907,13 +3847,13 @@ TextBlock *TextPage::split(GList *charsA, int rot) { if (vertGaps->getW(i) > vertGapSize - splitGapSlack * avgFontSize) { x1 = vertGaps->getX(i); chars2 = getChars(charsA, x0, yMin - 1, x1, yMax + 1); - blk->addChild(split(chars2, rot)); + blk->addChild(split(chars2, rot, vertOnly)); delete chars2; x0 = x1; } } chars2 = getChars(charsA, x0, yMin - 1, xMax + 1, yMax + 1); - blk->addChild(split(chars2, rot)); + blk->addChild(split(chars2, rot, vertOnly)); delete chars2; // split horizontally @@ -3934,13 +3874,13 @@ TextBlock *TextPage::split(GList *charsA, int rot) { if (horizGaps->getW(i) > horizGapSize - splitGapSlack * avgFontSize) { y1 = horizGaps->getX(i); chars2 = getChars(charsA, xMin - 1, y0, xMax + 1, y1); - blk->addChild(split(chars2, rot)); + blk->addChild(split(chars2, rot, gFalse)); delete chars2; y0 = y1; } } chars2 = getChars(charsA, xMin - 1, y0, xMax + 1, yMax + 1); - blk->addChild(split(chars2, rot)); + blk->addChild(split(chars2, rot, gFalse)); delete chars2; // split into larger and smaller chars @@ -3959,7 +3899,7 @@ TextBlock *TextPage::split(GList *charsA, int rot) { chars3->append(ch); } } - blk = split(chars3, rot); + blk = split(chars3, rot, gFalse); chars2->sort((rot & 1) ? &TextChar::cmpY : &TextChar::cmpX); insertLargeChars(chars2, blk); delete chars2; @@ -3985,21 +3925,12 @@ TextBlock *TextPage::split(GList *charsA, int rot) { for (i = 0; i < splitLine->chars->getLength(); ++i) { blk->addChild((TextChar *)splitLine->chars->get(i), gTrue); } -#if 0 //~debug - printf("line-leaf xMin=%g yMin=%g xMax=%g yMax=%g\n", - xMin, pageHeight - yMax, xMax, pageHeight - yMin); - printf(" "); - for (i = 0; i < splitLine->chars->getLength(); ++i) { - printf("%c", ((TextChar *)splitLine->chars->get(i))->c); - } - printf("\n"); -#endif } else { blk = new TextBlock((rot & 1) ? blkVertSplit : blkHorizSplit, rot); blk->smallSplit = gFalse; for (i = 0; i < splitLines->getLength(); ++i) { SplitLine *splitLine = (SplitLine *)splitLines->get(i); - blk->addChild(split(splitLine->chars, rot)); + blk->addChild(split(splitLine->chars, rot, singleLine)); } } @@ -4127,146 +4058,54 @@ void TextPage::findGaps(GList *charsA, int rot, } } - //----- find horizontal gaps + //----- partition into lines and find horizontal gaps if (rot & 1) { charsA->sort(&TextChar::cmpX); - double xxMax = 0; + SplitLine *splitLine = NULL; + double xxMin = 0, xxMax = 0; for (int i = 0; i < charsA->getLength(); ++i) { TextChar *ch = (TextChar *)charsA->get(i); - if (i == 0) { + if (i == 0 || + ch->xMin > xxMax - lineOverlapThreshold * (xxMax - xxMin)) { + if (i > 0 && ch->xMin > xxMax) { + vertGaps->addGap(0.5 * (ch->xMin + xxMax), ch->xMin - xxMax); + } + xxMin = ch->xMin; xxMax = ch->xMax; - } else if (ch->xMin <= xxMax) { + splitLine = new SplitLine(i, i, xxMin, xxMax); + splitLines->append(splitLine); + } else { + splitLine->lastCharIdx = i; if (ch->xMax > xxMax) { xxMax = ch->xMax; + splitLine->yMax = xxMax; } - } else { - vertGaps->addGap(0.5 * (ch->xMin + xxMax), ch->xMin - xxMax); - xxMax = ch->xMax; } } } else { charsA->sort(&TextChar::cmpY); - double yyMax = 0; + SplitLine *splitLine = NULL; + double yyMin = 0, yyMax = 0; for (int i = 0; i < charsA->getLength(); ++i) { TextChar *ch = (TextChar *)charsA->get(i); - if (i == 0) { - yyMax = ch->yMax; - } else if (ch->yMin <= yyMax) { - if (ch->yMax > yyMax) { - yyMax = ch->yMax; + if (i == 0 || + ch->yMin > yyMax - lineOverlapThreshold * (yyMax - yyMin)) { + if (i > 0 && ch->yMin > yyMax) { + horizGaps->addGap(0.5 * (ch->yMin + yyMax), ch->yMin - yyMax); } - } else { - horizGaps->addGap(0.5 * (ch->yMin + yyMax), ch->yMin - yyMax); + yyMin = ch->yMin; yyMax = ch->yMax; - } - } - } - - //----- split into lines - - double baseDelta = baselineRange * avgFontSize; - - if (rot & 1) { - - // split into non-overlapping chunks - int firstChar = 0; - while (firstChar < charsA->getLength()) { - TextChar *ch = (TextChar *)charsA->get(firstChar); - double xxMax = ch->xMax; - int nextChar = firstChar + 1; - while (nextChar < charsA->getLength()) { - ch = (TextChar *)charsA->get(nextChar); - if (ch->xMin > xxMax) { - break; - } - if (ch->xMax > xxMax) { - xxMax = ch->xMax; - } - ++nextChar; - } - - // split the chunk [firstChar, nextChar) into lines - charsA->sort(firstChar, nextChar - firstChar, &TextChar::cmpBase); - int i0 = firstChar; - while (i0 < nextChar) { - ch = (TextChar *)charsA->get(i0); - double baseTotal = ch->base; - double baseAvg = baseTotal; - double xxMin = ch->xMin; - xxMax = ch->xMax; - int i1 = i0 + 1; - while (i1 < nextChar) { - ch = (TextChar *)charsA->get(i1); - if (ch->base > baseAvg + baseDelta) { - break; - } - baseTotal += ch->base; - if (ch->xMin < xxMin) { - xxMin = ch->xMin; - } - if (ch->xMax > xxMax) { - xxMax = ch->xMax; - } - ++i1; - baseAvg = baseTotal / (i1 - i0); - } - splitLines->append(new SplitLine(i0, i1 - 1, xxMin, xxMax)); - i0 = i1; - } - firstChar = nextChar; - } - - } else { - - // split into non-overlapping chunks - int firstChar = 0; - while (firstChar < charsA->getLength()) { - TextChar *ch = (TextChar *)charsA->get(firstChar); - double yyMax = ch->yMax; - int nextChar = firstChar + 1; - while (nextChar < charsA->getLength()) { - ch = (TextChar *)charsA->get(nextChar); - if (ch->yMin > yyMax) { - break; - } + splitLine = new SplitLine(i, i, yyMin, yyMax); + splitLines->append(splitLine); + } else { + splitLine->lastCharIdx = i; if (ch->yMax > yyMax) { yyMax = ch->yMax; + splitLine->yMax = yyMax; } - ++nextChar; - } - - // split the chunk [firstChar, nextChar) into lines - charsA->sort(firstChar, nextChar - firstChar, &TextChar::cmpBase); - int i0 = firstChar; - while (i0 < nextChar) { - ch = (TextChar *)charsA->get(i0); - double baseTotal = ch->base; - double baseAvg = baseTotal; - double yyMin = ch->yMin; - yyMax = ch->yMax; - int i1 = i0 + 1; - while (i1 < nextChar) { - ch = (TextChar *)charsA->get(i1); - if (ch->base > baseAvg + baseDelta) { - break; - } - baseTotal += ch->base; - if (ch->yMin < yyMin) { - yyMin = ch->yMin; - } - if (ch->yMax > yyMax) { - yyMax = ch->yMax; - } - ++i1; - baseAvg = baseTotal / (i1 - i0); - } - splitLines->append(new SplitLine(i0, i1 - 1, yyMin, yyMax)); - i0 = i1; } - firstChar = nextChar; } - } } @@ -4358,19 +4197,10 @@ void TextPage::mergeSplitLines(GList *charsA, int rot, GList *splitLines) { // merge sub/superscripts into correct lines if (allSubSuper) { - idxAbove = 0; - idxBelow = 0; for (int idx = 0; idx < splitLine->chars->getLength(); ++idx) { TextChar *ch = (TextChar *)splitLine->chars->get(idx); if (maybeSub && ch->xMin < prevLine->yMax) { - while (idxAbove < prevLine->chars->getLength()) { - TextChar *ch2 = (TextChar *)prevLine->chars->get(idxAbove); - if (ch2->yMin > ch->yMin && ch2->xMin < ch->xMax && ch2->xMax > ch->xMin) { - break; - } - ++idxAbove; - } - prevLine->chars->insert(idxAbove, ch); + prevLine->chars->append(ch); if (ch->xMin < prevLine->yMin) { prevLine->yMin = ch->xMin; } @@ -4378,14 +4208,7 @@ void TextPage::mergeSplitLines(GList *charsA, int rot, GList *splitLines) { prevLine->yMax = ch->xMax; } } else { - while (idxBelow < nextLine->chars->getLength()) { - TextChar *ch2 = (TextChar *)nextLine->chars->get(idxBelow); - if (ch2->yMin > ch->yMin && ch2->xMin < ch->xMax && ch2->xMax > ch->xMin) { - break; - } - ++idxBelow; - } - nextLine->chars->insert(idxBelow, ch); + nextLine->chars->append(ch); if (ch->xMin < nextLine->yMin) { nextLine->yMin = ch->xMin; } @@ -4394,6 +4217,12 @@ void TextPage::mergeSplitLines(GList *charsA, int rot, GList *splitLines) { } } } + if (maybeSub) { + prevLine->chars->sort(&TextChar::cmpY); + } + if (maybeSuper) { + nextLine->chars->sort(&TextChar::cmpY); + } delete splitLine; splitLines->del(i); } @@ -4423,14 +4252,14 @@ void TextPage::mergeSplitLines(GList *charsA, int rot, GList *splitLines) { prevLine = (SplitLine *)splitLines->get(i-1); double minOverlap = minSubSuperscriptVertOverlap * (prevLine->yMax - prevLine->yMin); - maybeSub = prevLine->yMax - splitLine->yMin > minOverlap; + maybeSub = prevLine->yMax - splitLine->yMin > minOverlap; } GBool maybeSuper = gFalse; if (i < splitLines->getLength() - 1) { nextLine = (SplitLine *)splitLines->get(i+1); double minOverlap = minSubSuperscriptVertOverlap * (nextLine->yMax - nextLine->yMin); - maybeSuper = splitLine->yMax - nextLine->yMin > minOverlap; + maybeSuper = splitLine->yMax - nextLine->yMin > minOverlap; } if (!maybeSub && !maybeSuper) { continue; @@ -4486,19 +4315,10 @@ void TextPage::mergeSplitLines(GList *charsA, int rot, GList *splitLines) { // merge sub/superscripts into correct lines if (allSubSuper) { - idxAbove = 0; - idxBelow = 0; for (int idx = 0; idx < splitLine->chars->getLength(); ++idx) { TextChar *ch = (TextChar *)splitLine->chars->get(idx); if (maybeSub && ch->yMin < prevLine->yMax) { - while (idxAbove < prevLine->chars->getLength()) { - TextChar *ch2 = (TextChar *)prevLine->chars->get(idxAbove); - if (ch2->xMin > ch->xMin && ch2->yMin < ch->yMax && ch2->yMax > ch->yMin) { - break; - } - ++idxAbove; - } - prevLine->chars->insert(idxAbove, ch); + prevLine->chars->append(ch); if (ch->yMin < prevLine->yMin) { prevLine->yMin = ch->yMin; } @@ -4506,14 +4326,7 @@ void TextPage::mergeSplitLines(GList *charsA, int rot, GList *splitLines) { prevLine->yMax = ch->yMax; } } else { - while (idxBelow < nextLine->chars->getLength()) { - TextChar *ch2 = (TextChar *)nextLine->chars->get(idxBelow); - if (ch2->xMin > ch->xMin && ch2->yMin < ch->yMax && ch2->yMax > ch->yMin) { - break; - } - ++idxBelow; - } - nextLine->chars->insert(idxBelow, ch); + nextLine->chars->append(ch); if (ch->yMin < nextLine->yMin) { nextLine->yMin = ch->yMin; } @@ -4522,6 +4335,12 @@ void TextPage::mergeSplitLines(GList *charsA, int rot, GList *splitLines) { } } } + if (maybeSub) { + prevLine->chars->sort(&TextChar::cmpX); + } + if (maybeSuper) { + nextLine->chars->sort(&TextChar::cmpX); + } delete splitLine; splitLines->del(i); } @@ -4698,48 +4517,20 @@ void TextPage::insertLargeCharInLeaf(TextChar *ch, TextBlock *blk) { } // Merge blk (rot != 0) into primaryTree (rot == 0). -void TextPage::insertIntoTree(TextBlock *blk, TextBlock *primaryTree, - GBool doReorder) { - // if we're separating each rotation (only supported in reading - // order mode), reorder the block's children as appropriate and then - // append the block - if (doReorder) { - reorderBlocks(blk); - primaryTree->children->append(blk); - - // otherwise, insert blocks into the primary tree in the appropriate - // locations - } else { +void TextPage::insertIntoTree(TextBlock *blk, TextBlock *primaryTree) { + TextBlock *child; - // we insert a whole column at a time - so call insertIntoTree - // recursively until we get to a column (or line) - if (blk->tag == blkTagMulticolumn) { - while (blk->children->getLength()) { - TextBlock *child = (TextBlock *)blk->children->del(0); - insertIntoTree(child, primaryTree, doReorder); - } - delete blk; + // we insert a whole column at a time - so call insertIntoTree + // recursively until we get to a column (or line) - } else { - insertColumnIntoTree(blk, primaryTree); + if (blk->tag == blkTagMulticolumn) { + while (blk->children->getLength()) { + child = (TextBlock *)blk->children->del(0); + insertIntoTree(child, primaryTree); } - } -} - -// Reorder non-primary-rotation blocks as appropriate (for reading -// order mode only). -void TextPage::reorderBlocks(TextBlock *blk) { - if (blk->tag != blkTagMulticolumn) { - return; - } - for (int i = 0; i < blk->children->getLength(); ++i) { - reorderBlocks((TextBlock *)blk->children->get(i)); - } - //~ check/test these conditions - if ((blk->rot == 1 && blk->type == blkVertSplit) || - blk->rot == 2 || - (blk->rot == 3 && blk->type == blkHorizSplit)) { - blk->children->reverse(); + delete blk; + } else { + insertColumnIntoTree(blk, primaryTree); } } @@ -5304,13 +5095,11 @@ TextLine *TextPage::buildLine(GList *charsA, int rot, TextWord *word; double wordSp, lineFontSize, sp; int dir, dir2; - GBool rotated2, spaceAfter, spaceBefore; + GBool rotated, spaceAfter, spaceBefore; int i, j; wordSp = computeWordSpacingThreshold(charsA, rot); - adjustCombiningChars(charsA, rot); - words = new GList(); lineFontSize = 0; spaceBefore = gFalse; @@ -5324,7 +5113,7 @@ TextLine *TextPage::buildLine(GList *charsA, int rot, : (TextChar *)NULL, (i < charsA->getLength() - 1) ? (TextChar *)charsA->get(i+1) : (TextChar *)NULL); - rotated2 = ((TextChar *)charsA->get(i))->rotated; + rotated = ((TextChar *)charsA->get(i))->rotated; for (j = i+1; j < charsA->getLength(); ++j) { ch = (TextChar *)charsA->get(j-1); ch2 = (TextChar *)charsA->get(j); @@ -5345,7 +5134,7 @@ TextLine *TextPage::buildLine(GList *charsA, int rot, : (TextChar *)NULL); if (ch->font != ch2->font || fabs(ch->fontSize - ch2->fontSize) > 0.01 || - (control.splitRotatedWords && ch2->rotated != rotated2) || + (control.splitRotatedWords && ch2->rotated != rotated) || (dir && dir2 && dir2 != dir) || (control.mode == textOutRawOrder && ch2->charPos != ch->charPos + ch->charLen)) { @@ -5356,7 +5145,7 @@ TextLine *TextPage::buildLine(GList *charsA, int rot, } sp = wordSp - 1; } - word = new TextWord(charsA, i, j - i, rot, rotated2, dir, + word = new TextWord(charsA, i, j - i, rot, rotated, dir, (rot >= 2) ? spaceBefore : spaceAfter); spaceBefore = spaceAfter; i = j; @@ -5488,89 +5277,6 @@ double TextPage::computeWordSpacingThreshold(GList *charsA, int rot) { } } -// Move Unicode combining characters around so that they come -// immediately after the correct base characters. -//~ this currently won't work for RtL scripts -void TextPage::adjustCombiningChars(GList *charsA, int rot) { - int i = 1; - while (i < charsA->getLength()) { - TextChar *ch = (TextChar *)charsA->get(i); - - // look for a zero-width combining char - if (!(unicodeTypeCombiningMark(ch->c) && - fabs((rot & 1) ? ch->yMax - ch->yMin // width ~= zero - : ch->xMax - ch->xMin) < 0.01)) { - ++i; - continue; - } - - // look for a sequence of zero-width combining chars at the same - // position (NB: slight negative char spacing can reorder things - // so that diacritics for different base chars appear next to each - // other) - int j; - for (j = i + 1; j < charsA->getLength(); ++j) { - TextChar *ch2 = (TextChar *)charsA->get(j); - if (!(unicodeTypeCombiningMark(ch2->c) && - fabs((rot & 1) ? ch2->yMin - ch->yMax - : ch2->xMin - ch->xMax) < 0.01 * ch->fontSize && - fabs((rot & 1) ? ch->yMax - ch->yMin // width ~= zero - : ch->xMax - ch->xMin) < 0.01)) { - break; - } - } - - // identify the two previous chars - TextChar *prev1 = (i >= 2) ? (TextChar *)charsA->get(i - 2) : NULL; - TextChar *prev2 = (TextChar *)charsA->get(i - 1); - - //~ this code currently makes things worse for RtL scripts, so - //~ skip any RtL text - if (unicodeTypeR(prev2->c)) { - ++i; - continue; - } - - // if the combining chars are placed in the left 3/4 of prev2, - // assume the base char is prev1, not prev2, and reorder the chars - // accordingly - TextChar *base; - if (prev1 && - ((rot & 1) ? (ch->yMin < 0.25 * prev2->yMin + 0.75 * prev2->yMax) - : (ch->xMin < 0.25 * prev2->xMin + 0.75 * prev2->xMax))) { - for (int k = i; k < j; ++k) { - charsA->put(k - 1, charsA->get(k)); - } - charsA->put(j - 1, prev2); - --i; - --j; - base = prev1; - } else { - base = prev2; - } - - // sort the diacritics into content stream order - // (slight negative char spacing, used for kerning, will push - // zero-width diacritics out of order) - if (j - i > 1) { - charsA->sort(i, j - i, &TextChar::cmpCharPos); - } - - // set the diacritics' positions immediately to the right of the - // base char - for (int k = i; k < j; ++k) { - TextChar *ch2 = (TextChar *)charsA->get(k); - if (rot & 1) { - ch2->yMin = ch2->yMax = base->yMax; - } else { - ch2->xMin = ch2->xMax = base->xMax; - } - } - - i = j; - } -} - // Check the character's direction: returns 1 for L or Num; -1 for R; 0 // for others. int TextPage::getCharDirection(TextChar *ch) { @@ -6918,8 +6624,7 @@ void TextOutputDev::endString(GfxState *state) { void TextOutputDev::drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode c, int nBytes, Unicode *u, int uLen, - GBool fill, GBool stroke, GBool makePath) { + CharCode c, int nBytes, Unicode *u, int uLen) { text->addChar(state, x, y, dx, dy, c, nBytes, u, uLen); } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h b/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h index fc7bcb616dd..302975cd5f1 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include <stdio.h> #include "gtypes.h" #include "GfxFont.h" @@ -118,9 +122,6 @@ public: // Get the width of the 'm' character, if available. double getMWidth() { return mWidth; } - double getAscent() { return ascent; } - double getDescent() { return descent; } - Ref getFontID() { return fontID; } private: @@ -473,18 +474,10 @@ public: TextWordList *makeWordListForRect(double xMin, double yMin, double xMax, double yMax); - // Get the primary rotation of text on the page. - int getPrimaryRotation() { return primaryRot; } - // Returns true if the primary character direction is left-to-right, // false if it is right-to-left. GBool primaryDirectionIsLR(); - // Get the counter values. - int getNumVisibleChars() { return nVisibleChars; } - int getNumInvisibleChars() { return nInvisibleChars; } - int getNumRemovedDupChars() { return nRemovedDupChars; } - // Returns true if any of the fonts used on this page are likely to // be problematic when converting text to Unicode. GBool problematicForUnicode() { return problematic; } @@ -564,7 +557,7 @@ private: GList *separateOverlappingText(GList *charsA); TextColumn *buildOverlappingTextColumn(GList *overlappingChars); TextBlock *splitChars(GList *charsA); - TextBlock *split(GList *charsA, int rot); + TextBlock *split(GList *charsA, int rot, GBool vertOnly); GList *getChars(GList *charsA, double xMin, double yMin, double xMax, double yMax); void findGaps(GList *charsA, int rot, @@ -578,9 +571,7 @@ private: void insertLargeChars(GList *largeChars, TextBlock *blk); void insertLargeCharsInFirstLeaf(GList *largeChars, TextBlock *blk); void insertLargeCharInLeaf(TextChar *ch, TextBlock *blk); - void insertIntoTree(TextBlock *subtree, TextBlock *primaryTree, - GBool doReorder); - void reorderBlocks(TextBlock *blk); + void insertIntoTree(TextBlock *subtree, TextBlock *primaryTree); void insertColumnIntoTree(TextBlock *column, TextBlock *tree); void insertClippedChars(GList *clippedChars, TextBlock *tree); TextBlock *findClippedCharLeaf(TextChar *ch, TextBlock *tree); @@ -598,7 +589,6 @@ private: double xMin, double yMin, double xMax, double yMax); void getLineChars(TextBlock *blk, GList *charsA); double computeWordSpacingThreshold(GList *charsA, int rot); - void adjustCombiningChars(GList *charsA, int rot); int getCharDirection(TextChar *ch); int getCharDirection(TextChar *ch, TextChar *left, TextChar *right); int assignPhysLayoutPositions(GList *columns); @@ -650,15 +640,10 @@ private: GList *chars; // [TextChar] GList *fonts; // all font info objects used on this // page [TextFontInfo] - int primaryRot; // primary rotation GList *underlines; // [TextUnderline] GList *links; // [TextLink] - int nVisibleChars; // number of visible chars on the page - int nInvisibleChars; // number of invisible chars on the page - int nRemovedDupChars; // number of duplicate chars removed - GList *findCols; // text used by the findText**/findPoint** // functions [TextColumn] double lastFindXMin, // coordinates of the last "find" result @@ -740,8 +725,7 @@ public: virtual void drawChar(GfxState *state, double x, double y, double dx, double dy, double originX, double originY, - CharCode c, int nBytes, Unicode *u, int uLen, - GBool fill, GBool stroke, GBool makePath); + CharCode c, int nBytes, Unicode *u, int uLen); virtual void incCharCount(int nChars); virtual void beginActualText(GfxState *state, Unicode *u, int uLen); virtual void endActualText(GfxState *state); @@ -800,11 +784,6 @@ public: // Turn extra processing for HTML conversion on or off. void enableHTMLExtras(GBool html) { control.html = html; } - // Get the counter values. - int getNumVisibleChars() { return text->nVisibleChars; } - int getNumInvisibleChars() { return text->nInvisibleChars; } - int getNumRemovedDupChars() { return text->nRemovedDupChars; } - private: void generateBOM(); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TextString.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/TextString.cc index 5541bc61102..8e54a1d5471 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TextString.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TextString.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <string.h> #include "gmem.h" #include "gmempp.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TextString.h b/Build/source/libs/xpdf/xpdf-src/xpdf/TextString.h index 909d3259097..c296d7d6d7a 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TextString.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TextString.h @@ -15,6 +15,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "CharTypes.h" class GString; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TileCache.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/TileCache.cc index 65e60629bd2..ff002ed46fc 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TileCache.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TileCache.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include "gmem.h" #include "gmempp.h" #include "GList.h" @@ -233,7 +237,7 @@ GThreadReturn TileCacheThreadPool::threadFunc(void *arg) { } void TileCacheThreadPool::worker() { - CachedTileDesc *ct = NULL; + CachedTileDesc *ct; while (1) { gLockMutex(&mutex); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TileCache.h b/Build/source/libs/xpdf/xpdf-src/xpdf/TileCache.h index 1c3f83cba47..bea58c4c8fc 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TileCache.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TileCache.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "SplashTypes.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.cc index eaea7fa5676..70128a4a47f 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <string.h> #include <math.h> #include "gmempp.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.h b/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.h index 9efec4d0a16..aa06c9da7bd 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "SplashTypes.h" class GList; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc index fa262a28f94..d5916627082 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include "gmem.h" #include "gmempp.h" #include "GList.h" @@ -899,7 +903,7 @@ void TileMap::cvtDevToUser(int pg, int xd, int yd, double *xu, double *yu) { void TileMap::getWindowPageRange(int x, int y, int w, int h, int *firstPage, int *lastPage) { - GList *tiles2; + GList *tiles; PlacedTileDesc *tile; int i; @@ -909,9 +913,9 @@ void TileMap::getWindowPageRange(int x, int y, int w, int h, } *firstPage = state->getDoc()->getNumPages(); *lastPage = 0; - tiles2 = getTileList(); - for (i = 0; i < tiles2->getLength(); ++i) { - tile = (PlacedTileDesc *)tiles2->get(i); + tiles = getTileList(); + for (i = 0; i < tiles->getLength(); ++i) { + tile = (PlacedTileDesc *)tiles->get(i); if (tile->px < x + w && tile->px + tile->tw > x && tile->py < y + h && @@ -1348,7 +1352,7 @@ void TileMap::updatePageParams() { // rotate the page boxes if (page & 1) { otherPage = page + 1; - if (otherPage > state->getDoc()->getNumPages()) { + if (otherPage >= state->getDoc()->getNumPages()) { otherPage = page; } } else { diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.h b/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.h index 6a2dcb3e672..222877c5050 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" class GList; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeMap.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeMap.cc index 68e38c3a36e..833d6fc2f0c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeMap.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeMap.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <string.h> #include "gmem.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeMap.h b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeMap.h index d932d0e34c9..a15d628b4cc 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeMap.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeMap.h @@ -13,6 +13,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "CharTypes.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc index cfa28a0b79a..72dbc0e159c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdio.h> #include <string.h> #include "gmem.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h index 679c002987f..dbf435e7dd1 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h @@ -13,6 +13,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "CharTypes.h" struct UnicodeRemappingString; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.cc index a19bbe0d655..e6a91af2756 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.cc @@ -25,36 +25,36 @@ static UnicodeMapTableEntry typeTable[256] = { { "NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...NNNNN.....##########.NNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN.N....NNNNLNNNNN..##NLNNN#LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL", 'X' }, { NULL, 'L' }, { "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNNLLLLLLLNNNNNNNNNNNNNNLLNNNNNNNNNNNNNNLLLLLNNNNNNNNNLNNNNNNNNNNNNNNNNN", 'X' }, - {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LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLNNNLLLLLLLLLLLNNNLLLLLLLLLLLLNNNNLLLLLLLLLLLLLNNNLLLLLLLLLLLLLNNN", 'X' }, - { "NNNNNNNNNNNNNNLRNNNNNNNNNNNNNNNNNNNNNNNNNNLRNLR......NNNNNNNNNNNNNNN.NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNLLRNNNNNNNN#L########..NNNL##########..NNNLLLLLLLLLLLLLL....................................MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNNNNNN", 'X' }, + { "NNNNNNNNNNNNNNLRNNNNNNNNNNNNNNNNNNNNNNNNNNLRNLR......NNNNNNNNNNNNNNN.NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNLLRNNNNNNNN#L########..NNNL##########..NNNLLLLLLLLLLLLLL...................................NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", 'X' }, { "NNLNNNNLNNLLLLLLLLLLNLNNNLLLLLNNNNNNLNLNLNLLLL.LLLLLLLLLLLNNLLLLNNNNNLLLLLNNNNLLNNNNNNNNNNNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN", 'X' }, { "NNNNNNNNNNNNNNNNNN..NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN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 0xa7de, 0xa7df, 0xa7e0, 0xa7e1, 0xa7e2, 0xa7e3, 0xa7e4, 0xa7e5, 0xa7e6, 0xa7e7, 0xa7e8, 0xa7e9, 0xa7ea, 0xa7eb, 0xa7ec, 0xa7ed, 0xa7ee, 0xa7ef, 0xa7f0, 0xa7f1, 0xa7f2, 0xa7f3, 0xa7f4, 0xa7f6, 0xa7f6, 0xa7f7, @@ -858,40 +858,6 @@ static UnicodeCaseTableVector caseTableab = {{ 0xabf0, 0xabf1, 0xabf2, 0xabf3, 0xabf4, 0xabf5, 0xabf6, 0xabf7, 0xabf8, 0xabf9, 0xabfa, 0xabfb, 0xabfc, 0xabfd, 0xabfe, 0xabff }}; -static UnicodeCaseTableVector caseTablefb = {{ - 0xfb00, 0xfb01, 0xfb02, 0xfb03, 0xfb04, 0xfb06, 0xfb06, 0xfb07, - 0xfb08, 0xfb09, 0xfb0a, 0xfb0b, 0xfb0c, 0xfb0d, 0xfb0e, 0xfb0f, - 0xfb10, 0xfb11, 0xfb12, 0xfb13, 0xfb14, 0xfb15, 0xfb16, 0xfb17, - 0xfb18, 0xfb19, 0xfb1a, 0xfb1b, 0xfb1c, 0xfb1d, 0xfb1e, 0xfb1f, - 0xfb20, 0xfb21, 0xfb22, 0xfb23, 0xfb24, 0xfb25, 0xfb26, 0xfb27, - 0xfb28, 0xfb29, 0xfb2a, 0xfb2b, 0xfb2c, 0xfb2d, 0xfb2e, 0xfb2f, - 0xfb30, 0xfb31, 0xfb32, 0xfb33, 0xfb34, 0xfb35, 0xfb36, 0xfb37, - 0xfb38, 0xfb39, 0xfb3a, 0xfb3b, 0xfb3c, 0xfb3d, 0xfb3e, 0xfb3f, - 0xfb40, 0xfb41, 0xfb42, 0xfb43, 0xfb44, 0xfb45, 0xfb46, 0xfb47, - 0xfb48, 0xfb49, 0xfb4a, 0xfb4b, 0xfb4c, 0xfb4d, 0xfb4e, 0xfb4f, - 0xfb50, 0xfb51, 0xfb52, 0xfb53, 0xfb54, 0xfb55,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db, 0xfbdc, 0xfbdd, 0xfbde, 0xfbdf, - 0xfbe0, 0xfbe1, 0xfbe2, 0xfbe3, 0xfbe4, 0xfbe5, 0xfbe6, 0xfbe7, - 0xfbe8, 0xfbe9, 0xfbea, 0xfbeb, 0xfbec, 0xfbed, 0xfbee, 0xfbef, - 0xfbf0, 0xfbf1, 0xfbf2, 0xfbf3, 0xfbf4, 0xfbf5, 0xfbf6, 0xfbf7, - 0xfbf8, 0xfbf9, 0xfbfa, 0xfbfb, 0xfbfc, 0xfbfd, 0xfbfe, 0xfbff -}}; static UnicodeCaseTableVector caseTableff = {{ 0xff00, 0xff01, 0xff02, 0xff03, 0xff04, 0xff05, 0xff06, 0xff07, 0xff08, 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, @@ -1178,7 +1144,7 @@ static UnicodeCaseTableVector *caseTable[256] = { NULL, NULL, NULL, - &caseTablefb, + NULL, NULL, NULL, NULL, @@ -1434,8 +1400,8 @@ static Unicode bracketTable2e[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x80002e56, 0x2e55, 0x80002e58, - 0x2e57, 0x80002e5a, 0x2e59, 0x80002e5c, 0x2e5b, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1841,10 +1807,6 @@ GBool unicodeTypeR(Unicode c) { return getType(c) == 'R'; } -GBool unicodeTypeCombiningMark(Unicode c) { - return getType(c) == 'M'; -} - GBool unicodeTypeDigit(Unicode c) { return getType(c) == '#'; } @@ -1871,7 +1833,7 @@ GBool unicodeTypeWord(Unicode c) { char t; t = getType(c); - return t == 'L' || t == 'R' || t == '#' || t == 'M'; + return t == 'L' || t == 'R' || t == '#'; } Unicode unicodeToLower(Unicode c) { diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.h b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.h index f04361f9266..e1149fd6bc2 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeTypeTable.h @@ -15,8 +15,6 @@ extern GBool unicodeTypeL(Unicode c); extern GBool unicodeTypeR(Unicode c); -extern GBool unicodeTypeCombiningMark(Unicode c); - extern GBool unicodeTypeDigit(Unicode c); extern GBool unicodeTypeNumSep(Unicode c); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.cc index 24d0896aa84..c04b52f937a 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include "gmem.h" #include "gmempp.h" #include "GHash.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.h b/Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.h index c3c8ef1cbdd..283bdbe914d 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/WebFont.h @@ -13,6 +13,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "FoFiBase.h" #include "GfxFont.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.cc index 22b2f0d02e6..8002a07a7f6 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include "GString.h" #include "GHash.h" #include "Object.h" diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.h b/Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.h index 22aac009048..00ee6f7fcee 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/XFAScanner.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + class GHash; class ZxElement; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc index d3f9bcb2906..51af86db5ba 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc @@ -8,6 +8,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <stddef.h> #include <string.h> @@ -129,7 +133,7 @@ public: // Create an object stream, using object number <objStrNum>, // generation 0. - ObjectStream(XRef *xref, int objStrNumA, int recursion); + ObjectStream(XRef *xref, int objStrNumA); GBool isOk() { return ok; } @@ -151,7 +155,7 @@ private: GBool ok; }; -ObjectStream::ObjectStream(XRef *xref, int objStrNumA, int recursion) { +ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { Stream *str; Lexer *lexer; Parser *parser; @@ -165,7 +169,7 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA, int recursion) { objNums = NULL; ok = gFalse; - if (!xref->fetch(objStrNum, 0, &objStr, recursion)->isStream()) { + if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) { goto err1; } @@ -230,10 +234,11 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA, int recursion) { lexer->skipToEOF(); delete parser; - // skip to the first object - this generally shouldn't be needed, - // because offsets[0] is normally 0, but just in case... - if (offsets[0] > 0) { - objStr.getStream()->discardChars(offsets[0]); + // skip to the first object - this shouldn't be necessary because + // the First key is supposed to be equal to offsets[0], but just in + // case... + if (first < offsets[0]) { + objStr.getStream()->discardChars(offsets[0] - first); } // parse the objects @@ -875,7 +880,6 @@ GBool XRef::constructXRef() { char *p = buf; char *end = buf; GBool startOfLine = gTrue; - GBool space = gTrue; GBool eof = gFalse; while (1) { if (end - p < 256 && !eof) { @@ -896,7 +900,6 @@ GBool XRef::constructXRef() { constructTrailerDict((GFileOffset)(bufPos + (p + 7 - buf))); p += 7; startOfLine = gFalse; - space = gFalse; } else if (startOfLine && !strncmp(p, "endstream", 9)) { if (streamEndsLen == streamEndsSize) { streamEndsSize += 64; @@ -906,23 +909,19 @@ GBool XRef::constructXRef() { streamEnds[streamEndsLen++] = (GFileOffset)(bufPos + (p - buf)); p += 9; startOfLine = gFalse; - space = gFalse; - } else if (space && *p >= '0' && *p <= '9') { + } else if (startOfLine && *p >= '0' && *p <= '9') { p = constructObjectEntry(p, (GFileOffset)(bufPos + (p - buf)), &lastObjNum); startOfLine = gFalse; - space = gFalse; } else if (p[0] == '>' && p[1] == '>') { p += 2; startOfLine = gFalse; - space = gFalse; // skip any PDF whitespace except for '\0' while (*p == '\t' || *p == '\n' || *p == '\x0c' || *p == '\r' || *p == ' ') { if (*p == '\n' || *p == '\r') { startOfLine = gTrue; } - space = gTrue; ++p; } if (!strncmp(p, "stream", 6)) { @@ -936,17 +935,12 @@ GBool XRef::constructXRef() { } p += 6; startOfLine = gFalse; - space = gFalse; } } else { if (*p == '\n' || *p == '\r') { startOfLine = gTrue; - space = gTrue; - } else if (Lexer::isSpace(*p & 0xff)) { - space = gTrue; - } else { + } else if (!Lexer::isSpace(*p & 0xff)) { startOfLine = gFalse; - space = gFalse; } ++p; } @@ -1269,7 +1263,7 @@ Object *XRef::fetch(int num, int gen, Object *obj, int recursion) { error(errSyntaxError, -1, "Invalid object stream"); goto err; } - if (!getObjectStreamObject((int)e->offset, e->gen, num, obj, recursion)) { + if (!getObjectStreamObject((int)e->offset, e->gen, num, obj)) { goto err; } break; @@ -1303,37 +1297,20 @@ Object *XRef::fetch(int num, int gen, Object *obj, int recursion) { } GBool XRef::getObjectStreamObject(int objStrNum, int objIdx, - int objNum, Object *obj, int recursion) { - // check for a cached ObjectStream + int objNum, Object *obj) { + ObjectStream *objStr; + #if MULTITHREADED gLockMutex(&objStrsMutex); #endif - ObjectStream *objStr = getObjectStreamFromCache(objStrNum); - GBool found = gFalse; - if (objStr) { - objStr->getObject(objIdx, objNum, obj); - cleanObjectStreamCache(); - found = gTrue; - } + if (!(objStr = getObjectStream(objStrNum))) { #if MULTITHREADED - gUnlockMutex(&objStrsMutex); + gUnlockMutex(&objStrsMutex); #endif - if (found) { - return gTrue; - } - - // load a new ObjectStream - objStr = new ObjectStream(this, objStrNum, recursion); - if (!objStr->isOk()) { - delete objStr; return gFalse; } - objStr->getObject(objIdx, objNum, obj); -#if MULTITHREADED - gLockMutex(&objStrsMutex); -#endif - addObjectStreamToCache(objStr); cleanObjectStreamCache(); + objStr->getObject(objIdx, objNum, obj); #if MULTITHREADED gUnlockMutex(&objStrsMutex); #endif @@ -1341,19 +1318,22 @@ GBool XRef::getObjectStreamObject(int objStrNum, int objIdx, } // NB: objStrsMutex must be locked when calling this function. -ObjectStream *XRef::getObjectStreamFromCache(int objStrNum) { +ObjectStream *XRef::getObjectStream(int objStrNum) { + ObjectStream *objStr; + int i, j; + // check the MRU entry in the cache if (objStrs[0] && objStrs[0]->getObjStrNum() == objStrNum) { - ObjectStream *objStr = objStrs[0]; + objStr = objStrs[0]; objStrLastUse[0] = objStrTime++; return objStr; } // check the rest of the cache - for (int i = 1; i < objStrCacheLength; ++i) { + for (i = 1; i < objStrCacheLength; ++i) { if (objStrs[i] && objStrs[i]->getObjStrNum() == objStrNum) { - ObjectStream *objStr = objStrs[i]; - for (int j = i; j > 0; --j) { + objStr = objStrs[i]; + for (j = i; j > 0; --j) { objStrs[j] = objStrs[j - 1]; objStrLastUse[j] = objStrLastUse[j - 1]; } @@ -1363,30 +1343,33 @@ ObjectStream *XRef::getObjectStreamFromCache(int objStrNum) { } } - return NULL; -} + // load a new ObjectStream + objStr = new ObjectStream(this, objStrNum); + if (!objStr->isOk()) { + delete objStr; + return NULL; + } -// NB: objStrsMutex must be locked when calling this function. -void XRef::addObjectStreamToCache(ObjectStream *objStr) { // add to the cache if (objStrCacheLength == objStrCacheSize) { delete objStrs[objStrCacheSize - 1]; --objStrCacheLength; } - for (int j = objStrCacheLength; j > 0; --j) { + for (j = objStrCacheLength; j > 0; --j) { objStrs[j] = objStrs[j - 1]; objStrLastUse[j] = objStrLastUse[j - 1]; } ++objStrCacheLength; objStrs[0] = objStr; objStrLastUse[0] = objStrTime++; + + return objStr; } // If the oldest (least recently used) entry in the object stream // cache is more than objStrCacheTimeout accesses old (hasn't been // used in the last objStrCacheTimeout accesses), eject it from the // cache. -// NB: objStrsMutex must be locked when calling this function. void XRef::cleanObjectStreamCache() { // NB: objStrTime and objStrLastUse[] are unsigned ints, so the // mod-2^32 arithmetic makes the subtraction work out, even if the diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h b/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h index 662b8351c00..10e4e6a7501 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h @@ -11,6 +11,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" #include "gfile.h" #include "Object.h" @@ -179,9 +183,8 @@ private: GBool constructXRefEntry(int num, int gen, GFileOffset pos, XRefEntryType type); GBool getObjectStreamObject(int objStrNum, int objIdx, - int objNum, Object *obj, int recursion); - ObjectStream *getObjectStreamFromCache(int objStrNum); - void addObjectStreamToCache(ObjectStream *objStr); + int objNum, Object *obj); + ObjectStream *getObjectStream(int objStrNum); void cleanObjectStreamCache(); GFileOffset strToFileOffset(char *s); }; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Zoox.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/Zoox.cc index 2e41d990b59..9e4fb47900c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Zoox.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Zoox.cc @@ -6,6 +6,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma implementation +#endif + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -275,8 +279,6 @@ bool ZxDoc::parse(const char *data, Guint dataLen) { parseEnd = data + dataLen; parseSpace(); - parseBOM(); - parseSpace(); parseXMLDecl(this); parseMisc(this); parseDocTypeDecl(this); @@ -781,12 +783,6 @@ GString *ZxDoc::parseQuotedString() { return s; } -void ZxDoc::parseBOM() { - if (match("\xef\xbb\xbf")) { - parsePtr += 3; - } -} - void ZxDoc::parseSpace() { while (parsePtr < parseEnd && (*parsePtr == '\x20' || *parsePtr == '\x09' || diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/Zoox.h b/Build/source/libs/xpdf/xpdf-src/xpdf/Zoox.h index c89cd67b065..c04ca95064b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/Zoox.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/Zoox.h @@ -9,6 +9,10 @@ #include <aconf.h> +#ifdef USE_GCC_PRAGMAS +#pragma interface +#endif + #include "gtypes.h" class GString; @@ -106,7 +110,6 @@ private: void parsePI(ZxNode *par); GString *parseName(); GString *parseQuotedString(); - void parseBOM(); void parseSpace(); bool match(const char *s); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/config.h b/Build/source/libs/xpdf/xpdf-src/xpdf/config.h index 6bd00d500ae..b41dd492248 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/config.h +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/config.h @@ -2,7 +2,7 @@ // // config.h // -// Copyright 1996-2024 Glyph & Cog, LLC +// Copyright 1996-2022 Glyph & Cog, LLC // //======================================================================== @@ -14,13 +14,13 @@ //------------------------------------------------------------------------ // xpdf version -#define xpdfVersion "4.05" -#define xpdfVersionNum 4.05 +#define xpdfVersion "4.04" +#define xpdfVersionNum 4.04 #define xpdfMajorVersion 4 -#define xpdfMinorVersion 5 +#define xpdfMinorVersion 4 #define xpdfUpdateVersion 0 #define xpdfMajorVersionStr "4" -#define xpdfMinorVersionStr "5" +#define xpdfMinorVersionStr "4" #define xpdfUpdateVersionStr "0" // supported PDF version @@ -28,11 +28,11 @@ #define supportedPDFVersionNum 2.0 // copyright notice -#define xpdfCopyright "Copyright 1996-2024 Glyph & Cog, LLC" +#define xpdfCopyright "Copyright 1996-2022 Glyph & Cog, LLC" // Windows resource file stuff -#define winxpdfVersion "WinXpdf 4.05" -#define xpdfCopyrightAmp "Copyright 1996-2024 Glyph && Cog, LLC" +#define winxpdfVersion "WinXpdf 4.04" +#define xpdfCopyrightAmp "Copyright 1996-2022 Glyph && Cog, LLC" //------------------------------------------------------------------------ // paper size diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc index 1b80fe474b6..581383fe730 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc @@ -62,10 +62,6 @@ static ArgDesc argDesc[] = { }; int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - char *fileName; UnicodeMap *uMap; GString *ownerPW, *userPW; @@ -217,11 +213,4 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc index ad9e40d7c62..bde57557c3c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc @@ -96,10 +96,6 @@ static char *seenObjs; static int numObjects; int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - char *fileName; GString *ownerPW, *userPW; GBool ok; @@ -178,21 +174,22 @@ int main(int argc, char *argv[]) { numObjects = doc->getXRef()->getNumObjects(); seenObjs = (char *)gmalloc(numObjects); memset(seenObjs, 0, numObjects); - annots = doc->getAnnots(); for (pg = firstPage; pg <= lastPage; ++pg) { page = doc->getCatalog()->getPage(pg); if ((resDict = page->getResourceDict())) { scanFonts(resDict, doc); } - int nAnnots = annots->getNumAnnots(pg); - for (i = 0; i < nAnnots; ++i) { - if (annots->getAnnot(pg, i)->getAppearance(&obj1)->isStream()) { + annots = new Annots(doc, page->getAnnots(&obj1)); + obj1.free(); + for (i = 0; i < annots->getNumAnnots(); ++i) { + if (annots->getAnnot(i)->getAppearance(&obj1)->isStream()) { obj1.streamGetDict()->lookupNF("Resources", &obj2); scanFonts(&obj2, doc); obj2.free(); } obj1.free(); } + delete annots; } if ((form = doc->getCatalog()->getForm())) { for (i = 0; i < form->getNumFields(); ++i) { @@ -225,13 +222,6 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } static void scanFonts(Object *obj, PDFDoc *doc) { diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc index 303a046932d..346346bce77 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc @@ -76,10 +76,6 @@ static ArgDesc argDesc[] = { }; int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - PDFDoc *doc; char *fileName; char *imgRoot; @@ -175,11 +171,4 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc index a1fb5c2327d..88829b993c3 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc @@ -41,7 +41,6 @@ static void printInfoString(Object *infoDict, const char *infoKey, const char *xmpKey2, const char *text, GBool parseDate, UnicodeMap *uMap); -static void printCustomInfo(Object *infoDict, UnicodeMap *uMap); static GString *parseInfoDate(GString *s); static GString *parseXMPDate(GString *s); static void printBox(const char *text, PDFRectangle *box); @@ -51,7 +50,6 @@ static int lastPage = 0; static GBool printBoxes = gFalse; static GBool printMetadata = gFalse; static GBool rawDates = gFalse; -static GBool printCustom = gFalse; static char textEncName[128] = ""; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; @@ -70,8 +68,6 @@ static ArgDesc argDesc[] = { "print the document metadata (XML)"}, {"-rawdates", argFlag, &rawDates, 0, "print the undecoded date strings directly from the PDF file"}, - {"-custom", argFlag, &printCustom, 0, - "print the custom info dictionary fields"}, {"-enc", argString, textEncName, sizeof(textEncName), "output text encoding name"}, {"-opw", argString, ownerPassword, sizeof(ownerPassword), @@ -94,10 +90,6 @@ static ArgDesc argDesc[] = { }; int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - PDFDoc *doc; char *fileName; GString *ownerPW, *userPW; @@ -201,9 +193,6 @@ int main(int argc, char *argv[]) { printInfoString(&info, "Producer", xmp, "pdf:Producer", NULL, "Producer: ", gFalse, uMap); printInfoString(&info, "CreationDate", xmp, "xap:CreateDate", "xmp:CreateDate", "CreationDate: ", !rawDates, uMap); printInfoString(&info, "ModDate", xmp, "xap:ModifyDate", "xmp:ModifyDate", "ModDate: ", !rawDates, uMap); - if (printCustom) { - printCustomInfo(&info, uMap); - } info.free(); if (xmp) { delete xmp; @@ -315,9 +304,6 @@ int main(int argc, char *argv[]) { // print linearization info printf("Optimized: %s\n", doc->isLinearized() ? "yes" : "no"); - // print JavaScript info - printf("JavaScript: %s\n", doc->usesJavaScript() ? "yes" : "no"); - // print PDF version printf("PDF version: %.1f\n", doc->getPDFVersion()); @@ -347,13 +333,6 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } static void printInfoString(Object *infoDict, const char *infoKey, @@ -418,7 +397,7 @@ static void printInfoString(Object *infoDict, const char *infoKey, if (!parseDate || !(value = parseXMPDate(((ZxCharData *)node2)->getData()))) { tmp = ((ZxCharData *)node2)->getData(); - i = 0; + int i = 0; value = new GString(); while (getUTF8(tmp, &i, &uu)) { n = uMap->mapUnicode(uu, buf, sizeof(buf)); @@ -435,48 +414,12 @@ static void printInfoString(Object *infoDict, const char *infoKey, if (value) { fputs(text, stdout); - fwrite(value->getCString(), 1, value->getLength(), stdout); + fwrite(value->getCString(), 1, value->getLength(), stdout); fputc('\n', stdout); delete value; } } -static void printCustomInfo(Object *infoDict, UnicodeMap *uMap) { - if (!infoDict->isDict()) { - return; - } - for (int i = 0; i < infoDict->dictGetLength(); ++i) { - char *key = infoDict->dictGetKey(i); - Object obj; - infoDict->dictGetVal(i, &obj); - if (obj.isString() && - strcmp(key, "Title") && - strcmp(key, "Subject") && - strcmp(key, "Keywords") && - strcmp(key, "Author") && - strcmp(key, "Creator") && - strcmp(key, "Producer") && - strcmp(key, "CreationDate") && - strcmp(key, "ModDate")) { - printf("%s: ", key); - int n = 14 - (int)strlen(key); - if (n > 0) { - printf("%*s", n, ""); - } - TextString *s = new TextString(obj.getString()); - Unicode *u = s->getUnicode(); - char buf[8]; - for (int j = 0; j < s->getLength(); ++j) { - n = uMap->mapUnicode(u[j], buf, sizeof(buf)); - fwrite(buf, 1, n, stdout); - } - delete s; - printf("\n"); - } - obj.free(); - } -} - static GString *parseInfoDate(GString *s) { int year, mon, day, hour, min, sec, n; struct tm tmStruct; diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc index 92d78b0e5dc..4c98afed50c 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc @@ -38,9 +38,7 @@ static GBool embedFonts = gFalse; static GBool skipInvisible = gFalse; static GBool allInvisible = gFalse; static GBool formFields = gFalse; -static GBool includeMetadata = gFalse; static GBool tableMode = gFalse; -static GBool overwrite = gFalse; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; static GBool verbose = gFalse; @@ -72,12 +70,8 @@ static ArgDesc argDesc[] = { "treat all text as invisible"}, {"-formfields", argFlag, &formFields, 0, "convert form fields to HTML"}, - {"-meta", argFlag, &includeMetadata, 0, - "include document metadata in the HTML output"}, {"-table", argFlag, &tableMode, 0, "use table mode for text extraction"}, - {"-overwrite", argFlag, &overwrite, 0, - "overwrite files in an existing output directory"}, {"-opw", argString, ownerPassword, sizeof(ownerPassword), "owner password (for encrypted files)"}, {"-upw", argString, userPassword, sizeof(userPassword), @@ -108,10 +102,6 @@ static int writeToFile(void *file, const char *data, int size) { } int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - PDFDoc *doc; char *fileName; char *htmlDir; @@ -194,19 +184,10 @@ int main(int argc, char *argv[]) { // create HTML directory if (makeDir(htmlDir, 0755)) { - if (pathIsDir(htmlDir)) { - if (!overwrite) { - error(errIO, -1, "HTML output directory '{0:s}' already exists (use '-overwrite' to overwrite it)", - htmlDir); - exitCode = 2; - goto err1; - } - } else { - error(errIO, -1, "Couldn't create HTML output directory '{0:s}'", - htmlDir); - exitCode = 2; - goto err1; - } + error(errIO, -1, "Couldn't create HTML output directory '{0:s}'", + htmlDir); + exitCode = 2; + goto err1; } // set up the HTMLGen object @@ -223,7 +204,6 @@ int main(int argc, char *argv[]) { htmlGen->setExtractFontFiles(!noFonts); htmlGen->setEmbedFonts(embedFonts); htmlGen->setConvertFormFields(formFields); - htmlGen->setIncludeMetadata(includeMetadata); htmlGen->startDoc(doc); // convert the pages @@ -291,13 +271,6 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } static GBool createIndex(char *htmlDir) { @@ -307,12 +280,11 @@ static GBool createIndex(char *htmlDir) { htmlFileName = GString::format("{0:s}/index.html", htmlDir); html = openFile(htmlFileName->getCString(), "w"); + delete htmlFileName; if (!html) { error(errIO, -1, "Couldn't open HTML file '{0:t}'", htmlFileName); - delete htmlFileName; return gFalse; } - delete htmlFileName; fprintf(html, "<html>\n"); fprintf(html, "<body>\n"); diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc index e4107f59899..7f3b97b9d94 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc @@ -99,10 +99,6 @@ static void writePNGData(png_structp png, SplashBitmap *bitmap); static void finishPNG(png_structp *png, png_infop *pngInfo); int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - PDFDoc *doc; char *fileName; char *pngRoot; @@ -300,13 +296,6 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } static void setupPNG(png_structp *png, png_infop *pngInfo, FILE *f, diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc index c4dc3494a72..28861ef948b 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc @@ -98,10 +98,6 @@ static ArgDesc argDesc[] = { }; int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - PDFDoc *doc; char *fileName; char *ppmRoot; @@ -281,11 +277,4 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc index c6c7c4767ec..77e90fe0165 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc @@ -153,10 +153,6 @@ static ArgDesc argDesc[] = { }; int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - PDFDoc *doc; char *fileName; GString *psFileName; @@ -400,11 +396,4 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } diff --git a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc index 928de607678..d8bf6df5e67 100644 --- a/Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc +++ b/Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc @@ -132,10 +132,6 @@ static ArgDesc argDesc[] = { }; int main(int argc, char *argv[]) { -#if USE_EXCEPTIONS - try { -#endif - PDFDoc *doc; char *fileName; GString *textFileName; @@ -333,11 +329,4 @@ int main(int argc, char *argv[]) { gMemReport(stderr); return exitCode; - -#if USE_EXCEPTIONS - } catch (GMemException e) { - fprintf(stderr, "Out of memory\n"); - return 98; - } -#endif } |