summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2019-06-02 10:00:41 +0800
committerTor Lillqvist <tml@collabora.com>2019-10-08 16:35:22 +0200
commit266bd146ccee4f0f9d3cd786a9074eab1a13b403 (patch)
tree733695045ed040b4fbf9e243fc7ac2fda9a1a912
parent71c4e805f7c32c1885635197a01376501e885e2c (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/80467 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 3a7969547742..88e97527ab5c 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -440,12 +440,14 @@ void CommonSalLayout::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);
}