diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-04-28 15:25:08 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-04-28 19:25:58 +0200 |
commit | 5cb3a6da2a61b9bc1acb5b47ac80cdcdc69294e2 (patch) | |
tree | 7b2e5c9e3e8b495fd918532923cb1fe94c2843fb | |
parent | 9c1c18f42bbb1f54c39202329088d50d2839ceb9 (diff) |
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 <glogow@fbihome.de>
-rw-r--r-- | vcl/source/gdi/sallayout.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
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 ) |