[poppler] poppler/Gfx.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 20 20:58:35 UTC 2018


 poppler/Gfx.cc |   28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

New commits:
commit d1a4c5a9faf95618fc302c358021a745afc0527c
Author: Denis Onishchenko <denis.onischenko at gmail.com>
Date:   Thu Sep 20 22:57:03 2018 +0200

    Fix 2 errors in computation of type3 glyphs transformation matrix

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index df065b0d..4b8b1229 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -40,6 +40,7 @@
 // Copyright (C) 2014 Jason Crain <jason at aquaticape.us>
 // Copyright (C) 2017, 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by the LiMux project of the city of Munich
 // Copyright (C) 2018 Adam Reichold <adam.reichold at t-online.de>
+// Copyright (C) 2018 Denis Onishchenko <denis.onischenko at gmail.com>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -3884,8 +3885,8 @@ void Gfx::doShowText(const GooString *s) {
   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;
+  double tmp[4], newCTM[6];
+  double *oldCTM, *mat;
   Dict *resDict;
   Parser *oldParser;
   GfxState *savedState;
@@ -3925,26 +3926,23 @@ void Gfx::doShowText(const GooString *s) {
 
   // handle a Type 3 char
   if (font->getType() == fontType3 && out->interpretType3Chars()) {
-    mat = state->getCTM();
-    for (i = 0; i < 6; ++i) {
-      oldCTM[i] = mat[i];
-    }
+    oldCTM = state->getCTM();
     mat = state->getTextMat();
-    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];
-    newCTM[3] = mat[2] * oldCTM[1] + mat[3] * oldCTM[3];
+    tmp[0] = mat[0] * oldCTM[0] + mat[1] * oldCTM[2];
+    tmp[1] = mat[0] * oldCTM[1] + mat[1] * oldCTM[3];
+    tmp[2] = mat[2] * oldCTM[0] + mat[3] * oldCTM[2];
+    tmp[3] = mat[2] * oldCTM[1] + mat[3] * oldCTM[3];
     mat = font->getFontMatrix();
-    newCTM[0] = mat[0] * newCTM[0] + mat[1] * newCTM[2];
-    newCTM[1] = mat[0] * newCTM[1] + mat[1] * newCTM[3];
-    newCTM[2] = mat[2] * newCTM[0] + mat[3] * newCTM[2];
-    newCTM[3] = mat[2] * newCTM[1] + mat[3] * newCTM[3];
+    newCTM[0] = mat[0] * tmp[0] + mat[1] * tmp[2];
+    newCTM[1] = mat[0] * tmp[1] + mat[1] * tmp[3];
+    newCTM[2] = mat[2] * tmp[0] + mat[3] * tmp[2];
+    newCTM[3] = mat[2] * tmp[1] + mat[3] * tmp[3];
     newCTM[0] *= state->getFontSize();
     newCTM[1] *= state->getFontSize();
     newCTM[2] *= state->getFontSize();
     newCTM[3] *= state->getFontSize();
     newCTM[0] *= state->getHorizScaling();
-    newCTM[2] *= state->getHorizScaling();
+    newCTM[1] *= state->getHorizScaling();
     curX = state->getCurX();
     curY = state->getCurY();
     oldParser = parser;


More information about the poppler mailing list