summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2018-04-21 18:39:30 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2018-04-22 00:06:02 +0200
commit63a4ecc3881596a448d47f564c722ad944ff7e67 (patch)
treeb879ad035d37c1d14c1dd335dec834c8aeaa0b89
parent5289441ffa227f5f358ca4dc28df416be922aa66 (diff)
tdf#86399 Correctly set cluster start for RTL runs
A followup for the fix in b1030f75d3e47719ca63ec518f1da75196bead1a (from 2015) that didn’t work for Arabic because we were setting cluster start for RTL runs incorrectly. I’ve been suffering from this for so long but too lazy to debug it, until I saw this pace of code by pure chance and it looked dubious, finding where this flag is used and then seeing the comment referring to tdf#86399, then WOW I know what is going on! Change-Id: Ib7850e5a90ed3184738e995885f7f8b459ea2bb9 Reviewed-on: https://gerrit.libreoffice.org/53261 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
-rw-r--r--vcl/source/gdi/CommonSalLayout.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 463eb255c1dc..c455475ba53d 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -695,6 +695,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
int32_t nGlyphIndex = pHbGlyphInfos[i].codepoint;
int32_t nCharPos = pHbGlyphInfos[i].cluster;
int32_t nCharCount = 0;
+ bool bInCluster = false;
// Find the number of characters that make up this glyph.
if (!bRightToLeft)
@@ -702,7 +703,10 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
// If the cluster is the same as previous glyph, then this
// already consumed, skip.
if (i > 0 && pHbGlyphInfos[i].cluster == pHbGlyphInfos[i - 1].cluster)
+ {
nCharCount = 0;
+ bInCluster = true;
+ }
else
{
// Find the next glyph with a different cluster, or the
@@ -722,7 +726,10 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
// If the cluster is the same as previous glyph, then this
// will be consumed later, skip.
if (i < nRunGlyphCount - 1 && pHbGlyphInfos[i].cluster == pHbGlyphInfos[i + 1].cluster)
+ {
nCharCount = 0;
+ bInCluster = true;
+ }
else
{
// Find the previous glyph with a different cluster, or
@@ -746,10 +753,6 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
continue;
}
- bool bInCluster = false;
- if (i > 0 && pHbGlyphInfos[i].cluster == pHbGlyphInfos[i - 1].cluster)
- bInCluster = true;
-
long nGlyphFlags = 0;
if (bRightToLeft)
nGlyphFlags |= GlyphItem::IS_RTL_GLYPH;