diff options
author | Mark Hung <marklh9@gmail.com> | 2016-10-08 22:18:03 +0800 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2016-10-15 21:20:25 +0000 |
commit | bd041161f3dc65a36245ce271007dce003529a9c (patch) | |
tree | 92b827eb95b40b6eb8e396a40cfdfd694a4aac83 | |
parent | dcef76b34aa1dca8389b3c068dc3d82a11d2c382 (diff) |
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@eglug.org>
Tested-by: Khaled Hosny <khaledhosny@eglug.org>
-rw-r--r-- | vcl/source/outdev/text.cxx | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 8b03032efbd6..1530ab28c937 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; } |