summaryrefslogtreecommitdiff
path: root/sw/source/core/text/porlay.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-16 09:03:54 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-16 09:03:54 +0000
commitef12fbd29f1a23a3c8351b982e4372b2c10d6bfc (patch)
tree32ddcef473322e768b6a0153fe9e69836230c72a /sw/source/core/text/porlay.cxx
parent11c703ede8f0b99200f5785c7f5c07ce03bd50dc (diff)
CWS-TOOLING: integrate CWS kashidafix02
2009-01-27 13:52:43 +0100 hdu r266989 : #i98522# fix position of fallback glyph in RTL-contexts 2009-01-27 11:22:08 +0100 hdu r266969 : minor source layout 2009-01-27 11:18:36 +0100 hdu r266968 : #i98453# prevent kashida-injection for blank-justified text 2009-01-26 11:12:01 +0100 hdu r266911 : #i98454# simplified lcl_ConnectToPrev(), fixed spurious chars in source 2009-01-26 10:53:58 +0100 hdu r266910 : #i98453# handle arabic justification when no valid kashida positions are available 2009-01-26 10:44:30 +0100 hdu r266909 : #i98410# prevent kashida-expansion at ZWNJ 2009-01-23 16:08:17 +0100 hdu r266832 : #i93210# in RTL-contexts the trailing-spaces can be leftmost-spaces 2009-01-23 14:00:24 +0100 hdu r266814 : #i98399# add FARSI support for digit conversion 2009-01-21 15:35:03 +0100 hdu r266675 : #i97108# sub-portion adjustment of RTL-text is not needed yet 2009-01-21 13:40:21 +0100 hdu r266663 : no workaround needed for newer versions of ICU bidi 2009-01-20 09:32:11 +0100 hdu r266553 : #i85089# better cluster detection for UniscribeLayout 2009-01-19 12:39:08 +0100 hdu r266490 : silence escaped fprintf to stderr 2009-01-19 12:23:45 +0100 hdu r266488 : #i85074# improve cluster handling for justified CTL-text on UNX 2009-01-19 10:14:43 +0100 fme r266478 : #i97108# hennerdrewes: Writer's kashida justification has problems with vocalized text
Diffstat (limited to 'sw/source/core/text/porlay.cxx')
-rw-r--r--sw/source/core/text/porlay.cxx50
1 files changed, 27 insertions, 23 deletions
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 5e7024b552..052abe8dfe 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -187,9 +187,7 @@ sal_Bool isTransparentChar ( xub_Unicode cCh )
sal_Bool lcl_IsLigature( xub_Unicode cCh, xub_Unicode cNextCh )
{
// Lam + Alef
- return ( isLamChar ( cCh ) && isAlefChar ( cNextCh )); // ||
- // Beh + Reh
- // ( 0x628 == cCh && 0x631 == cNextCh );
+ return ( isLamChar ( cCh ) && isAlefChar ( cNextCh ));
}
/*************************************************************************
@@ -205,25 +203,23 @@ sal_Bool lcl_ConnectToPrev( xub_Unicode cCh, xub_Unicode cPrevCh )
// to the left. So we look for the characters that are actually connectable
// to the left. Here is the complete list of WH:
- // (hennerdrewes) to do: this should be reworked
- // use the isXXXChar functions to exclude the non-connecting character classes
-
+ // (hennerdrewes):
+ // added lam forms 0x06B5..0x06B8
+ // added 0x6FA..0x6FC, according to unicode documentation, although not present in my fonts
+ // added heh goal 0x6C1
sal_Bool bRet = 0x628 == cPrevCh ||
( 0x62A <= cPrevCh && cPrevCh <= 0x62E ) ||
- ( 0x633 <= cPrevCh && cPrevCh <= 0x643 ) ||
- 0x644 == cPrevCh || // Lam does connect !!!
- ( 0x645 <= cPrevCh && cPrevCh <= 0x647 ) ||
+ ( 0x633 <= cPrevCh && cPrevCh <= 0x647 ) ||
0x649 == cPrevCh || // Alef Maksura does connect !!!
0x64A == cPrevCh ||
( 0x678 <= cPrevCh && cPrevCh <= 0x687 ) ||
- ( 0x69A <= cPrevCh && cPrevCh <= 0x6B4 ) ||
- ( 0x6B9 <= cPrevCh && cPrevCh <= 0x6C0 ) ||
- ( 0x6C3 <= cPrevCh && cPrevCh <= 0x6D3 );
+ ( 0x69A <= cPrevCh && cPrevCh <= 0x6C1 ) ||
+ ( 0x6C3 <= cPrevCh && cPrevCh <= 0x6D3 ) ||
+ ( 0x6FA <= cPrevCh && cPrevCh <= 0x6FC ) ;
// check for ligatures cPrevChar + cChar
- if ( bRet )
- bRet = ! lcl_IsLigature( cPrevCh, cCh );
-
+ if( bRet )
+ bRet = !lcl_IsLigature( cPrevCh, cCh );
return bRet;
}
@@ -1133,7 +1129,14 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
USHORT nPriorityLevel = 7; // 0..6 = level found
// 7 not found
- while (nIdx < rWord.Len())
+
+ xub_StrLen nWordLen = rWord.Len();
+
+ // ignore trailing vowel chars
+ while( nWordLen && isTransparentChar( rWord.GetChar( nWordLen - 1 )))
+ --nWordLen;
+
+ while (nIdx < nWordLen)
{
cCh = rWord.GetChar( nIdx );
@@ -1147,9 +1150,10 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// 2. Priority:
// after a Seen or Sad
- if (nPriorityLevel >= 1 && nIdx < rWord.Len() - 1)
+ if (nPriorityLevel >= 1 && nIdx < nWordLen - 1)
{
- if ( isSeenOrSadChar ( cCh ) )
+ if( isSeenOrSadChar( cCh )
+ && (rWord.GetChar( nIdx+1 ) != 0x200C) ) // #i98410#: prevent ZWNJ expansion
{
nKashidaPos = aScanner.GetBegin() + nIdx;
nPriorityLevel = 1;
@@ -1162,7 +1166,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
{
if ( isTehMarbutaChar ( cCh ) || // Teh Marbuta (right joining)
isDalChar ( cCh ) || // Dal (right joining) final form may appear in the middle of word
- ( isHahChar ( cCh ) && nIdx == rWord.Len() - 1)) // Hah (dual joining) only at end of word
+ ( isHahChar ( cCh ) && nIdx == nWordLen - 1)) // Hah (dual joining) only at end of word
{
ASSERT( 0 != cPrevCh, "No previous character" )
@@ -1183,7 +1187,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
(( isLamChar ( cCh ) || // Lam
isKafChar ( cCh ) || // Kaf (both dual joining)
isGafChar ( cCh ) )
- && nIdx == rWord.Len() - 1)) // only at end of word
+ && nIdx == nWordLen - 1)) // only at end of word
{
ASSERT( 0 != cPrevCh, "No previous character" )
// check if character is connectable to previous character,
@@ -1197,7 +1201,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// 5. Priority:
// before media Bah
- if ( nPriorityLevel >= 4 && nIdx > 0 && nIdx < rWord.Len() - 1 )
+ if ( nPriorityLevel >= 4 && nIdx > 0 && nIdx < nWordLen - 1 )
{
if ( isBaaChar ( cCh )) // Bah
{
@@ -1225,7 +1229,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
(( isAinChar ( cCh ) || // Ain (dual joining)
isQafChar ( cCh ) || // Qaf (dual joining)
isFeChar ( cCh ) ) // Feh (dual joining)
- && nIdx == rWord.Len() - 1)) // only at end of word
+ && nIdx == nWordLen - 1)) // only at end of word
{
ASSERT( 0 != cPrevCh, "No previous character" )
// check if character is connectable to previous character,
@@ -1245,7 +1249,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
if ( isRehChar ( cCh ) || // Reh Zain (right joining)
// final form may appear in the middle of word
( 0x60C <= cCh && 0x6FE >= cCh // all others
- && nIdx == rWord.Len() - 1)) // only at end of word
+ && nIdx == nWordLen - 1)) // only at end of word
{
ASSERT( 0 != cPrevCh, "No previous character" )
// check if character is connectable to previous character,