[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - vcl/source

László Németh laszlo.nemeth at collabora.com
Sat Jul 4 09:11:48 PDT 2015


 vcl/source/glyphs/graphite_layout.cxx |   33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

New commits:
commit eef0577c5e90ca5c48d58793945d2d8684644cc0
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Sat Jul 4 15:06:01 2015 +0200

    tdf#52540 Revert "fdo#52540 refix graphite layout generally"
    
    This reverts commit 12168aeea91a57e63159c3103c904d630c44c62e,
    because that caused a regression in hyphenation, see tdf#52540.
    
    Change-Id: I75613b17de241a5c4fa6da5df7fdaf05db1692b6
    Reviewed-on: https://gerrit.libreoffice.org/16755
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 474756f..a4aa99c 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -561,36 +561,33 @@ gr_segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs)
         int limit = rArgs.mnEndCharPos;
         if (!(SalLayoutFlags::ComplexDisabled & rArgs.mnFlags))
         {
-            int nSegCharMin = maximum<int>(0, mnMinCharPos - EXTRA_CONTEXT_LENGTH);
-            int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
-            while (nSegCharMin < mnSegCharOffset)
+            const int nSegCharMin = maximum<int>(0, mnMinCharPos - EXTRA_CONTEXT_LENGTH);
+            const int nSegCharLimit = minimum(rArgs.mnLength, mnEndCharPos + EXTRA_CONTEXT_LENGTH);
+            if (nSegCharMin < mnSegCharOffset)
             {
-                int sameDirEnd = nSegCharMin + findSameDirLimit(rArgs.mpStr + nSegCharMin,
+                int sameDirEnd = findSameDirLimit(rArgs.mpStr + nSegCharMin,
                     rArgs.mnEndCharPos - nSegCharMin, bRtl);
-                if (sameDirEnd >= rArgs.mnMinCharPos)
-                {
+                if (sameDirEnd == rArgs.mnEndCharPos)
                     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;
             }
         }
-        else
-        {
-            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);
+                 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))
+        {
+            numchars = numchars2;
+        }
         if (mpFeatures)
             pSegment = gr_make_seg(mpFont, mpFace, 0, mpFeatures->values(), gr_utf16,
                                         rArgs.mpStr + mnSegCharOffset, numchars, bRtl);


More information about the Libreoffice-commits mailing list