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

New commits:
commit e459d2dc2ddafa14c442132493e39b987892cd16
Author:     Jonathan Clark <jonat...@libreoffice.org>
AuthorDate: Wed Aug 7 13:37:20 2024 -0600
Commit:     Jonathan Clark <jonat...@libreoffice.org>
CommitDate: Thu Aug 8 05:43:08 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

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 2463301a4d05..0425b5794bca 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -648,12 +648,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;
                     }
@@ -722,8 +724,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