From 2795a230464aea3a792e67b5625fce2a0c01d547 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 3 Aug 2023 17:47:36 +0200 Subject: 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 --- svgio/source/svgreader/svgcharacternode.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'svgio/source/svgreader/svgcharacternode.cxx') 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: -- cgit