summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Clark <jonathan@libreoffice.org>2025-06-19 03:01:48 -0600
committerJonathan Clark <jonathan@libreoffice.org>2025-06-20 09:01:27 +0200
commit7cafd6648d991d9f25466766042416e0c686074b (patch)
tree7f3656be8602cb3466633156c633ac9edeb3c684
parent2567a399b51856e1b7d45d1cb50b0f7f43841964 (diff)
tdf#163761 Fix for tofu inside mixed-direction fallback runs in GUI textHEADmaster
Fixed a bug inside MultiSalLayout::ImplAdjustMultiLayout() that caused tofu characters and improper position adjustment for certain UI text with bidi fallback runs. The root cause was an implementation error causing the current glyph index in the base layout to outpace the current fallback run. Regression from commit 9c2eb9c872bb10049fcb0217842b3bb849c27a22 (tdf#373494: Correctly drop NotDef glyphs in mixed direction fallback runs) Change-Id: I7c16943866bdd465cc3c2c1f8540b38d2d4d529c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186720 Tested-by: Jenkins Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
-rw-r--r--vcl/source/gdi/sallayout.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index ced75edbc26b..0e4d1473c27d 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -886,10 +886,13 @@ void MultiSalLayout::ImplAdjustMultiLayout(vcl::text::ImplLayoutArgs& rArgs,
if( n > 0 )
{
// drop the NotDef glyphs in the base layout run if a fallback run exists
- while (
- (maFallbackRuns[n-1].PosIsInAnyRun(pGlyphs[nFirstValid]->charPos())) &&
- (!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[nFirstValid]->charPos()))
- )
+ //
+ // tdf#163761: The whole algorithm in this outer loop works by advancing through
+ // all of the glyphs and runs in lock-step. The current glyph in the base layout
+ // must not outpace the fallback runs. The following loop does this by breaking
+ // at the end of the current fallback run (which comes from the previous level).
+ while ((maFallbackRuns[n - 1].PosIsInRun(pGlyphs[nFirstValid]->charPos()))
+ && (!maFallbackRuns[n].PosIsInAnyRun(pGlyphs[nFirstValid]->charPos())))
{
mpLayouts[0]->DropGlyph( nStartOld[0] );
nStartOld[0] = nStartNew[0];