summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hosken <martin_hosken@sil.org>2015-03-20 15:13:59 +0700
committerCaolán McNamara <caolanm@redhat.com>2015-03-23 09:10:15 +0000
commit12168aeea91a57e63159c3103c904d630c44c62e (patch)
treea001c684a7cb9b01fa013418169054452962c2ce
parent3e8a7ce7dffcf46a692e5da0b281a104df8d4d95 (diff)
fdo#52540 refix graphite layout generally
Change-Id: I13896adbc3d8b006c3b192dbf40e766d718a8bac Reviewed-on: https://gerrit.libreoffice.org/14959 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx33
1 files changed, 18 insertions, 15 deletions
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 63194fcd1150..d26a15f31b03 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -569,33 +569,36 @@ gr_segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
int limit = rArgs.mnEndCharPos;
if (!(SAL_LAYOUT_COMPLEX_DISABLED & rArgs.mnFlags))
{
- const int nSegCharMin = maximum<int>(0, mnMinCharPos - EXTRA_CONTEXT_LENGTH);
- const int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
- if (nSegCharMin < mnSegCharOffset)
+ int nSegCharMin = maximum<int>(0, mnMinCharPos - EXTRA_CONTEXT_LENGTH);
+ int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
+ while (nSegCharMin < mnSegCharOffset)
{
- int sameDirEnd = findSameDirLimit(rArgs.mpStr + nSegCharMin,
+ int sameDirEnd = nSegCharMin + findSameDirLimit(rArgs.mpStr + nSegCharMin,
rArgs.mnEndCharPos - nSegCharMin, bRtl);
- if (sameDirEnd == rArgs.mnEndCharPos)
+ if (sameDirEnd >= rArgs.mnMinCharPos)
+ {
mnSegCharOffset = nSegCharMin;
+ break;
+ }
+ else
+ nSegCharMin = sameDirEnd;
}
if (nSegCharLimit > limit)
{
limit += findSameDirLimit(rArgs.mpStr + rArgs.mnEndCharPos,
nSegCharLimit - rArgs.mnEndCharPos, bRtl);
+ if (limit > rArgs.mnLength)
+ limit = rArgs.mnLength;
}
}
-
- size_t numchars = gr_count_unicode_characters(gr_utf16, rArgs.mpStr + mnSegCharOffset,
- rArgs.mpStr + (rArgs.mnLength > limit + 64 ? limit + 64 : rArgs.mnLength), NULL);
- static com::sun::star::uno::Reference< com::sun::star::i18n::XCharacterClassification > xCharClass;
- if ( !xCharClass.is() )
- xCharClass = vcl::unohelper::CreateCharacterClassification();
- size_t numchars2 = rArgs.mnEndCharPos - mnSegCharOffset; // fdo#52540, fdo#68313, fdo#70666 avoid bad ligature replacement, fdo#88051 layout problem
- if (numchars > numchars2 && (rArgs.mpStr[mnSegCharOffset + numchars2] == '\t' ||
- xCharClass->getType(rArgs.mpStr + mnSegCharOffset, numchars2 + 1) == ::com::sun::star::i18n::UnicodeType::LOWERCASE_LETTER))
+ else
{
- numchars = numchars2;
+ limit = minimum(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
+ mnSegCharOffset = maximum<int>(0, mnMinCharPos - EXTRA_CONTEXT_LENGTH);
}
+
+ size_t numchars = gr_count_unicode_characters(gr_utf16, rArgs.mpStr + mnSegCharOffset,
+ rArgs.mpStr + limit, NULL);
if (mpFeatures)
pSegment = gr_make_seg(mpFont, mpFace, 0, mpFeatures->values(), gr_utf16,
rArgs.mpStr + mnSegCharOffset, numchars, bRtl);