vcl/source/gdi/CommonSalLayout.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit b8340c79126a3b1bf00f84d04138761a31eaad03
Author:     Jonathan Clark <jonat...@libreoffice.org>
AuthorDate: Wed Aug 7 13:37:20 2024 -0600
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Aug 20 14:05:40 2024 +0200

    tdf#162358 Fix missing fallback run inside grapheme cluster
    
    This change fixes an issue causing certain diacritics to be rendered as
    the replacement character. The root cause was failing to consistently
    populate fallback runs for the first grapheme cluster, when a layout
    begins inside a grapheme cluster.
    
    Change-Id: I7ce368c815d33b26fc05d726d4f4efd050ed9a17
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171607
    Reviewed-by: Jonathan Clark <jonat...@libreoffice.org>
    Tested-by: Jenkins
    (cherry picked from commit e459d2dc2ddafa14c442132493e39b987892cd16)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172068
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 37a640645999..0e4e3fe9dc48 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -650,12 +650,14 @@ bool 
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
                 }
 
                 // if needed request glyph fallback by updating LayoutArgs
+                auto nOrigCharPos = stClusterMapper.RemapGlyph(nCharPos, 
nGlyphIndex);
                 if (!nGlyphIndex)
                 {
                     // Only request fallback for grapheme clusters that are 
drawn
-                    if (nCharPos >= rArgs.mnDrawMinCharPos && nCharPos < 
rArgs.mnDrawEndCharPos)
+                    if (nOrigCharPos >= rArgs.mnDrawMinCharPos
+                        && nOrigCharPos < rArgs.mnDrawEndCharPos)
                     {
-                        aFallbackRuns.AddPos(nCharPos, bRightToLeft);
+                        aFallbackRuns.AddPos(nOrigCharPos, bRightToLeft);
                         if (SalLayoutFlags::ForFallback & rArgs.mnFlags)
                             continue;
                     }
@@ -724,8 +726,7 @@ bool 
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
 
                 basegfx::B2DPoint aNewPos(aCurrPos.getX() + nXOffset, 
aCurrPos.getY() + nYOffset);
                 const GlyphItem aGI(nCharPos, nCharCount, nGlyphIndex, 
aNewPos, nGlyphFlags,
-                                    nAdvance, nXOffset, nYOffset,
-                                    stClusterMapper.RemapGlyph(nCharPos, 
nGlyphIndex));
+                                    nAdvance, nXOffset, nYOffset, 
nOrigCharPos);
 
                 if (aGI.origCharPos() >= rArgs.mnDrawMinCharPos
                     && aGI.origCharPos() < rArgs.mnDrawEndCharPos)

Reply via email to