summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdpdf.cxx
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-05-14 19:57:15 -0400
committerJan Holesovsky <kendy@collabora.com>2018-06-07 10:45:30 +0200
commit3e3f4a7240e2e1fd041f68246171f34ce950311f (patch)
tree87ba40b00a061f74258077bfd79f8c80348cc519 /svx/source/svdraw/svdpdf.cxx
parent7181931acd7d7612eb26d7fc43feb743a3972a08 (diff)
svx: transform PDF text rectangles while importing
Change-Id: I7675a183bfb691a8783950f33dc34826f91cb768
Diffstat (limited to 'svx/source/svdraw/svdpdf.cxx')
-rw-r--r--svx/source/svdraw/svdpdf.cxx26
1 files changed, 16 insertions, 10 deletions
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index a4cdaad5ba52..c556b1bb3af6 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -1070,17 +1070,23 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex
return;
}
- const tools::Rectangle aRect = PointsToLogic(left, right, top, bottom);
-
double a, b, c, d, e, f;
FPDFTextObj_GetMatrix(pPageObject, &a, &b, &c, &d, &e, &f);
- Matrix aTextMatrix(a, b, c, d, e, f);
- aTextMatrix.Concatinate(mCurMatrix);
- SAL_WARN("sd.filter", "Got font scale matrix (" << a << ", " << b << ", " << c << ", " << d
- << ", " << e << ", " << f << ')');
- Point aPos = PointsToLogic(e, f);
+ // Matrix aTextMatrix(a, b, c, d, e, f);
+ Matrix aTextMatrix(mCurMatrix);
+ SAL_WARN("sd.filter", "Got text matrix " << aTextMatrix.toString());
+ SAL_WARN("sd.filter", "Context matrix " << mCurMatrix.toString());
+ // aTextMatrix.Concatinate(mCurMatrix);
+ // SAL_WARN("sd.filter", "Got text matrix concat " << aTextMatrix.toString());
+
+ Point aPos = PointsToLogic(aTextMatrix.e(), aTextMatrix.f());
SAL_WARN("sd.filter", "Got TEXT origin: " << aPos);
- SAL_WARN("sd.filter", "Got TEXT Bounds: " << aRect);
+
+ const tools::Rectangle aRect2 = PointsToLogic(left, right, top, bottom);
+ SAL_WARN("sd.filter", "Untransformed TEXT Bounds: " << aRect2);
+ aTextMatrix.Transform(left, right, top, bottom);
+ const tools::Rectangle aRect = PointsToLogic(left, right, top, bottom);
+ SAL_WARN("sd.filter", "Transformed TEXT Bounds: " << aRect);
const int nChars = FPDFTextObj_CountChars(pPageObject) * 2;
std::unique_ptr<sal_Unicode[]> pText(new sal_Unicode[nChars + 1]); // + terminating null
@@ -1415,9 +1421,9 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd
float fWidth = 1;
FPDFPath_GetStrokeWidth(pPageObject, &fWidth);
- const double dWidth = 0.5 * fabs(sqrt2(mCurMatrix.a(), mCurMatrix.c()) * fWidth);
+ const double dWidth = 0.5 * fabs(sqrt2(aPathMatrix.a(), aPathMatrix.c()) * fWidth);
mnLineWidth = lcl_ToLogic(lcl_PointToPixel(dWidth));
- mnLineWidth /= 2;
+ // mnLineWidth /= 2;
SAL_WARN("sd.filter", "Path Stroke Width: " << fWidth << ", scaled: " << dWidth
<< ", Logical: " << mnLineWidth);