summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@libreoffice.org>2023-06-01 12:23:05 +0300
committerAndras Timar <andras.timar@collabora.com>2023-06-04 16:34:10 +0200
commit9eb3ec8f1075874fab2077139b8126702d203587 (patch)
tree14369d88400fb2929bfad4b0989a65ac8d41e13e /vcl
parentf504b78988f6c88fe5581f7f3eab790cae018fe8 (diff)
tdf#153440: Fix font fallback for surrogate pairs in RTL text
When checking for a font that supports the surrogate pair, code was appending code units one by one to string buffer and in RTL case this was happening in reverse order leading to invalid text and consequently failing to find any font that supports it. We now iterate over runs not individual positions, so the text of each individual run maintains its correct order regardless of the direction. Change-Id: Icf2e2aed56512bf907dc6b3c36f387a9e3ad497a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152481 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org> (cherry picked from commit 737854f3c5131d3a64803edc0802dbbc07aa4405) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152444 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/font.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 6e8db56e06a3..3bfbb8f6d8ce 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1040,11 +1040,11 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
rLayoutArgs.mnFlags |= SalLayoutFlags::ForFallback;
// get list of code units that need glyph fallback
- int nCharPos = -1;
- bool bRTL = false;
+ bool bRTL;
+ int nMinRunPos, nEndRunPos;
OUStringBuffer aMissingCodeBuf(512);
- while (rLayoutArgs.GetNextPos( &nCharPos, &bRTL))
- aMissingCodeBuf.append(rLayoutArgs.mrStr[nCharPos]);
+ while (rLayoutArgs.GetNextRun(&nMinRunPos, &nEndRunPos, &bRTL))
+ aMissingCodeBuf.append(rLayoutArgs.mrStr.subView(nMinRunPos, nEndRunPos - nMinRunPos));
rLayoutArgs.ResetPos();
OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear();