vcl/source/outdev/font.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
New commits: commit 737854f3c5131d3a64803edc0802dbbc07aa4405 Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Thu Jun 1 12:23:05 2023 +0300 Commit: خالد حسني <kha...@libreoffice.org> CommitDate: Thu Jun 1 14:46:16 2023 +0200 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: خالد حسني <kha...@libreoffice.org> 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();