summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-04-28 12:00:00 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-04-28 14:34:00 +0200
commit825102492a04752c4cebf6c84e2c8639de983e9b (patch)
treebee660701dd694f5560b9169b9665111c32d2c49
parent450b9630c8352667b69d238b7ccd73fafcfa1cb3 (diff)
don't cut a glyph subset inside a composed glyph #2
This is basically the same like 7b7d2f4a3e96e771e125c95a7d262b20f6dc9ecc, triggered by CppunitTest_sw_uiwriter3's testTdf104649 on Mac. Change-Id: Ibb3c33dd6924e8f0c8856185fc7fb7aeaaf72177 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133545 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--vcl/source/gdi/impglyphitem.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 93f70a853a74..bffa490065c6 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -123,6 +123,10 @@ SalLayoutGlyphsImpl* SalLayoutGlyphsImpl::cloneCharRange(sal_Int32 index, sal_In
// Require a start at the exact position given, otherwise bail out.
if (pos->charPos() != beginPos)
return nullptr;
+ // For RTL make sure we're not cutting in the middle of a multi-character glyph
+ // (for non-RTL charPos is always the start of a multi-character glyph).
+ if (rtl && pos->charPos() + pos->charCount() > beginPos + 1)
+ return nullptr;
// Don't create a subset if it's not safe to break at the beginning or end of the sequence
// (https://harfbuzz.github.io/harfbuzz-hb-buffer.html#hb-glyph-flags-t).
if (pos->IsUnsafeToBreak() || (pos->IsInCluster() && !pos->IsClusterStart()))
@@ -149,7 +153,7 @@ SalLayoutGlyphsImpl* SalLayoutGlyphsImpl::cloneCharRange(sal_Int32 index, sal_In
}
if (pos != end())
{
- // Fail if the next character is at the expected past-end position. For RTL check
+ // Fail if the next character is not at the expected past-end position. For RTL check
// that we're not cutting in the middle of a multi-character glyph.
if (rtl ? pos->charPos() + pos->charCount() != endPos + 1 : pos->charPos() != endPos)
return nullptr;