[USE] Move pref

This commit is contained in:
Behdad Esfahbod 2015-07-21 16:55:26 +01:00
parent 2d4b62ead9
commit 7ce03ebe7c
3 changed files with 32 additions and 10 deletions

View File

@ -55,6 +55,7 @@ FM = 8; # CONS_FINAL_MOD
#CM = 10; # CONS_MOD
SUB = 11; # CONS_SUB
H = 12; # HALANT
HN = 13; # HALANT_NUM
ZWNJ = 14; # Zero width non-joiner
ZWJ = 15; # Zero width joiner
@ -64,8 +65,8 @@ R = 18; # REPHA
S = 19; # SYM
#SM = 20; # SYM_MOD
VS = 21; # VARIATION_SELECTOR
#V = 22; # VOWEL
#VM = 23; # VOWEL_MOD
#V = 36; # VOWEL
#VM = 40; # VOWEL_MOD
FAbv = 24; # CONS_FINAL_ABOVE
FBlw = 25; # CONS_FINAL_BELOW
@ -79,11 +80,11 @@ CMBlw = 32; # CONS_MOD_BELOW
VAbv = 33; # VOWEL_ABOVE / VOWEL_ABOVE_BELOW / VOWEL_ABOVE_BELOW_POST / VOWEL_ABOVE_POST
VBlw = 34; # VOWEL_BELOW / VOWEL_BELOW_POST
VPst = 35; # VOWEL_POST UIPC = Right
VPre = 36; # VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST
VPre = 22; # VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST
VMAbv = 37; # VOWEL_MOD_ABOVE
VMBlw = 38; # VOWEL_MOD_BELOW
VMPst = 39; # VOWEL_MOD_POST
VMPre = 40; # VOWEL_MOD_PRE
VMPre = 23; # VOWEL_MOD_PRE
SMAbv = 41; # SYM_MOD_ABOVE
SMBlw = 42; # SYM_MOD_BELOW

View File

@ -57,6 +57,7 @@ enum use_category_t {
// USE_CM = 10, /* CONS_MOD */
USE_SUB = 11, /* CONS_SUB */
USE_H = 12, /* HALANT */
USE_HN = 13, /* HALANT_NUM */
USE_ZWNJ = 14, /* Zero width non-joiner */
USE_ZWJ = 15, /* Zero width joiner */
@ -66,8 +67,8 @@ enum use_category_t {
USE_S = 19, /* SYM */
// USE_SM = 20, /* SYM_MOD */
USE_VS = 21, /* VARIATION_SELECTOR */
// USE_V = 22, /* VOWEL */
// USE_VM = 23, /* VOWEL_MOD */
// USE_V = 36, /* VOWEL */
// USE_VM = 40, /* VOWEL_MOD */
USE_FAbv = 24, /* CONS_FINAL_ABOVE */
USE_FBlw = 25, /* CONS_FINAL_BELOW */
@ -81,11 +82,11 @@ enum use_category_t {
USE_VAbv = 33, /* VOWEL_ABOVE / VOWEL_ABOVE_BELOW / VOWEL_ABOVE_BELOW_POST / VOWEL_ABOVE_POST */
USE_VBlw = 34, /* VOWEL_BELOW / VOWEL_BELOW_POST */
USE_VPst = 35, /* VOWEL_POST UIPC = Right */
USE_VPre = 36, /* VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST */
USE_VPre = 22, /* VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST */
USE_VMAbv = 37, /* VOWEL_MOD_ABOVE */
USE_VMBlw = 38, /* VOWEL_MOD_BELOW */
USE_VMPst = 39, /* VOWEL_MOD_POST */
USE_VMPre = 40, /* VOWEL_MOD_PRE */
USE_VMPre = 23, /* VOWEL_MOD_PRE */
USE_SMAbv = 41, /* SYM_MOD_ABOVE */
USE_SMBlw = 42 /* SYM_MOD_BELOW */
};

View File

@ -347,8 +347,28 @@ reorder_syllable (const hb_ot_shape_plan_t *plan,
}
}
/* TODO move things back. */
/* Move things back. */
unsigned int j = end;
for (unsigned int i = start; i < end; i++)
{
uint32_t flag = FLAG_UNSAFE (info[i].use_category());
if (flag & (HALANT_FLAGS | BASE_FLAGS))
{
/* If we hit a halant, move before it; otherwise it's a base: move to it's
* place, and shift things in between backward. */
if (info[i].use_category() == USE_H)
j = i + 1;
else
j = i;
}
else if (((flag) & (FLAG (USE_VPre) | FLAG (USE_VMPre))) && j < i)
{
hb_glyph_info_t t = info[i];
memmove (&info[j + 1], &info[j], (i - j) * sizeof (info[0]));
info[j] = t;
buffer->merge_clusters (j, i + 1);
}
}
}
static inline void