[indic] Recover OT_H undergone ligation and multiplication

Sometimes font designers form half/pref/etc consonant forms
unconditionally and then undo that conditionally.  Try to
recover the OT_H classification in those cases.

No test number changes expected.
pull/27/merge
Behdad Esfahbod 11 years ago
parent 39c8201f8e
commit 04dc52fa15
  1. 8
      src/hb-ot-layout-private.hh
  2. 21
      src/hb-ot-shape-complex-indic.cc

@ -395,6 +395,14 @@ _hb_glyph_info_ligated_and_didnt_multiply (const hb_glyph_info_t *info)
return _hb_glyph_info_ligated (info) && !_hb_glyph_info_multiplied (info);
}
static inline void
_hb_glyph_info_clear_ligated_and_multiplied (hb_glyph_info_t *info)
{
info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
}
/* Allocation / deallocation. */
static inline void

@ -1336,6 +1336,27 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data;
hb_glyph_info_t *info = buffer->info;
/* This function relies heavily on halant glyphs. Lots of ligation
* and possibly multiplication substitutions happened prior to this
* phase, and that might have messed up our properties. Recover
* from a particular case of that where we're fairly sure that a
* class of OT_H is desired but has been lost. */
if (indic_plan->virama_glyph)
{
unsigned int virama_glyph = indic_plan->virama_glyph;
for (unsigned int i = start; i < end; i++)
if (info[i].codepoint == virama_glyph &&
_hb_glyph_info_ligated (&info[i]) &&
_hb_glyph_info_multiplied (&info[i]))
{
/* This will make sure that this glyph passes is_halant_or_coeng() test. */
info[i].indic_category() = OT_H;
_hb_glyph_info_clear_ligated_and_multiplied (&info[i]);
}
}
/* 4. Final reordering:
*
* After the localized forms and basic shaping forms GSUB features have been

Loading…
Cancel
Save