summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJonathan Clark <jonathan@libreoffice.org>2024-08-26 01:17:36 -0600
committerJonathan Clark <jonathan@libreoffice.org>2024-08-26 14:17:30 +0200
commitf18d56d298cc9ec9c1c6e0ad4ffce63afc40e2c2 (patch)
tree5a7ae48ee14a47edd20cc1345ae28232882aa2f3 /vcl
parent60b4bca6bda086c1ed265cecc52e530f3ed5119c (diff)
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 <jonathan@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx13
1 files changed, 6 insertions, 7 deletions
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)