summaryrefslogtreecommitdiff
path: root/svgio/source
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-09-21 17:25:17 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-09-21 21:04:40 +0200
commita42f5faac7c6d4590e632cf40e3ba9eb618e6f56 (patch)
tree6f59bb79a87930d51797101669afe9b442a86ccf /svgio/source
parent5468a58c3244cf98341945c17db040b067c825f7 (diff)
tdf#103888: Do not add a gap at the end of each text portion
I can't think of any situation where it's needed Change-Id: I1c2c6ec3d22eb9263f3c3c20793d9fe3926b8d78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140351 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/source')
-rw-r--r--svgio/source/svgreader/svgcharacternode.cxx5
-rw-r--r--svgio/source/svgreader/svgdocumenthandler.cxx44
2 files changed, 4 insertions, 45 deletions
diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx
index 0a4731b200d5..31376ee179a8 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -549,11 +549,6 @@ namespace svgio::svgreader
}
}
- void SvgCharacterNode::addGap()
- {
- maText += " ";
- }
-
void SvgCharacterNode::concatenate(std::u16string_view rText)
{
maText += rText;
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx
index 288b0205397d..dc2dd6fa7c6b 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -55,7 +55,7 @@ namespace svgio::svgreader
namespace
{
- svgio::svgreader::SvgCharacterNode* whiteSpaceHandling(svgio::svgreader::SvgNode const * pNode, svgio::svgreader::SvgCharacterNode* pLast)
+ void whiteSpaceHandling(svgio::svgreader::SvgNode const * pNode)
{
if(pNode)
{
@@ -75,41 +75,6 @@ namespace
// clean whitespace in text span
svgio::svgreader::SvgCharacterNode* pCharNode = static_cast< svgio::svgreader::SvgCharacterNode* >(pCandidate);
pCharNode->whiteSpaceHandling();
-
- // pCharNode may have lost all text. If that's the case, ignore
- // as invalid character node
- if(!pCharNode->getText().isEmpty())
- {
- if(pLast)
- {
- bool bAddGap(true);
- static bool bNoGapsForBaselineShift(true); // loplugin:constvars:ignore
-
- if(bNoGapsForBaselineShift)
- {
- // With this option a baseline shift between two char parts ('words')
- // will not add a space 'gap' to the end of the (non-last) word. This
- // seems to be the standard behaviour, see last bugdoc attached #122524#
- const svgio::svgreader::SvgStyleAttributes* pStyleLast = pLast->getSvgStyleAttributes();
- const svgio::svgreader::SvgStyleAttributes* pStyleCurrent = pCandidate->getSvgStyleAttributes();
-
- if(pStyleLast && pStyleCurrent && pStyleLast->getBaselineShift() != pStyleCurrent->getBaselineShift())
- {
- bAddGap = false;
- }
- }
-
- // add in-between whitespace (single space) to last
- // known character node
- if(bAddGap)
- {
- pLast->addGap();
- }
- }
-
- // remember new last corrected character node
- pLast = pCharNode;
- }
break;
}
case SVGToken::Tspan:
@@ -117,7 +82,7 @@ namespace
case SVGToken::Tref:
{
// recursively clean whitespaces in subhierarchy
- pLast = whiteSpaceHandling(pCandidate, pLast);
+ whiteSpaceHandling(pCandidate);
break;
}
default:
@@ -129,9 +94,8 @@ namespace
}
}
}
-
- return pLast;
}
+
} // end anonymous namespace
SvgDocHdl::SvgDocHdl(const OUString& aAbsolutePath)
@@ -548,7 +512,7 @@ namespace
if(pWhitespaceCheck)
{
// cleanup read strings
- whiteSpaceHandling(pWhitespaceCheck, nullptr);
+ whiteSpaceHandling(pWhitespaceCheck);
}
}