vcl/source/outdev/text.cxx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
New commits: commit 9057641f678b8e36c9dbc41960b182c6ecfdda15 Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Wed Jul 19 05:53:09 2023 +0300 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Sun Jul 23 06:03:29 2023 +0200 vcl: SalLayout::GetTextWidth() returns double Change-Id: I4c8cfec4160da260556615bc17939af6b20d60ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154596 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 8cf805fe4870..4a3b04121899 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -169,7 +169,7 @@ void OutputDevice::ImplDrawTextRect( tools::Long nBaseX, tools::Long nBaseY, void OutputDevice::ImplDrawTextBackground( const SalLayout& rSalLayout ) { - const tools::Long nWidth = rSalLayout.GetTextWidth(); + const double nWidth = rSalLayout.GetTextWidth(); const DevicePoint aBase = rSalLayout.DrawBase(); const tools::Long nX = aBase.getX(); const tools::Long nY = aBase.getY(); @@ -193,7 +193,7 @@ tools::Rectangle OutputDevice::ImplGetTextBoundRect( const SalLayout& rSalLayout tools::Long nX = aPoint.getX(); tools::Long nY = aPoint.getY(); - tools::Long nWidth = rSalLayout.GetTextWidth(); + double nWidth = rSalLayout.GetTextWidth(); tools::Long nHeight = mpFontInstance->mnLineHeight + mnEmphasisAscent + mnEmphasisDescent; nY -= mpFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent; @@ -236,7 +236,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) if (!rSalLayout.GetBoundRect(aBoundRect)) { // guess vertical text extents if GetBoundRect failed - tools::Long nRight = rSalLayout.GetTextWidth(); + double nRight = rSalLayout.GetTextWidth(); tools::Long nTop = mpFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent; tools::Long nHeight = mpFontInstance->mnLineHeight + mnEmphasisAscent + mnEmphasisDescent; aBoundRect = tools::Rectangle( 0, -nTop, nRight, nHeight - nTop ); @@ -1055,7 +1055,7 @@ void OutputDevice::GetCaretPositions( const OUString& rStr, sal_Int32* pCaretXAr } pSalLayout->GetCaretPositions( 2*nLen, pCaretXArray ); - tools::Long nWidth = pSalLayout->GetTextWidth(); + double nWidth = pSalLayout->GetTextWidth(); // fixup unknown caret positions int i; @@ -2303,7 +2303,7 @@ bool OutputDevice::GetTextBoundRect( tools::Rectangle& rRect, std::unique_ptr<SalLayout> pSalLayout; const Point aPoint; // calculate offset when nBase!=nIndex - tools::Long nXOffset = 0; + double nXOffset = 0; if( nBase != nIndex ) { sal_Int32 nStart = std::min( nBase, nIndex ); @@ -2370,7 +2370,7 @@ bool OutputDevice::GetTextOutlines( basegfx::B2DPolyPolygonVector& rVector, std::unique_ptr<SalLayout> pSalLayout; // calculate offset when nBase!=nIndex - tools::Long nXOffset = 0; + double nXOffset = 0; if( nBase != nIndex ) { sal_Int32 nStart = std::min( nBase, nIndex ); @@ -2395,7 +2395,7 @@ bool OutputDevice::GetTextOutlines( basegfx::B2DPolyPolygonVector& rVector, // transform polygon to pixel units basegfx::B2DHomMatrix aMatrix; - if( nXOffset | mnTextOffX | mnTextOffY ) + if (nXOffset || mnTextOffX || mnTextOffY) { DevicePoint aRotatedOfs(mnTextOffX, mnTextOffY); aRotatedOfs -= pSalLayout->GetDrawPosition(DevicePoint(nXOffset, 0)); commit f9e993a91c2c11a17948d394bf207f836e10d28b Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Tue Jul 18 17:20:56 2023 +0300 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Sun Jul 23 06:03:21 2023 +0200 vcl: Don’t use nSubPixelFactor when in map mode We are already using a subpixel factor when in map mode, so no need for one more. Change-Id: I704d52bf402f92f83a3d4ef40409d644921314d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154587 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 8d4f557288c2..8cf805fe4870 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1455,7 +1455,9 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, tools::Long nTextWid // NOTE: be very careful to avoid rounding errors for nCharExtra case // problem with rounding errors especially for small nCharExtras // TODO: remove when layout units have subpixel granularity - tools::Long nSubPixelFactor = 64; + tools::Long nSubPixelFactor = 1; + if (!mbMap) + nSubPixelFactor = 64; double nTextPixelWidth = ImplLogicWidthToDeviceSubPixel(nTextWidth * nSubPixelFactor); double nExtraPixelWidth = 0; if( nCharExtra != 0 ) @@ -1484,7 +1486,9 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, tools::Long nTextWid // NOTE: be very careful to avoid rounding errors for nCharExtra case // problem with rounding errors especially for small nCharExtras // TODO: remove when layout units have subpixel granularity - tools::Long nSubPixelFactor = 64; + tools::Long nSubPixelFactor = 1; + if (!mbMap) + nSubPixelFactor = 64; double nTextPixelWidth = ImplLogicWidthToDeviceSubPixel(nTextWidth * nSubPixelFactor); double nExtraPixelWidth = 0;