[Libreoffice-commits] core.git: vcl/source

Mark Hung marklh9 at gmail.com
Sat Oct 15 21:20:45 UTC 2016


 vcl/source/outdev/text.cxx |   27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

New commits:
commit bd041161f3dc65a36245ce271007dce003529a9c
Author: Mark Hung <marklh9 at gmail.com>
Date:   Sat Oct 8 22:18:03 2016 +0800

    tdf#43740 Do not use UniscribeLayout for CJK Ideograph Variations.
    
    It used to use UniscribeLayout when any Unicode varaiation selector
    were found, disregard whether it is a Asian or a complex script.
    However CJK Ideograph Vairations are better layouted by WinSimpleLayout.
    
    Just check the case, differ based on the base character of the
    variation sequence.
    
    Change-Id: I4a2ad160a9ab70a6dbc96c301a6a5ad16e140245
    Reviewed-on: https://gerrit.libreoffice.org/29619
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    Tested-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 8b03032..1530ab2 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1233,17 +1233,40 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr,
         // disable CTL for non-CTL text
         const sal_Unicode* pStr = rStr.getStr() + nMinIndex;
         const sal_Unicode* pEnd = rStr.getStr() + nEndIndex;
+        bool bIsCJKIdeograph = false;
         for( ; pStr < pEnd; ++pStr )
+        {
+            if (pStr + 1 < pEnd && rtl::isHighSurrogate( *pStr ) )
+            {
+                sal_uInt32 nCode = rtl::combineSurrogates( pStr[0] , pStr[1] );
+                if ( !bIsCJKIdeograph && nCode >= 0xE0100 && nCode < 0xE01F0 ) // Variation Selector Supplements
+                    break;
+
+                if ( nCode >= 0x20000 && nCode <= 0x2CEB0 )// CJK Unified Ideographs Extension B-E
+                    bIsCJKIdeograph = true;
+                ++pStr;
+                continue;
+            }
+
+            if ( ((*pStr >= 0xF900) && (*pStr < 0xFB00))  // CJK Compatibility Ideographs
+            ||   ((*pStr >= 0x3400) && (*pStr < 0xA000))  // CJK Unified Ideographs and Extension A
+            )
+            {
+                bIsCJKIdeograph = true;
+                continue;
+            }
+
             if( ((*pStr >= 0x0300) && (*pStr < 0x0370))   // diacritical marks
             ||  ((*pStr >= 0x0590) && (*pStr < 0x10A0))   // many CTL scripts
             ||  ((*pStr >= 0x1100) && (*pStr < 0x1200))   // hangul jamo
             ||  ((*pStr >= 0x1700) && (*pStr < 0x1900))   // many CTL scripts
             ||  ((*pStr >= 0xFB1D) && (*pStr < 0xFE00))   // middle east presentation
             ||  ((*pStr >= 0xFE70) && (*pStr < 0xFEFF))   // arabic presentation B
-            ||  ((*pStr >= 0xFE00) && (*pStr < 0xFE10))   // variation selectors in BMP
-            ||  ((pStr + 1 < pEnd) && (pStr[0] == 0xDB40) && (0xDD00 <= pStr[1]) && (pStr[1] < 0xDEF0)) // variation selector supplement
+            ||  (!bIsCJKIdeograph && (*pStr >= 0xFE00) && (*pStr < 0xFE10))   // variation selectors in BMP
             )
                 break;
+            bIsCJKIdeograph = false;
+        }
         if( pStr >= pEnd )
             nLayoutFlags |= SalLayoutFlags::ComplexDisabled;
     }


More information about the Libreoffice-commits mailing list