summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2012-01-26 00:37:17 +1030
committerAdrian Johnson <ajohnson@redneon.com>2014-10-08 06:44:20 +1030
commitcbf2652c483d7010fc36191c8b209a57eeec93d8 (patch)
tree8f625dfacaefdcec385b5ba5a7fd54c3671bba11
parent4fe17e97a4bd7873caad771c446199b282039697 (diff)
cairo: don't render text when text matrix is not invertable
Emulates acroread behavior. Bug 78042
-rw-r--r--poppler/CairoOutputDev.cc14
-rw-r--r--poppler/CairoOutputDev.h1
2 files changed, 10 insertions, 5 deletions
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 1c67b5c1..e4ae9d74 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -147,6 +147,7 @@ CairoOutputDev::CairoOutputDev() {
inUncoloredPattern = gFalse;
inType3Char = gFalse;
t3_glyph_has_bbox = gFalse;
+ text_matrix_valid = gTrue;
groupColorSpaceStack = NULL;
maskStack = NULL;
@@ -283,6 +284,8 @@ void CairoOutputDev::restoreState(GfxState *state) {
if (cairo_shape)
cairo_restore (cairo_shape);
+ text_matrix_valid = gTrue;
+
/* These aren't restored by cairo_restore() since we keep them in
* the output device. */
updateFillColor(state);
@@ -657,11 +660,13 @@ void CairoOutputDev::updateFont(GfxState *state) {
*/
invert_matrix = matrix;
if (cairo_matrix_invert(&invert_matrix)) {
- error(errSyntaxWarning, -1, "font matrix not invertible\n");
+ error(errSyntaxWarning, -1, "font matrix not invertible");
+ text_matrix_valid = gFalse;
return;
}
cairo_set_font_matrix (cairo, &matrix);
+ text_matrix_valid = gTrue;
}
/* Tolerance in pixels for checking if strokes are horizontal or vertical
@@ -1250,10 +1255,8 @@ void CairoOutputDev::endString(GfxState *state)
// ignore empty strings and invisible text -- this is used by
// Acrobat Capture
render = state->getRender();
- if (render == 3 || glyphCount == 0) {
- gfree(glyphs);
- glyphs = NULL;
- return;
+ if (render == 3 || glyphCount == 0 || !text_matrix_valid) {
+ goto finish;
}
if (!(render & 1)) {
@@ -1305,6 +1308,7 @@ void CairoOutputDev::endString(GfxState *state)
}
}
+finish:
gfree (glyphs);
glyphs = NULL;
if (use_show_text_glyphs) {
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 28f97fdd..26e6c447 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -315,6 +315,7 @@ protected:
GBool needFontUpdate; // set when the font needs to be updated
GBool printing;
GBool use_show_text_glyphs;
+ GBool text_matrix_valid;
cairo_surface_t *surface;
cairo_glyph_t *glyphs;
int glyphCount;