summaryrefslogtreecommitdiff
path: root/svgio/source/svgreader/svgcharacternode.cxx
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-08-03 17:47:36 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-08-03 18:36:56 +0200
commit2795a230464aea3a792e67b5625fce2a0c01d547 (patch)
tree905bb5b808270eb1c43c5d796171fc1940bd98a7 /svgio/source/svgreader/svgcharacternode.cxx
parent490cf5393d30dd2e9ab201286ef863b3c266a8b4 (diff)
tdf#151103: Use the whole text line to calculate the align position
Change-Id: I7ecd41c422afbf028101924972c47a510834ba5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155314 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.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx
index 8a6610c91d25..bfd17c6e0d58 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -359,17 +359,19 @@ namespace svgio::svgreader
}
}
+ // Use the whole text line to calculate the align position
+ double fWholeTextLineWidth(aTextLayouterDevice.getTextWidth(getWholeTextLine(), 0, getWholeTextLine().getLength()));
// apply TextAlign
switch(aTextAlign)
{
case TextAlign::right:
{
- aPosition.setX(aPosition.getX() - fTextWidth);
+ aPosition.setX(aPosition.getX() - fWholeTextLineWidth);
break;
}
case TextAlign::center:
{
- aPosition.setX(aPosition.getX() - (fTextWidth * 0.5));
+ aPosition.setX(aPosition.getX() - (fWholeTextLineWidth * 0.5));
break;
}
case TextAlign::notset: