diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2011-07-30 21:08:10 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2011-07-30 21:08:10 -0400 |
commit | f5bc2725cb892264ba223e0a49f7fd2c622a0730 (patch) | |
tree | 55333f7253273c19795a6678b30a13ab797679cd | |
parent | c47a31fb4793b825f4be57e9cb1b10db352b9512 (diff) | |
download | video-player-f5bc2725cb892264ba223e0a49f7fd2c622a0730.tar.gz video-player-f5bc2725cb892264ba223e0a49f7fd2c622a0730.tar.bz2 video-player-f5bc2725cb892264ba223e0a49f7fd2c622a0730.zip |
[Indic] For old-style Indic tables, move Halant around
In old-style Indic OT standards, the post-base Halants are moved after
their base. Emulate that by moving first post-base Halant to
post-last-consonant.
Brings test-shape-complex failures down from 88 to 54. Getting there!
-rw-r--r-- | src/hb-ot-map-private.hh | 3 | ||||
-rw-r--r-- | src/hb-ot-shape-complex-indic.cc | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh index 2327e04..5e6aca3 100644 --- a/src/hb-ot-map-private.hh +++ b/src/hb-ot-map-private.hh @@ -60,6 +60,9 @@ struct hb_ot_map_t return map ? map->_1_mask : 0; } + inline hb_tag_t get_chosen_script (unsigned int table_index) const + { return chosen_script[table_index]; } + inline void substitute (hb_face_t *face, hb_buffer_t *buffer) const { apply (0, (hb_ot_map_t::apply_lookup_func_t) hb_ot_layout_substitute_lookup, face, buffer); } inline void position (hb_font_t *font, hb_buffer_t *buffer) const diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index d51b508..cc51b9c 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -506,6 +506,26 @@ found_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t info[start].mask = mask_array[RPHF]; } + /* For old-style Indic script tags, move the first post-base Halant after + * last consonant. */ + if ((map->get_chosen_script (0) & 0x000000FF) != '2') { + /* We should only do this for Indic scripts which have a version two I guess. */ + for (i = base + 1; i < end; i++) + if (info[i].indic_category() == OT_H) { + unsigned int j; + for (j = end - 1; j > i; j--) + if ((FLAG (info[j].indic_category()) & (FLAG (OT_C) | FLAG (OT_Ra)))) + break; + if (j > i) { + /* Move Halant to after last consonant. */ + hb_glyph_info_t t = info[i]; + memmove (&info[i], &info[i + 1], (j - i) * sizeof (info[0])); + info[j] = t; + } + break; + } + } + /* Attach ZWJ, ZWNJ, nukta, and halant to previous char to move with them. */ for (i = start + 1; i < end; i++) if ((FLAG (info[i].indic_category()) & |