[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/source

Mark Hung (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 5 09:06:18 UTC 2019


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

New commits:
commit 76f0cf39fd06ec1b523e9bdf8fbcc98a55a541b4
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Sun Jun 2 10:00:41 2019 +0800
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Wed Jun 5 11:05:36 2019 +0200

    tdf#107487 fix font fallback for non-BMP characters.
    
    Non-BMP characters use two sal_Unicodes. It is necessary
    to advnace with OUString::iterateCodePoints safely instead of
    nCharPos + 1.
    
    Change-Id: Iea1005f05421b1021a9b3ff611439357d4dcba9e
    Reviewed-on: https://gerrit.libreoffice.org/73326
    Tested-by: Jenkins
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    (cherry picked from commit 16faad3657fad114aa984f92a14a5f212a2f8ff5)
    Reviewed-on: https://gerrit.libreoffice.org/73461
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 5ef6992cabdc..e146fb245131 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -190,12 +190,14 @@ void GenericSalLayout::SetNeedFallback(ImplLayoutArgs& rArgs, sal_Int32 nCharPos
     //mark all glyphs as missing so the whole thing is rendered with the same
     //font
     sal_Int32 nDone;
-    sal_Int32 nGraphemeStartPos =
-        mxBreak->previousCharacters(rArgs.mrStr, nCharPos + 1, aLocale,
-            i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
     sal_Int32 nGraphemeEndPos =
         mxBreak->nextCharacters(rArgs.mrStr, nCharPos, aLocale,
             i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
+    // Safely advance nCharPos in case it is a non-BMP character.
+    rArgs.mrStr.iterateCodePoints(&nCharPos);
+    sal_Int32 nGraphemeStartPos =
+        mxBreak->previousCharacters(rArgs.mrStr, nCharPos, aLocale,
+            i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
 
     rArgs.NeedFallback(nGraphemeStartPos, nGraphemeEndPos, bRightToLeft);
 }


More information about the Libreoffice-commits mailing list