summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx25
-rw-r--r--svgio/qa/cppunit/data/tdf86938.svg13
-rw-r--r--svgio/source/svgreader/svgcharacternode.cxx2
3 files changed, 39 insertions, 1 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 53f6b23da4fd..d68e7ebf728a 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -746,6 +746,31 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf85770)
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "familyname", "Times New Roman");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf86938)
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf86938.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "line");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", "290");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", "183");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "above");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", "290");
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 159
+ // - Actual : 207
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "159");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", "below");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", "290");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", "207");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf93583)
{
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf93583.svg");
diff --git a/svgio/qa/cppunit/data/tdf86938.svg b/svgio/qa/cppunit/data/tdf86938.svg
new file mode 100644
index 000000000000..40287a39de88
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf86938.svg
@@ -0,0 +1,13 @@
+<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">
+ <text
+ x="290"
+ y="183"> line </text>
+ <text
+ x="290"
+ y="183"
+ baseline-shift="24"> above </text>
+ <text
+ x="290"
+ y="183"
+ baseline-shift="-24"> below </text>
+</svg>
diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx
index ebc317c3a445..91ec98ae9b68 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -301,7 +301,7 @@ namespace svgio::svgreader
const SvgNumber aNumber(rSvgStyleAttributes.getBaselineShiftNumber());
const double mfBaselineShift(aNumber.solve(*this));
- aPosition.setY(aPosition.getY() + mfBaselineShift);
+ aPosition.setY(aPosition.getY() - mfBaselineShift);
break;
}
default: // BaselineShift::Baseline