[poppler] Branch 'poppler-0.10' - poppler/CairoOutputDev.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Thu Nov 20 00:55:29 PST 2008


 poppler/CairoOutputDev.cc |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 10290d01476f82c5a48194e59e76b97f331ca31b
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Nov 12 20:40:57 2008 +1030

    Ensure cairo font matrix is invertable
    
    Fixes bugs #18254 and #18429

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 03cc059..9933d8e 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -399,7 +399,7 @@ void CairoOutputDev::updateStrokeOpacity(GfxState *state) {
 
 void CairoOutputDev::updateFont(GfxState *state) {
   cairo_font_face_t *font_face;
-  cairo_matrix_t matrix;
+  cairo_matrix_t matrix, invert_matrix;
 
   LOG(printf ("updateFont() font=%s\n", state->getFont()->getName()->getCString()));
 
@@ -430,6 +430,19 @@ void CairoOutputDev::updateFont(GfxState *state) {
   matrix.yy = -m[3] * fontSize;
   matrix.x0 = 0;
   matrix.y0 = 0;
+
+ /* Make sure the font matrix is invertible before setting it.  cairo
+  * will blow up if we give it a matrix that's not invertible, so we
+  * need to check before passing it to cairo_set_font_matrix. Ignoring it
+  * is likely to give better results than not rendering anything at
+  * all. See #18254.
+  */
+  invert_matrix = matrix;
+  if (cairo_matrix_invert(&invert_matrix)) {
+    warning("font matrix not invertible\n");
+    return;
+  }
+
   cairo_set_font_matrix (cairo, &matrix);
 }
 


More information about the poppler mailing list