summaryrefslogtreecommitdiffstats
path: root/vcl/source/outdev/text.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/outdev/text.cxx')
-rw-r--r--vcl/source/outdev/text.cxx38
1 files changed, 30 insertions, 8 deletions
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 1b40a1b2de..16fdf7b073 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -21,6 +21,7 @@
#include <sal/log.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <tools/lineend.hxx>
#include <tools/debug.hxx>
#include <unotools/configmgr.hxx>
@@ -214,7 +215,11 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout )
tools::Rectangle aBoundRect;
rSalLayout.DrawBase() = basegfx::B2DPoint( 0, 0 );
rSalLayout.DrawOffset() = Point( 0, 0 );
- if (!rSalLayout.GetBoundRect(aBoundRect))
+ if (basegfx::B2DRectangle r; rSalLayout.GetBoundRect(r))
+ {
+ aBoundRect = SalLayout::BoundRect2Rectangle(r);
+ }
+ else
{
// guess vertical text extents if GetBoundRect failed
double nRight = rSalLayout.GetTextWidth();
@@ -1922,8 +1927,21 @@ bool OutputDevice::GetTextBoundRect( tools::Rectangle& rRect,
std::span<const sal_Bool> pKashidaAry,
const SalLayoutGlyphs* pGlyphs ) const
{
+ basegfx::B2DRectangle aRect;
+ bool bRet = GetTextBoundRect(aRect, rStr, nBase, nIndex, nLen, nLayoutWidth, pDXAry,
+ pKashidaAry, pGlyphs);
+ rRect = SalLayout::BoundRect2Rectangle(aRect);
+ return bRet;
+}
+
+bool OutputDevice::GetTextBoundRect(basegfx::B2DRectangle& rRect, const OUString& rStr,
+ sal_Int32 nBase, sal_Int32 nIndex, sal_Int32 nLen,
+ sal_uLong nLayoutWidth, KernArraySpan pDXAry,
+ std::span<const sal_Bool> pKashidaAry,
+ const SalLayoutGlyphs* pGlyphs) const
+{
bool bRet = false;
- rRect.SetEmpty();
+ rRect.reset();
std::unique_ptr<SalLayout> pSalLayout;
const Point aPoint;
@@ -1947,18 +1965,22 @@ bool OutputDevice::GetTextBoundRect( tools::Rectangle& rRect,
nullptr, pGlyphs);
if( pSalLayout )
{
- tools::Rectangle aPixelRect;
+ basegfx::B2DRectangle aPixelRect;
bRet = pSalLayout->GetBoundRect(aPixelRect);
if( bRet )
{
- Point aRotatedOfs( mnTextOffX, mnTextOffY );
basegfx::B2DPoint aPos = pSalLayout->GetDrawPosition(basegfx::B2DPoint(nXOffset, 0));
- aRotatedOfs -= Point(aPos.getX(), aPos.getY());
- aPixelRect += aRotatedOfs;
+ auto m = basegfx::utils::createTranslateB2DHomMatrix(mnTextOffX - aPos.getX(),
+ mnTextOffY - aPos.getY());
+ aPixelRect.transform(m);
rRect = PixelToLogic( aPixelRect );
- if( mbMap )
- rRect += Point( maMapRes.mnMapOfsX, maMapRes.mnMapOfsY );
+ if (mbMap)
+ {
+ m = basegfx::utils::createTranslateB2DHomMatrix(maMapRes.mnMapOfsX,
+ maMapRes.mnMapOfsY);
+ rRect.transform(m);
+ }
}
}