summaryrefslogtreecommitdiff
path: root/vcl/source/glyphs/graphite_layout.cxx
diff options
context:
space:
mode:
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)