[use] Implement Consonant_With_Stacker
authorBehdad Esfahbod <behdad@behdad.org>
Tue, 3 Oct 2017 12:57:14 +0000 (14:57 +0200)
committerBehdad Esfahbod <behdad@behdad.org>
Tue, 3 Oct 2017 12:57:14 +0000 (14:57 +0200)
Related to https://github.com/behdad/harfbuzz/issues/528

src/gen-use-table.py
src/hb-ot-shape-complex-use-machine.rl
src/hb-ot-shape-complex-use-private.hh
src/hb-ot-shape-complex-use-table.cc

index 4f48261..09cc64f 100755 (executable)
@@ -178,6 +178,8 @@ def is_CONS_MOD(U, UISC, UGC):
 def is_CONS_SUB(U, UISC, UGC):
        #SPEC-DRAFT return UISC == Consonant_Subjoined
        return UISC == Consonant_Subjoined and UGC != Lo
+def is_CONS_WITH_STACKER(U, UISC, UGC):
+       return UISC == Consonant_With_Stacker
 def is_HALANT(U, UISC, UGC):
        return UISC in [Virama, Invisible_Stacker]
 def is_HALANT_NUM(U, UISC, UGC):
@@ -199,9 +201,7 @@ def is_OTHER(U, UISC, UGC):
 def is_Reserved(U, UISC, UGC):
        return UGC == 'Cn'
 def is_REPHA(U, UISC, UGC):
-       #return UISC == Consonant_Preceding_Repha
-       #SPEC-OUTDATED hack to categorize Consonant_With_Stacker and Consonant_Prefixed
-       return UISC in [Consonant_Preceding_Repha, Consonant_With_Stacker, Consonant_Prefixed]
+       return UISC in [Consonant_Preceding_Repha, Consonant_Prefixed]
 def is_SYM(U, UISC, UGC):
        if U == 0x25CC: return False #SPEC-DRAFT
        #SPEC-DRAFT return UGC in [So, Sc] or UISC == Symbol_Letter
@@ -230,6 +230,7 @@ use_mapping = {
        'M':    is_CONS_MED,
        'CM':   is_CONS_MOD,
        'SUB':  is_CONS_SUB,
+       'CS':   is_CONS_WITH_STACKER,
        'H':    is_HALANT,
        'HN':   is_HALANT_NUM,
        'ZWNJ': is_ZWNJ,
index 2a7f751..7bd8fce 100644 (file)
@@ -86,6 +86,7 @@ VMPst = 39; # VOWEL_MOD_POST
 VMPre  = 23; # VOWEL_MOD_PRE
 SMAbv  = 41; # SYM_MOD_ABOVE
 SMBlw  = 42; # SYM_MOD_BELOW
+CS     = 43; # CONS_WITH_STACKER
 
 
 consonant_modifiers = CMAbv* CMBlw* ((H B | SUB) VS? CMAbv? CMBlw*)*;
@@ -96,12 +97,12 @@ vowel_modifiers = VMPre* VMAbv* VMBlw* VMPst*;
 final_consonants = FAbv* FBlw* FPst* FM?;
 
 virama_terminated_cluster =
-       R? (B | GB) VS?
+       (R|CS)? (B | GB) VS?
        consonant_modifiers
        H
 ;
 standard_cluster =
-       R? (B | GB) VS?
+       (R|CS)? (B | GB) VS?
        consonant_modifiers
        medial_consonants
        dependent_vowels
index ae428cb..3e763ae 100644 (file)
@@ -87,7 +87,8 @@ enum use_category_t {
   USE_VMPst    = 39,   /* VOWEL_MOD_POST */
   USE_VMPre    = 23,   /* VOWEL_MOD_PRE */
   USE_SMAbv    = 41,   /* SYM_MOD_ABOVE */
-  USE_SMBlw    = 42    /* SYM_MOD_BELOW */
+  USE_SMBlw    = 42,   /* SYM_MOD_BELOW */
+  USE_CS       = 43    /* CONS_WITH_STACKER */
 };
 
 HB_INTERNAL USE_TABLE_ELEMENT_TYPE
index daae04e..1f90fc8 100644 (file)
@@ -19,6 +19,7 @@
 
 #define B      USE_B   /* BASE */
 #define CGJ    USE_CGJ /* CGJ */
+#define CS     USE_CS  /* CONS_WITH_STACKER */
 #define FM     USE_FM  /* CONS_FINAL_MOD */
 #define GB     USE_GB  /* BASE_OTHER */
 #define H      USE_H   /* HALANT */
@@ -163,7 +164,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
   /* 0CC0 */  VAbv,  VPst,  VPst,  VPst,  VPst,     O,  VAbv,  VAbv,  VAbv,     O,  VAbv,  VAbv,  VAbv,     H,     O,     O,
   /* 0CD0 */     O,     O,     O,     O,     O,  VPst,  VPst,     O,     O,     O,     O,     O,     O,     O,     B,     O,
   /* 0CE0 */     B,     B,  VBlw,  VBlw,     O,     O,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
-  /* 0CF0 */     O,     R,     R,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
+  /* 0CF0 */     O,    CS,    CS,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,     O,
 
   /* Malayalam */
 
@@ -467,7 +468,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
 
   /* Brahmi */
 
-  /* 11000 */ VMPst, VMAbv, VMPst,     R,     R,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
+  /* 11000 */ VMPst, VMAbv, VMPst,    CS,    CS,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11010 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11020 */     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,     B,
   /* 11030 */     B,     B,     B,     B,     B,     B,     B,     B,  VAbv,  VAbv,  VAbv,  VAbv,  VBlw,  VBlw,  VBlw,  VBlw,
@@ -729,6 +730,7 @@ hb_use_get_categories (hb_codepoint_t u)
 
 #undef B
 #undef CGJ
+#undef CS
 #undef FM
 #undef GB
 #undef H