From d0b16f53d3372d4176ea1a119de8d04f2aa05ad4 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Tue, 23 Feb 2016 13:56:11 +0300 Subject: 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 Reviewed-by: Martin Hosken --- vcl/source/glyphs/graphite_layout.cxx | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'vcl/source') 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 & rDeltaWidth) @@ -693,8 +693,8 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector & 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) -- cgit v1.2.3