diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-08-12 02:28:02 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-08-12 10:00:29 +0200 |
commit | dcb3cb0bd4e4bf2bed05ae3b9d370e17a331a9b1 (patch) | |
tree | 08503b04609b8574c537b5db0470647e8e4f7b09 /svgio/source/svgreader/svgcharacternode.cxx | |
parent | 0f3b36bd2749f360df84d1594c01e619ba0f4930 (diff) |
tdf#156616: check if character's parent has x or y
if so, only concatenate the characters that are in the same line
so the alignment will be calculated based on the
line's width
Change-Id: I704370c0a470f8b4cff97c51ad9863158118ee8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155636
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/source/svgreader/svgcharacternode.cxx')
-rw-r--r-- | svgio/source/svgreader/svgcharacternode.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 2b88944aa8d0..9ba70ffb3ef5 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -79,7 +79,7 @@ namespace svgio::svgreader OUString aText) : SvgNode(SVGToken::Character, rDocument, pParent), maText(std::move(aText)), - mpTextParent(nullptr) + mpParentLine(nullptr) { } @@ -251,7 +251,7 @@ namespace svgio::svgreader } // Use the whole text line to calculate the align position - double fWholeTextLineWidth(aTextLayouterDevice.getTextWidth(mpTextParent->getTextLine(), 0, mpTextParent->getTextLine().getLength())); + double fWholeTextLineWidth(aTextLayouterDevice.getTextWidth(mpParentLine->getTextLine(), 0, mpParentLine->getTextLine().getLength())); // apply TextAlign switch(aTextAlign) { @@ -482,6 +482,10 @@ namespace svgio::svgreader if(pPreviousCharacterNode->maTextBeforeSpaceHandling[nLastLength - 1] != ' ' && maTextBeforeSpaceHandling[0] != ' ') bAddGap = false; + // Do not add a gap if this node and last node are in different lines + if(pPreviousCharacterNode->mpParentLine != mpParentLine) + bAddGap = false; + // 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# |