vcl/source/gdi/CommonSalLayout.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
New commits: commit f18d56d298cc9ec9c1c6e0ad4ffce63afc40e2c2 Author: Jonathan Clark <jonat...@libreoffice.org> AuthorDate: Mon Aug 26 01:17:36 2024 -0600 Commit: Jonathan Clark <jonat...@libreoffice.org> CommitDate: Mon Aug 26 14:17:30 2024 +0200 tdf#162603 vcl: Fix sporadic non-subpixel label cutoff Fixes an issue causing occasional truncation of the final column of pixels when rendering text without subpixel positioning. Partially reverts commit 560e5406f3c6e8e6ed0f1c251b6910465266ed8d. tdf#153966 vcl: Fix precision loss laying out right-aligned text Change-Id: I9372e842c8bea59dd8e6d87a8b6887ba7e34897b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172388 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonat...@libreoffice.org> diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 769929f76058..855a5355c59d 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -436,7 +436,7 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay double nYScale = 0; GetFont().GetScale(&nXScale, &nYScale); - hb_position_t nCurrX = 0; + double nCurrX = 0.0; while (true) { int nBidiMinRunPos, nBidiEndRunPos; @@ -683,8 +683,7 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay if (hb_glyph_info_get_glyph_flags(&pHbGlyphInfos[i]) & HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL) nGlyphFlags |= GlyphItemFlags::IS_SAFE_TO_INSERT_KASHIDA; - hb_position_t nAdvance; - double nXOffset, nYOffset; + double nAdvance, nXOffset, nYOffset; if (aSubRun.maDirection == HB_DIRECTION_TTB) { nGlyphFlags |= GlyphItemFlags::IS_VERTICAL; @@ -713,19 +712,19 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay nYOffset = -pHbPositions[i].y_offset; } - double nScaledAdvance = nAdvance * nXScale; + nAdvance = nAdvance * nXScale; nXOffset = nXOffset * nXScale; nYOffset = nYOffset * nYScale; if (!GetSubpixelPositioning()) { - nScaledAdvance = std::round(nScaledAdvance); + nAdvance = std::round(nAdvance); nXOffset = std::round(nXOffset); nYOffset = std::round(nYOffset); } - basegfx::B2DPoint aNewPos(nCurrX * nXScale + nXOffset, nYOffset); + basegfx::B2DPoint aNewPos(nCurrX + nXOffset, nYOffset); const GlyphItem aGI(nCharPos, nCharCount, nGlyphIndex, aNewPos, nGlyphFlags, - nScaledAdvance, nXOffset, nYOffset, nOrigCharPos); + nAdvance, nXOffset, nYOffset, nOrigCharPos); if (aGI.origCharPos() >= rArgs.mnDrawMinCharPos && aGI.origCharPos() < rArgs.mnDrawEndCharPos)