[Libreoffice-commits] core.git: 2 commits - sw/source

Khaled Hosny khaledhosny at eglug.org
Sun Nov 6 23:19:28 UTC 2016


 sw/source/core/text/porlay.cxx |   64 ++++++++++++++++++++++++++++++++---------
 1 file changed, 50 insertions(+), 14 deletions(-)

New commits:
commit 0b9298bf50eb104b684207e10987144c058421ea
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon Nov 7 00:41:44 2016 +0200

    Extend joining groups with new Unicode additions
    
    Change-Id: I14d65d59794fdf9ed4dce05a8f734d9400f85927

diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 62b8024f..61e9226 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -62,25 +62,59 @@ using namespace i18n::ScriptType;
 #define IS_JOINING_GROUP(c, g) ( u_getIntPropertyValue( (c), UCHAR_JOINING_GROUP ) == U_JG_##g )
 #define isAinChar(c)        IS_JOINING_GROUP((c), AIN)
 #define isAlefChar(c)       IS_JOINING_GROUP((c), ALEF)
-#define isBehChar(c)        IS_JOINING_GROUP((c), BEH)
 #define isDalChar(c)        IS_JOINING_GROUP((c), DAL)
-#define isFehChar(c)        IS_JOINING_GROUP((c), FEH)
+#define isFehChar(c)       (IS_JOINING_GROUP((c), FEH) || IS_JOINING_GROUP((c), AFRICAN_FEH))
 #define isGafChar(c)        IS_JOINING_GROUP((c), GAF)
 #define isHehChar(c)        IS_JOINING_GROUP((c), HEH)
 #define isKafChar(c)        IS_JOINING_GROUP((c), KAF)
 #define isLamChar(c)        IS_JOINING_GROUP((c), LAM)
-#define isQafChar(c)        IS_JOINING_GROUP((c), QAF)
+#define isQafChar(c)       (IS_JOINING_GROUP((c), QAF) || IS_JOINING_GROUP((c), AFRICAN_QAF))
 #define isRehChar(c)        IS_JOINING_GROUP((c), REH)
 #define isTahChar(c)        IS_JOINING_GROUP((c), TAH)
 #define isTehMarbutaChar(c) IS_JOINING_GROUP((c), TEH_MARBUTA)
 #define isWawChar(c)        IS_JOINING_GROUP((c), WAW)
-#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4)
-#define isYehChar(c)        (IS_JOINING_GROUP((c), YEH) || IS_JOINING_GROUP((c), FARSI_YEH))
-#else
-#define isYehChar(c)        IS_JOINING_GROUP((c), YEH)
-#endif
 #define isSeenOrSadChar(c)  (IS_JOINING_GROUP((c), SAD) || IS_JOINING_GROUP((c), SEEN))
 
+// Beh and charters that behave like Beh in medial form.
+bool isBehChar(sal_Unicode cCh)
+{
+    bool bRet = false;
+    switch (u_getIntPropertyValue(cCh, UCHAR_JOINING_GROUP))
+    {
+    case U_JG_BEH:
+    case U_JG_NOON:
+    case U_JG_AFRICAN_NOON:
+    case U_JG_NYA:
+    case U_JG_YEH:
+    case U_JG_FARSI_YEH:
+    case U_JG_BURUSHASKI_YEH_BARREE:
+        bRet = true;
+    default:
+        bRet = false;
+    }
+
+    return bRet;
+}
+
+// Yeh and charters that behave like Yeh in final form.
+bool isYehChar(sal_Unicode cCh)
+{
+    bool bRet = false;
+    switch (u_getIntPropertyValue(cCh, UCHAR_JOINING_GROUP))
+    {
+    case U_JG_YEH:
+    case U_JG_FARSI_YEH:
+    case U_JG_YEH_BARREE:
+    case U_JG_BURUSHASKI_YEH_BARREE:
+    case U_JG_YEH_WITH_TAIL:
+        bRet = true;
+    default:
+        bRet = false;
+    }
+
+    return bRet;
+}
+
 bool isTransparentChar ( sal_Unicode cCh )
 {
     return u_getIntPropertyValue( cCh, UCHAR_JOINING_TYPE ) == U_JT_TRANSPARENT;
@@ -1012,12 +1046,12 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL )
                     }
 
                     // 5. Priority:
-                    // before medial Beh
+                    // before medial Beh-like
                     if ( nPriorityLevel >= 4 && nIdx > 0 && nIdx < nWordLen - 1 )
                     {
-                        if ( isBehChar ( cCh )) // Beh
+                        if ( isBehChar ( cCh ) )
                         {
-                            // check if next character is Reh, Yeh or Alef Maksura
+                            // check if next character is Reh or Yeh-like
                             sal_Unicode cNextCh = rWord[ nIdx + 1 ];
                             if ( isRehChar ( cNextCh ) || isYehChar ( cNextCh ))
                            {
commit 979029ee6532791e39adea3b7078ab88386f0ecf
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Sun Nov 6 23:07:31 2016 +0200

    Insert Kashida before final Tah
    
    Looks like it was missing from the original code, though described here:
    https://www.microsoft.com/middleeast/msdn/JustifyingText-CSS.aspx
    
    Change-Id: Iab283cd8e9cc5aee37836ddb06d5e9b8ce8c18e4

diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index ff2f4b8..62b8024f 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -71,6 +71,7 @@ using namespace i18n::ScriptType;
 #define isLamChar(c)        IS_JOINING_GROUP((c), LAM)
 #define isQafChar(c)        IS_JOINING_GROUP((c), QAF)
 #define isRehChar(c)        IS_JOINING_GROUP((c), REH)
+#define isTahChar(c)        IS_JOINING_GROUP((c), TAH)
 #define isTehMarbutaChar(c) IS_JOINING_GROUP((c), TEH_MARBUTA)
 #define isWawChar(c)        IS_JOINING_GROUP((c), WAW)
 #if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4)
@@ -990,12 +991,13 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL )
                     }
 
                     // 4. Priority:
-                    // before final form of Alef, Lam or Kaf
+                    // before final form of Alef, Tah, Lam, Kaf or Gaf
                     if ( nPriorityLevel >= 3 && nIdx > 0 )
                     {
                         if ( isAlefChar ( cCh ) ||   // Alef (right joining) final form may appear in the middle of word
-                             (( isLamChar ( cCh ) || // Lam
-                              isKafChar ( cCh )   || // Kaf (both dual joining)
+                             (( isLamChar ( cCh ) || // Lam,
+                              isTahChar ( cCh )   || // Tah,
+                              isKafChar ( cCh )   || // Kaf (all dual joining)
                               isGafChar ( cCh ) )
                               && nIdx == nWordLen - 1))  // only at end of word
                         {


More information about the Libreoffice-commits mailing list