[poppler] Branch 'refs/remotes/origin/HEAD' - 8 commits - fofi/FoFiTrueType.cc glib/poppler-page.cc poppler/Annot.cc poppler/Annot.h poppler/CairoFontEngine.cc poppler/CairoOutputDev.cc poppler/CairoOutputDev.h poppler/Catalog.cc poppler/Form.cc qt4/src
Albert Astals Cid
aacid at kemper.freedesktop.org
Mon Oct 22 12:43:40 PDT 2007
fofi/FoFiTrueType.cc | 10 ++++++----
glib/poppler-page.cc | 25 ++++++++++++++++++++++---
poppler/Annot.cc | 3 ++-
poppler/Annot.h | 2 ++
poppler/CairoFontEngine.cc | 6 ++++++
poppler/CairoOutputDev.cc | 9 +++++++++
poppler/CairoOutputDev.h | 2 +-
poppler/Catalog.cc | 3 +--
poppler/Form.cc | 2 +-
qt4/src/poppler-embeddedfile.cc | 1 +
qt4/src/poppler-private.h | 2 +-
11 files changed, 52 insertions(+), 13 deletions(-)
New commits:
commit dbe975c129999a3efceb1c86518fa6fda74f685c
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Mon Oct 22 11:25:37 2007 +0200
Fix a crash with invalid TrueType fonts
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index abfca73..77a7ad2 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -912,10 +912,12 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
badCmapLen = gFalse;
cmapLen = 0; // make gcc happy
if (!missingCmap) {
- cmapLen = cmaps[0].offset + cmaps[0].len;
- for (i = 1; i < nCmaps; ++i) {
- if (cmaps[i].offset + cmaps[i].len > cmapLen) {
- cmapLen = cmaps[i].offset + cmaps[i].len;
+ if (nCmaps > 0) {
+ cmapLen = cmaps[0].offset + cmaps[0].len;
+ for (i = 1; i < nCmaps; ++i) {
+ if (cmaps[i].offset + cmaps[i].len > cmapLen) {
+ cmapLen = cmaps[i].offset + cmaps[i].len;
+ }
}
}
cmapLen -= tables[cmapIdx].offset;
commit 8bfe30a48fd7021591ab307bd51f86c06ff202b9
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Fri Oct 19 15:46:50 2007 +0200
Do not generate appearance stream for radio button that are not active
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index d56e50f..850b729 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -536,7 +536,8 @@ void Annot::generateFieldAppearance(Dict *field, Dict *annot, Dict *acroForm) {
if (ff & fieldFlagRadio) {
//~ Acrobat doesn't draw a caption if there is no AP dict (?)
if (Form::fieldLookup(field, "V", &obj1)->isName()) {
- if (annot->lookup("AS", &obj2)->isName(obj1.getName())) {
+ if (annot->lookup("AS", &obj2)->isName(obj1.getName()) &&
+ strcmp (obj1.getName(), "Off") != 0) {
if (caption) {
drawText(caption, da, fontDict, gFalse, 0, fieldQuadCenter,
gFalse, gTrue);
commit 1a531dcfee1c6fc79a414c38cbe7327fbf9a59d8
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Fri Oct 19 13:12:24 2007 +0200
Fix a crash with invalid embedded fonts
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index e1bf537..8baca95 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -77,6 +77,12 @@ CairoFont *CairoFont::create(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool
refObj.initRef(embRef.num, embRef.gen);
refObj.fetch(xref, &strObj);
refObj.free();
+ if (!strObj.isStream()) {
+ error(-1, "Embedded font object is wrong type");
+ strObj.free();
+ fclose(tmpFile);
+ goto err2;
+ }
strObj.streamReset();
while ((c = strObj.streamGetChar()) != EOF) {
fputc(c, tmpFile);
commit e1740278457e512676b623bcdf9968193f0a8d7b
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Fri Oct 19 12:21:54 2007 +0200
Do not draw annotations when rendering for printing
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 3671001..e325092 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -406,6 +406,21 @@ poppler_page_copy_to_pixbuf(PopplerPage *page,
#endif
+static GBool
+poppler_print_annot_cb (Annot *annot, void *user_data)
+{
+ GooString *annot_type;
+
+ annot_type = annot->getType ();
+ if (!annot_type)
+ return gFalse;
+
+ if (annot_type->cmp ("Widget") == 0)
+ return gTrue;
+
+ return gFalse;
+}
+
#if defined (HAVE_CAIRO)
static void
@@ -429,7 +444,9 @@ _poppler_page_render (PopplerPage *page,
-1, -1,
-1, -1,
printing,
- page->document->doc->getCatalog ());
+ page->document->doc->getCatalog (),
+ NULL, NULL,
+ printing ? poppler_print_annot_cb : NULL, NULL);
output_dev->setCairo (NULL);
}
@@ -469,7 +486,7 @@ poppler_page_render_for_printing (PopplerPage *page,
_poppler_page_render (page, cairo, gTrue);
}
-#endif
+#endif /* HAVE_CAIRO */
static void
_poppler_page_render_to_pixbuf (PopplerPage *page,
@@ -492,7 +509,9 @@ _poppler_page_render_to_pixbuf (PopplerPage *page,
src_x, src_y,
src_width, src_height,
printing,
- page->document->doc->getCatalog ());
+ page->document->doc->getCatalog (),
+ NULL, NULL,
+ printing ? poppler_print_annot_cb : NULL, NULL);
poppler_page_copy_to_pixbuf (page, pixbuf, &data);
}
diff --git a/poppler/Annot.h b/poppler/Annot.h
index a567c9f..50f5bfb 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -87,6 +87,8 @@ public:
double getFontSize() { return fontSize; }
+ GooString *getType() { return type; }
+
private:
void setColor(Array *a, GBool fill, int adjust);
void drawText(GooString *text, GooString *da, GfxFontDict *fontDict,
commit a4d25f79dfc1a7e4998e2e113ef92312bd4af553
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Tue Oct 16 15:24:08 2007 +0200
Detect form fields at any depth level
We were ignoring non root form fields that contain only a kids dictionary.
See evince bug: http://bugzilla.gnome.org/show_bug.cgi?id=486957
diff --git a/poppler/Form.cc b/poppler/Form.cc
index 022bdb1..334e45c 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -685,7 +685,7 @@ FormField::FormField(XRef* xrefA, Object *aobj, const Ref& aref, Form* aform, Fo
_createWidget(&obj2, childRef.getRef());
}
obj4.free();
- } else if(obj2.dictLookup("FT", &obj3)->isName()) {
+ } else if(obj2.dictLookup("FT", &obj3)->isName() || obj2.dictLookup("Kids", &obj3)->isArray()) {
if(terminal) error(-1, "Field can't have both Widget AND Field as kids\n");
numChildren++;
commit 03e1da99f7393fb1103643311b0b5af7b875e09c
Author: Jeff Muizelaar <jeff at infidigm.net>
Date: Sat Oct 13 19:38:15 2007 -0400
Add an implementation of CairoOutputDev::startPage()
The implementation initializes fill_pattern and stroke_pattern
to black matching SplashOutputDev. This fixes #12504.
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index d2a57b6..2d4f663 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -128,6 +128,15 @@ void CairoOutputDev::startDoc(XRef *xrefA) {
fontEngine = new CairoFontEngine(ft_lib);
}
+void CairoOutputDev::startPage(int pageNum, GfxState *state) {
+ /* set up some per page defaults */
+ cairo_pattern_destroy(fill_pattern);
+ fill_pattern = cairo_pattern_create_rgb(0., 0., 0.);
+
+ cairo_pattern_destroy(stroke_pattern);
+ stroke_pattern = cairo_pattern_create_rgb(0., 0., 0.);
+}
+
void CairoOutputDev::drawLink(Link *link, Catalog *catalog) {
}
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 07fe186..8cfe32e 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -82,7 +82,7 @@ public:
//----- initialization and control
// Start a page.
- virtual void startPage(int pageNum, GfxState *state) { }
+ virtual void startPage(int pageNum, GfxState *state);
// End a page.
virtual void endPage() { }
commit 825c942d46e0c3e254028441015c5dd8440cc734
Author: Albert Astals Cid <tsdgeos at bluebox.localdomain>
Date: Fri Oct 12 13:47:09 2007 +0200
Copy the embeddef file description string correctly
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index be31bd4..2e12aed 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -383,8 +383,7 @@ EmbFile *Catalog::embeddedFile(int i)
Object obj, obj2;
obj = embeddedFileNameTree.getValue(i);
GooString *fileName = new GooString();
- char *descString = embeddedFileNameTree.getName(i)->getCString();
- GooString *desc = new GooString(descString);
+ GooString *desc = new GooString(embeddedFileNameTree.getName(i));
GooString *createDate = new GooString();
GooString *modDate = new GooString();
GooString *checksum = new GooString();
commit 5e60da78695eff44cc10dbce46ef170727f682b1
Author: Albert Astals Cid <tsdgeos at bluebox.localdomain>
Date: Fri Oct 12 13:46:52 2007 +0200
Correctly delete the embedded file stream
diff --git a/qt4/src/poppler-embeddedfile.cc b/qt4/src/poppler-embeddedfile.cc
index 5b63d31..5d60dd1 100644
--- a/qt4/src/poppler-embeddedfile.cc
+++ b/qt4/src/poppler-embeddedfile.cc
@@ -56,6 +56,7 @@ EmbeddedFile::EmbeddedFile(EmbFile *embfile)
EmbeddedFile::~EmbeddedFile()
{
+ m_embeddedFile->m_streamObject.free();
delete m_embeddedFile;
}
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 43a67c8..8ab8b59 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -134,8 +134,8 @@ namespace Poppler {
~DocumentData()
{
- delete doc;
qDeleteAll(m_embeddedFiles);
+ delete doc;
delete m_outputDev;
delete m_fontInfoScanner;
More information about the poppler
mailing list