summaryrefslogtreecommitdiff
path: root/vcl/source/glyphs/graphite_layout.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-02-23 13:56:11 +0300
committerJustin Luth <justin_luth@sil.org>2016-02-24 09:15:03 +0000
commitd0b16f53d3372d4176ea1a119de8d04f2aa05ad4 (patch)
tree386523a97082c391f6d02763a92a68f3ec04fe8c /vcl/source/glyphs/graphite_layout.cxx
parent9407bf98487beba498216e5132dca565108069a5 (diff)
Fix and tidy-up graphite line final diacritics
cherry-pick of commits f2df80410b34faa88740f2c0c2b021c74a19d5ca and b073d9f2e35dd0b6cdbc66e31050250a6f34cc55 Change-Id: Iff0218255d0631dc7f97e7fa0eb150544a34da5d Reviewed-on: https://gerrit.libreoffice.org/22640 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Martin Hosken <martin_hosken@sil.org>
Diffstat (limited to 'vcl/source/glyphs/graphite_layout.cxx')
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx36
1 files changed, 18 insertions, 18 deletions
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index cb9a9629d11c..22eaf94dc3aa 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -668,24 +668,24 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
unsigned int GraphiteLayout::ScanFwdForChar(int &findChar, bool fallback) const
{
int res = mvChar2Glyph[findChar - mnMinCharPos];
- int done = 3;
- while (res == -1 && --done)
+ if (res >= 0)
+ return unsigned(res);
+ if (fallback)
{
- if (fallback)
- {
- for (++findChar; findChar - mnMinCharPos < int(mvChar2Glyph.size()); ++findChar)
- if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
- return res;
- }
- else
- {
- for (--findChar; findChar >= mnMinCharPos; --findChar)
- if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
- return res;
- }
- fallback = !fallback;
+ for (++findChar; findChar - mnMinCharPos < int(mvChar2Glyph.size()); ++findChar)
+ if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
+ return res;
+ --findChar;
+ return mvGlyphs.size() - 1;
+ }
+ else
+ {
+ for (--findChar; findChar >= mnMinCharPos; --findChar)
+ if ((res = mvChar2Glyph[findChar - mnMinCharPos]) != -1)
+ return res;
+ ++findChar;
+ return 0;
}
- return unsigned(res);
}
void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDeltaWidth)
@@ -693,8 +693,8 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
bool bRtl(mnLayoutFlags & SalLayoutFlags::BiDiRtl);
int startChar = args.mnMinCharPos < mnMinCharPos ? mnMinCharPos : args.mnMinCharPos;
int endChar = args.mnEndCharPos >= mnEndCharPos ? mnEndCharPos - 1 : args.mnEndCharPos;
- unsigned int startGi = ScanFwdForChar(startChar, !bRtl);
- unsigned int endGi = ScanFwdForChar(endChar, bRtl);
+ unsigned int startGi = ScanFwdForChar(startChar, bRtl);
+ unsigned int endGi = ScanFwdForChar(endChar, !bRtl);
int nChars = endChar - startChar + 1;
if (nChars <= 0) return;
if (startGi > endGi)