vcl/source/gdi/sallayout.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 5cb3a6da2a61b9bc1acb5b47ac80cdcdc69294e2
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Sun Apr 28 15:25:08 2019 +0200
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Sun Apr 28 19:25:58 2019 +0200

    Move and fix Asian kerning unicode point check
    
    It's the same then
    
    * (1 != c && 2 != c) || (3 != c)
    * !(1 == c || 2 == c) || !(3 == c)
    * !((1 == c || 2 == c) && (3 == c))
    
    which is always true.
    
    Change-Id: Ib63127319ff7e9c13877ac54aa92427637061812
    Reviewed-on: https://gerrit.libreoffice.org/71477
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de>

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 17e6f7f38b35..b5d8e96bc17b 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -774,6 +774,10 @@ static int lcl_CalcAsianKerning(sal_UCS4 c, bool bLeft)
     };
 
     int nResult = 0;
+    // ignore code ranges that are not affected by asian punctuation 
compression
+    if ((0x3000 != (c & 0xFF00)) && (0xFF00 != (c & 0xFF00)) && (0x2010 != (c 
& 0xFFF0)))
+        return nResult;
+
     if( (c >= 0x3000) && (c < 0x3030) )
         nResult = nTable[ c - 0x3000 ];
     else switch( c )
@@ -809,21 +813,17 @@ void GenericSalLayout::ApplyAsianKerning(const OUString& 
rStr)
         const int n = pGlyphIter->m_nCharPos;
         if (n < nLength - 1)
         {
-            // ignore code ranges that are not affected by asian punctuation 
compression
-            const sal_Unicode cHere = rStr[n];
-            if( ((0x3000 != (cHere & 0xFF00)) && (0x2010 != (cHere & 0xFFF0))) 
|| (0xFF00 != (cHere & 0xFF00)) )
+            // calculate compression values
+            const int nKernFirst = +lcl_CalcAsianKerning(rStr[n], true);
+            if (nKernFirst == 0)
                 continue;
-            const sal_Unicode cNext = rStr[n+1];
-            if( ((0x3000 != (cNext & 0xFF00)) && (0x2010 != (cNext & 0xFFF0))) 
|| (0xFF00 != (cNext & 0xFF00)) )
+            const int nKernNext = -lcl_CalcAsianKerning(rStr[n + 1], false);
+            if (nKernNext == 0)
                 continue;
 
-            // calculate compression values
-            const int nKernFirst = +lcl_CalcAsianKerning(cHere, true);
-            const int nKernNext  = -lcl_CalcAsianKerning(cNext, false);
-
             // apply punctuation compression to logical glyph widths
             int nDelta = (nKernFirst < nKernNext) ? nKernFirst : nKernNext;
-            if( nDelta<0 && nKernFirst!=0 && nKernNext!=0 )
+            if (nDelta < 0)
             {
                 nDelta = (nDelta * pGlyphIter->m_nOrigWidth + 2) / 4;
                 if( pGlyphIter+1 == pGlyphIterEnd )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to