summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@libreoffice.org>2023-06-01 12:23:05 +0300
committerخالد حسني <khaled@libreoffice.org>2023-06-01 14:46:16 +0200
commit737854f3c5131d3a64803edc0802dbbc07aa4405 (patch)
tree91280034d2743dbf37a85bcc451dea4ab14f4241
parent29224bf7305ab8ba103be145effc8ac467ffcfd6 (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>
-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();