Commit d1a4c5a9 authored by Denis Onishchenko's avatar Denis Onishchenko Committed by Albert Astals Cid

Fix 2 errors in computation of type3 glyphs transformation matrix

parent 5dadcc93
......@@ -40,6 +40,7 @@
// Copyright (C) 2014 Jason Crain <jason@aquaticape.us>
// Copyright (C) 2017, 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
// Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
// Copyright (C) 2018 Denis Onishchenko <denis.onischenko@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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment