summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-04-28 20:04:52 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-04-29 06:57:42 +0200
commit467f2c50a935efff6ff8911e7282ecea535665a3 (patch)
treef1ea2c2d4df8e703d8ce941f7748f1b96bf960f1 /vcl
parent3d7ca1bd1c4cc9d468ae214ecb497f71bad340f8 (diff)
hack for glyph subset being different because of space being RTL
This is a rather weird corner case than I can see only with JunitTest_svx_unoapi failing without this, when asking to lay out characters 7-9 from "paragraph 1" with layout mode set to RTL. Change-Id: Ic55e571a5934ea2b9de2f09b7c066abf014ac212 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133578 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/impglyphitem.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index b313cf8967e2..e66a5bad1a2d 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -165,6 +165,16 @@ SalLayoutGlyphsImpl* SalLayoutGlyphsImpl::cloneCharRange(sal_Int32 index, sal_In
if (pos->IsUnsafeToBreak() || (pos->IsInCluster() && !pos->IsClusterStart()))
return nullptr;
}
+ // HACK: If mode is se to be RTL, but the last glyph is a non-RTL space,
+ // then making a subset would give a different result than the actual layout,
+ // because the weak BiDi mode code in ImplLayoutArgs ctor would interpret
+ // the string subset ending with space as the space being RTL, but it would
+ // treat it as non-RTL for the whole string if there would be more non-RTL
+ // characters after the space. So bail out.
+ if (GetFlags() & SalLayoutFlags::BiDiRtl && !rtl && !copy->empty() && copy->back().IsSpacing())
+ {
+ return nullptr;
+ }
return copy.release();
}