[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - svgio/inc svgio/qa svgio/source
svgio/inc/svgstyleattributes.hxx |3 + svgio/qa/cppunit/SvgImportTest.cxx| 24 ++ svgio/qa/cppunit/data/ClipRule.svg| 18 ++ svgio/source/svgreader/svgstyleattributes.cxx | 44 +++--- 4 files changed, 78 insertions(+), 11 deletions(-) New commits: commit ddd79065bd3844397c05aa2150269201526984c2 Author: Xisco Fauli AuthorDate: Thu Jul 28 18:37:32 2022 +0200 Commit: Christian Lohmaier CommitDate: Thu Aug 18 19:19:42 2022 +0200 svgio: Add support for clip-rule="evenodd" Change-Id: I028aa88bdd72b4f87526a3d1edabd612d7686571 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137577 Tested-by: Jenkins Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137586 (cherry picked from commit 2b22203c0be09e9685cf081f0a1fafa538a21294) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137973 Reviewed-by: Christian Lohmaier diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx index 8db2fa0676f6..dd5c16daab43 100644 --- a/svgio/inc/svgstyleattributes.hxx +++ b/svgio/inc/svgstyleattributes.hxx @@ -338,6 +338,9 @@ namespace svgio::svgreader /// fill rule content FillRule getFillRule() const; +/// clip rule content +FillRule getClipRule() const; + /// fill StrokeDasharray content const SvgNumberVector& getStrokeDasharray() const; diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index f9fc88f812de..cc4aae90bd39 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -62,6 +62,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testClipPathAndParentStyle(); void testClipPathAndStyle(); void testClipPathUsingClipPath(); +void testClipRule(); void testi125329(); void testMaskingPath07b(); void test123926(); @@ -103,6 +104,7 @@ public: CPPUNIT_TEST(testClipPathAndParentStyle); CPPUNIT_TEST(testClipPathAndStyle); CPPUNIT_TEST(testClipPathUsingClipPath); +CPPUNIT_TEST(testClipRule); CPPUNIT_TEST(testi125329); CPPUNIT_TEST(testMaskingPath07b); CPPUNIT_TEST(test123926); @@ -624,6 +626,28 @@ void Test::testClipPathUsingClipPath() assertXPath(pDocument, "/primitive2D/transform/mask/mask/polypolygon/polygon/point", 13); } +void Test::testClipRule() +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/ClipRule.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); + +CPPUNIT_ASSERT (pDocument); + +// Without the place in place, this test would have failed with +// - Expected: 5 +// - Actual : 10 +assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygon/polygon/point", 5); +assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor", "color", "#ff"); +assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point", 5); + +assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon/point", 5); +assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor", "color", "#ff"); +assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point", 5); +} + void Test::testi125329() { //Check style inherit from * css element diff --git a/svgio/qa/cppunit/data/ClipRule.svg b/svgio/qa/cppunit/data/ClipRule.svg new file mode 100644 index ..55f0cb9eee3a --- /dev/null +++ b/svgio/qa/cppunit/data/ClipRule.svg @@ -0,0 +1,18 @@ +http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink;> + + + + + + + + + + + + + + + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 8084ed5f0239..333ff7dbd317 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1117,17 +1117,18 @@ namespace svgio::svgreader { // create fill basegfx::B2DPolyPolygon aPath(rPath); -const bool bNeedToCheckClipRule(SVGToken::Path == mrOwner.getType() || SVGToken::Polygon == mrOwner.getType()); -const bool bClipPathIsNonzero(bNeedToCheckClipRule && mbIsClipPathContent && FillRule::nonzero == maClipRule); -const bool bFillRuleIsNonzero(bNeedToCheckClipRule && !mbIsClipPathContent && FillRule::nonzero == getFillRule()); -if(bClipPathIsNonzero || bFillRuleIsNonzero) +if(SVGToken::Path == mrOwner.getType() || SVGToken::Polygon == mrOwner.getType())
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - svgio/inc svgio/qa svgio/source
svgio/inc/svgstyleattributes.hxx |2 - svgio/qa/cppunit/SvgImportTest.cxx | 17 ++ svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg | 13 svgio/source/svgreader/svgstyleattributes.cxx | 27 + 4 files changed, 53 insertions(+), 6 deletions(-) New commits: commit 9e18bc8eca8bf340f765d2eb2d8bcad83b4412b3 Author: Xisco Fauli AuthorDate: Fri Jul 15 02:14:53 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Jul 26 11:31:29 2022 +0200 tdf#97539; if parent is css style, look one level up if the style attributes are set like it works, however, if it uses a css style like it fails to get the clipPath from the parent, because the css style is the direct parent, thus, check one level up Change-Id: Iff6df95c9fa9da4c2f1a986cca0ad82ab1494353 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137094 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 1eff99718e3cfc01961dc798d708e574f669b200) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137064 Reviewed-by: Adolfo Jayme Barrientos Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137217 Reviewed-by: Michael Stahl diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx index 3fbb7a2ff324..8db2fa0676f6 100644 --- a/svgio/inc/svgstyleattributes.hxx +++ b/svgio/inc/svgstyleattributes.hxx @@ -411,7 +411,7 @@ namespace svgio::svgreader const OUString& getDesc() const { return maDesc; } // ClipPathXLink content -OUString const & getClipPathXLink() const; +OUString getClipPathXLink() const; const SvgClipPathNode* accessClipPathXLink() const; // MaskXLink content diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 8dc8a3989a08..9a78f6a18bae 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -58,6 +58,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testNoneColor(); void testTdf97936(); void testTdf149893(); +void testShapeWithClipPathAndCssStyle(); void testClipPathAndParentStyle(); void testClipPathAndStyle(); void testi125329(); @@ -97,6 +98,7 @@ public: CPPUNIT_TEST(testNoneColor); CPPUNIT_TEST(testTdf97936); CPPUNIT_TEST(testTdf149893); +CPPUNIT_TEST(testShapeWithClipPathAndCssStyle); CPPUNIT_TEST(testClipPathAndParentStyle); CPPUNIT_TEST(testClipPathAndStyle); CPPUNIT_TEST(testi125329); @@ -555,6 +557,21 @@ void Test::testTdf149893() assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#008000"); } +void Test::testShapeWithClipPathAndCssStyle() +{ +// tdf#97539: Check there is a mask and 3 polygons +Primitive2DSequence aSequenceClipPathAndStyle = parseSvg(u"/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequenceClipPathAndStyle.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequenceClipPathAndStyle)); + +CPPUNIT_ASSERT (pDocument); + +assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon", 2); +assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon", 1); +} + void Test::testClipPathAndParentStyle() { //Check that fill color, stroke color and stroke-width are inherited from use element diff --git a/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg b/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg new file mode 100644 index ..4b6455c64930 --- /dev/null +++ b/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg @@ -0,0 +1,13 @@ + +http://www.w3.org/2000/svg;> + + + + + + + + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index df200e40f428..891c5ff76c7e 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1188,11 +1188,10 @@ namespace svgio::svgreader } const SvgClipPathNode* pClip = accessClipPathXLink(); -while(pClip) +if(pClip) { // #i124852# transform may be needed when SvgUnits::userSpaceOnUse pClip->apply(aSource, pTransform); -pClip = pClip->getSvgStyleAttributes()->accessClipPathXLink(); } if(!aSource.empty()) // test again, applied clipPath may have lead to empty geometry @@ -1270,7 +1269,7 @@ namespace svgio::svgreader maClipRule(FillRule::nonzero), maBaselineShift(BaselineShift::Baseline),
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - svgio/inc svgio/qa svgio/source
svgio/inc/svgtoken.hxx |1 + svgio/qa/cppunit/data/ClipPathAndStyle.svg |4 ++-- svgio/source/svgreader/svganode.cxx|1 + svgio/source/svgreader/svggradientnode.cxx |1 + svgio/source/svgreader/svgimagenode.cxx|1 + svgio/source/svgreader/svgpatternnode.cxx |1 + svgio/source/svgreader/svgtextpathnode.cxx |1 + svgio/source/svgreader/svgtoken.cxx|2 ++ svgio/source/svgreader/svgtrefnode.cxx |1 + svgio/source/svgreader/svgusenode.cxx |1 + 10 files changed, 12 insertions(+), 2 deletions(-) New commits: commit 417836d5d77d6c90d2117d73f4bc4c7bfc9287f7 Author: Xisco Fauli AuthorDate: Wed Jul 13 17:03:55 2022 +0200 Commit: Michael Stahl CommitDate: Fri Jul 15 10:53:11 2022 +0200 svgio: use href along with xlink:href xlink:href has been deprecated. See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href Change-Id: I622cd975c0bcc1a819831d7b9c867312ff59affa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137035 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 64d80a62fe39c66d2f95979d75bd06da2bc01213) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136992 Reviewed-by: Michael Stahl diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx index 16b7aad5f696..0a24d272be5f 100644 --- a/svgio/inc/svgtoken.hxx +++ b/svgio/inc/svgtoken.hxx @@ -153,6 +153,7 @@ namespace svgio::svgreader GradientUnits, GradientTransform, SpreadMethod, +Href, XlinkHref, StopColor, StopOpacity, diff --git a/svgio/qa/cppunit/data/ClipPathAndStyle.svg b/svgio/qa/cppunit/data/ClipPathAndStyle.svg index 29814fadbb86..f3b1777fa5fa 100644 --- a/svgio/qa/cppunit/data/ClipPathAndStyle.svg +++ b/svgio/qa/cppunit/data/ClipPathAndStyle.svg @@ -8,6 +8,6 @@ fill : #ff;"/> - + - \ No newline at end of file + diff --git a/svgio/source/svgreader/svganode.cxx b/svgio/source/svgreader/svganode.cxx index aa473eb9187f..d634be369441 100644 --- a/svgio/source/svgreader/svganode.cxx +++ b/svgio/source/svgreader/svganode.cxx @@ -64,6 +64,7 @@ namespace svgio::svgreader } break; } +case SVGToken::Href: case SVGToken::XlinkHref: //TODO: add support for xlink:href break; diff --git a/svgio/source/svgreader/svggradientnode.cxx b/svgio/source/svgreader/svggradientnode.cxx index 6520c4066b81..56026fb40e1e 100644 --- a/svgio/source/svgreader/svggradientnode.cxx +++ b/svgio/source/svgreader/svggradientnode.cxx @@ -210,6 +210,7 @@ namespace svgio::svgreader } break; } +case SVGToken::Href: case SVGToken::XlinkHref: { const sal_Int32 nLen(aContent.getLength()); diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx index 2390f74dac03..2305b31bc2a8 100644 --- a/svgio/source/svgreader/svgimagenode.cxx +++ b/svgio/source/svgreader/svgimagenode.cxx @@ -134,6 +134,7 @@ namespace svgio::svgreader } break; } +case SVGToken::Href: case SVGToken::XlinkHref: { const sal_Int32 nLen(aContent.getLength()); diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx index e0fa2214be0f..7024e58c6cad 100644 --- a/svgio/source/svgreader/svgpatternnode.cxx +++ b/svgio/source/svgreader/svgpatternnode.cxx @@ -166,6 +166,7 @@ namespace svgio::svgreader } break; } +case SVGToken::Href: case SVGToken::XlinkHref: { const sal_Int32 nLen(aContent.getLength()); diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx index 925bfc4d1944..44c1d9cca019 100644 --- a/svgio/source/svgreader/svgtextpathnode.cxx +++ b/svgio/source/svgreader/svgtextpathnode.cxx @@ -291,6 +291,7 @@ namespace svgio::svgreader { break; } +case SVGToken::Href: case SVGToken::XlinkHref: { const sal_Int32 nLen(aContent.getLength()); diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx index e3c4f85f1436..0b03e2c3f0cd 100644 --- a/svgio/source/svgreader/svgtoken.cxx +++ b/svgio/source/svgreader/svgtoken.cxx @@ -141,6 +141,7 @@ namespace svgio::svgreader const char aSVGStrGradientUnits[] = "gradientUnits"; const char aSVGStrGradientTransform[] = "gradientTransform"; const
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - svgio/inc svgio/qa svgio/source
svgio/inc/svgtools.hxx|6 +++--- svgio/qa/cppunit/SvgImportTest.cxx| 18 ++ svgio/qa/cppunit/data/tdf149893.svg |3 +++ svgio/source/svgreader/svgstyleattributes.cxx |8 svgio/source/svgreader/svgtools.cxx | 18 ++ 5 files changed, 34 insertions(+), 19 deletions(-) New commits: commit de722a935c4a6fbde1e09da79840cca63fdafac1 Author: Xisco Fauli AuthorDate: Thu Jul 7 12:33:12 2022 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Fri Jul 8 05:13:46 2022 +0200 tdf#149893: Color names are ASCII case-insensitive See https://www.w3.org/TR/css-color-3/#html4 Change-Id: Ifdf887bad08ab606abef78fa8335bc49507f4a43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136879 Reviewed-by: Xisco Fauli Tested-by: Jenkins (cherry picked from commit 8da687a2843a2cc9e5db3c82204260bde783a76c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136863 Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136882 Reviewed-by: Adolfo Jayme Barrientos diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx index 550c33d88fac..7b532cd35b15 100644 --- a/svgio/inc/svgtools.hxx +++ b/svgio/inc/svgtools.hxx @@ -106,13 +106,13 @@ namespace svgio::svgreader bool readNumberAndUnit(std::u16string_view rCandidate, sal_Int32& nPos, SvgNumber& aNum, const sal_Int32 nLen); bool readAngle(const OUString& rCandidate, sal_Int32& nPos, double& fAngle, const sal_Int32 nLen); sal_Int32 read_hex(sal_Unicode aChar); -bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName, bool bCaseIndependent); -bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, bool bCaseIndependent, SvgNumber& rOpacity); +bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName); +bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, SvgNumber& rOpacity); basegfx::B2DRange readViewBox(const OUString& rCandidate, InfoProvider const & rInfoProvider); basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, InfoProvider const & rInfoProvider); bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum); bool readLocalUrl(const OUString& rCandidate, OUString& rURL); -bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, OUString& rURL, bool bCaseIndependent, SvgNumber& rOpacity); +bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, OUString& rURL, SvgNumber& rOpacity); bool readSvgNumberVector(const OUString& rCandidate, SvgNumberVector& rSvgNumberVector); ::std::vector< double > solveSvgNumberVector(const SvgNumberVector& rInput, const InfoProvider& rInfoProvider); diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index c563e7b296fd..49ac541c4424 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -56,6 +56,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testRGBAColor(); void testNoneColor(); void testTdf97936(); +void testTdf149893(); void testClipPathAndParentStyle(); void testClipPathAndStyle(); void testi125329(); @@ -92,6 +93,7 @@ public: CPPUNIT_TEST(testRGBAColor); CPPUNIT_TEST(testNoneColor); CPPUNIT_TEST(testTdf97936); +CPPUNIT_TEST(testTdf149893); CPPUNIT_TEST(testClipPathAndParentStyle); CPPUNIT_TEST(testClipPathAndStyle); CPPUNIT_TEST(testi125329); @@ -516,6 +518,22 @@ void Test::testTdf97936() assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "maxy", "100"); } +void Test::testTdf149893() +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf149893.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequence)); + +CPPUNIT_ASSERT (pDocument); + +// Without the fix in place, this test would have failed with +// - Expected: #008000 +// - Actual : #00 +assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#008000"); +} + void Test::testClipPathAndParentStyle() { //Check that fill color, stroke color and stroke-width are inherited from use element diff --git a/svgio/qa/cppunit/data/tdf149893.svg b/svgio/qa/cppunit/data/tdf149893.svg new file mode 100644 index ..05c41eac96af --- /dev/null +++ b/svgio/qa/cppunit/data/tdf149893.svg @@ -0,0 +1,3 @@ +http://www.w3.org/2000/svg;> + + diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 21ef7cebf5cf..df200e40f428 100644 ---
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - svgio/inc svgio/qa svgio/source
svgio/inc/svgnode.hxx |2 +- svgio/inc/svgtextnode.hxx |2 -- svgio/inc/svgtspannode.hxx |2 +- svgio/qa/cppunit/SvgImportTest.cxx | 20 svgio/qa/cppunit/data/em_units.svg | 14 ++ svgio/source/svgreader/svgtextnode.cxx |4 6 files changed, 36 insertions(+), 8 deletions(-) New commits: commit 8e1aea537ffe35311cc6d43d4b0cef3f4ec82367 Author: Hossein AuthorDate: Mon Dec 20 05:44:23 2021 +0100 Commit: Xisco Fauli CommitDate: Fri Dec 24 19:35:15 2021 +0100 tdf#97663 SVGIO: Fix line spacing for tdf#97663 is a regression caused by the commit 701324a1e1f7e0c181ff1a50956ced686785ea53. The previous patch caused LO to forget the size of the font which was needed to calculate line height based on em units. em, px, pt, cm, in... https://www.w3.org/Style/Examples/007/units.en.html Accompanied with this fix is a unit test provided to avoid this issue in the future. The fix can be tested with: make CPPUNIT_TEST_NAME="testTdf97663" -sr \ CppunitTest_svgio The em_units.svg is opened with Firefox, Chrome and Inkscape and the rendering in LibreOffice is compatible with the rendering in these applications. Change-Id: Idaecd9fb18101f7925fe2a917f7fc3fe7257ebc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127130 Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 4e2e57b530544736804ab663f832173ba1d78559) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127376 Reviewed-by: Xisco Fauli diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx index 63c6b2318406..58b1682506f2 100644 --- a/svgio/inc/svgnode.hxx +++ b/svgio/inc/svgnode.hxx @@ -159,7 +159,7 @@ namespace svgio::svgreader virtual double getCurrentFontSizeInherited() const override; virtual double getCurrentXHeightInherited() const override; -virtual double getCurrentFontSize() const; +double getCurrentFontSize() const; double getCurrentXHeight() const; /// Id access diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx index b72d1043b8c0..37983ad31531 100644 --- a/svgio/inc/svgtextnode.hxx +++ b/svgio/inc/svgtextnode.hxx @@ -58,8 +58,6 @@ namespace svgio::svgreader virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; -virtual double getCurrentFontSize() const override; - /// transform content, set if found in current context const std::optional& getTransform() const { return mpaTransform; } void setTransform(const std::optional& pMatrix) { mpaTransform = pMatrix; } diff --git a/svgio/inc/svgtspannode.hxx b/svgio/inc/svgtspannode.hxx index af4ae8268b5c..10a7b7ee16a9 100644 --- a/svgio/inc/svgtspannode.hxx +++ b/svgio/inc/svgtspannode.hxx @@ -42,7 +42,7 @@ namespace svgio::svgreader virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; -virtual double getCurrentFontSize() const override; +double getCurrentFontSize() const; /// access to SvgTextPositions const SvgTextPositions& getSvgTextPositions() const { return maSvgTextPositions; } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 25baf76fdad8..3034c997015e 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -69,6 +69,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testTdf101237(); void testTdf94765(); void testBehaviourWhenWidthAndHeightIsOrIsNotSet(); +void testTdf97663(); Primitive2DSequence parseSvg(std::u16string_view aSource); @@ -104,6 +105,7 @@ public: CPPUNIT_TEST(testTdf101237); CPPUNIT_TEST(testTdf94765); CPPUNIT_TEST(testBehaviourWhenWidthAndHeightIsOrIsNotSet); +CPPUNIT_TEST(testTdf97663); CPPUNIT_TEST_SUITE_END(); }; @@ -804,6 +806,24 @@ void Test::testBehaviourWhenWidthAndHeightIsOrIsNotSet() } } +void Test::testTdf97663() +{ +Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/em_units.svg"); +CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength())); + +drawinglayer::Primitive2dXmlDump dumper; +// This can be dumped to a file using dumper.dump(container, file_url) +Primitive2DContainer container = comphelper::sequenceToContainer(aSequence); +xmlDocUniquePtr pDocument = dumper.dumpAndParse(container); + +CPPUNIT_ASSERT (pDocument); + +