diff options
author | Mark Hung <marklh9@gmail.com> | 2019-06-02 10:00:41 +0800 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2019-06-05 14:35:01 +0200 |
commit | ff8b31743305635b968b0a0f21c2778a29c0ce03 (patch) | |
tree | 9e173ff333591671b656583049fa39338862d2b7 /vcl | |
parent | 60504bffca213f6d5c66d1a2de596c20533b7d9c (diff) |
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@eglug.org>
(cherry picked from commit 16faad3657fad114aa984f92a14a5f212a2f8ff5)
Reviewed-on: https://gerrit.libreoffice.org/73537
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 9a638663d1ca..763546346459 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); } |