diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-02-05 14:54:04 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2024-02-06 12:28:51 +0100 |
commit | 31ac452f5f20c51dea3c3f022928627037486118 (patch) | |
tree | 9f3147c13d67ca911a80624a7585d4d115924bfe /svgio | |
parent | 66ea81d4e5e1844d39c121fbb453869e0a00ba62 (diff) |
tdf#159566: match 'central' dominant-baseline to 'middle'
Inkscape also does it the same way
Change-Id: I3e1cea091e7314886bbc9135c55698892239bec7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163006
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit 358061b4a480ea763ea541094cef2112f917eb93)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163013
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgstyleattributes.hxx | 3 | ||||
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 6 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/tdf156834.svg | 3 | ||||
-rw-r--r-- | svgio/source/svgreader/svgcharacternode.cxx | 1 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 4 |
5 files changed, 14 insertions, 3 deletions
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx index 60781942667b..4516773e83a6 100644 --- a/svgio/inc/svgstyleattributes.hxx +++ b/svgio/inc/svgstyleattributes.hxx @@ -166,7 +166,8 @@ namespace svgio::svgreader { Auto, Middle, - Hanging + Hanging, + Central }; enum class Visibility diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index d99e56bfef35..9324ad1b1849 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -764,7 +764,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156834) CPPUNIT_ASSERT (pDocument); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, 3); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, 4); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Auto"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "30"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "20"); @@ -776,6 +776,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156834) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, "Hanging"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "x"_ostr, "30"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "y"_ostr, "94"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "text"_ostr, "Central"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "y"_ostr, "116"); } CPPUNIT_TEST_FIXTURE(Test, testTdf104339) diff --git a/svgio/qa/cppunit/data/tdf156834.svg b/svgio/qa/cppunit/data/tdf156834.svg index 74dc1548186e..0ef81f9a6acf 100644 --- a/svgio/qa/cppunit/data/tdf156834.svg +++ b/svgio/qa/cppunit/data/tdf156834.svg @@ -1,7 +1,8 @@ <svg viewBox="0 0 200 120" xmlns="http://www.w3.org/2000/svg"> - <path d="M20,20 L180,20 M20,50 L180,50 M20,80 L180,80" stroke="grey" /> + <path d="M20,20 L180,20 M20,50 L180,50 M20,80 L180,80 M20,110 L180,110" stroke="grey" /> <text dominant-baseline="auto" x="30" y="20" font-size="20">Auto</text> <text dominant-baseline="middle" x="30" y="50" font-size="20">Middle</text> <text dominant-baseline="Hanging" x="30" y="80" font-size="20">Hanging</text> + <text dominant-baseline="central" x="30" y="110" font-size="20">Central</text> </svg> diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 7d5a2fcb9feb..02bc3911a3b8 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -287,6 +287,7 @@ namespace svgio::svgreader switch(aDominantBaseline) { case DominantBaseline::Middle: + case DominantBaseline::Central: { aPosition.setY(aPosition.getY() - aRange.getCenterY()); break; diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 869b071dade7..731df59aeebf 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1969,6 +1969,10 @@ namespace svgio::svgreader { setDominantBaseline(DominantBaseline::Hanging); } + else if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"central")) + { + setDominantBaseline(DominantBaseline::Central); + } else { // no DominantBaseline |