[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 30 13:21:19 UTC 2020
sw/source/core/text/porlin.cxx | 4 ++--
sw/source/core/text/porrst.cxx | 17 ++++++++++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
New commits:
commit 8029179e35fcda5867769d4ca6f7ee32bca3e9bc
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jan 29 18:52:07 2020 +0100
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Jan 30 14:20:45 2020 +0100
sw: fix rotation bugs in SwLinePortion::PrePaint()
The sign was flipped for the 90° case, resulting in painting too far
up the page, ever since this was added in
293ed704cf15107049578c2e6e5ed00dcac2d4fb.
In SwControlCharPortion::Paint() rotation wasn't handled at all.
Change-Id: I83a7eef8b2f6126e070d8c48f75378b6cf6d50e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87707
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 0c7ff0252075..b5adccb07fba 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -114,12 +114,12 @@ void SwLinePortion::PrePaint( const SwTextPaintInfo& rInf,
break;
case 900:
nPos = sal_uInt16( rInf.Y() );
- nPos -= nLastWidth + nHalfView;
+ nPos -= nLastWidth - nHalfView;
aInf.Y( nPos );
break;
case 1800:
nPos = sal_uInt16( rInf.X() );
- nPos -= nLastWidth + nHalfView;
+ nPos -= nLastWidth - nHalfView;
aInf.X( nPos );
break;
case 2700:
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index e4c56b98669f..686959609cd8 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -522,7 +522,22 @@ void SwControlCharPortion::Paint( const SwTextPaintInfo &rInf ) const
Point aOldPos = rInf.GetPos();
Point aNewPos( aOldPos );
- aNewPos.setX( aNewPos.X() + ( Width() / 2 ) - mnHalfCharWidth );
+ auto const deltaX((Width() / 2) - mnHalfCharWidth);
+ switch (rInf.GetFont()->GetOrientation(rInf.GetTextFrame()->IsVertical()))
+ {
+ case 0:
+ aNewPos.AdjustX(deltaX);
+ break;
+ case 900:
+ aNewPos.AdjustY(-deltaX);
+ break;
+ case 2700:
+ aNewPos.AdjustY(deltaX);
+ break;
+ default:
+ assert(false);
+ break;
+ }
const_cast< SwTextPaintInfo& >( rInf ).SetPos( aNewPos );
rInf.DrawText( aOutString, *this );
More information about the Libreoffice-commits
mailing list