Fix substitution glyph class propagation

The old code was doing nothing.

Still got to find an example font+string that makes this matter, but
need this for fixing synthetic GDEF anyway.
This commit is contained in:
Behdad Esfahbod 2012-05-22 22:12:22 -04:00
parent a6de53664d
commit ed2f1363a3
2 changed files with 10 additions and 23 deletions

View File

@ -212,9 +212,8 @@ struct Sequence
TRACE_APPLY ();
if (unlikely (!substitute.len)) return TRACE_RETURN (false);
if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)
c->guess_glyph_class (HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH);
c->replace_glyphs_be16 (1, substitute.len, (const uint16_t *) substitute.array);
unsigned int klass = c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE ? HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH : 0;
c->replace_glyphs_be16 (1, substitute.len, (const uint16_t *) substitute.array, klass);
return TRACE_RETURN (true);
}
@ -495,8 +494,7 @@ struct Ligature
if (likely (c->buffer->info[skippy_iter.idx].codepoint != component[i])) return TRACE_RETURN (false);
}
if (first_was_mark && found_non_mark)
c->guess_glyph_class (HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE);
unsigned int klass = first_was_mark && found_non_mark ? HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE : 0;
/* Allocate new ligature id */
unsigned int lig_id = allocate_lig_id (c->buffer);
@ -504,7 +502,7 @@ struct Ligature
if (skippy_iter.idx < c->buffer->idx + count) /* No input glyphs skipped */
{
c->replace_glyphs_be16 (count, 1, (const uint16_t *) &ligGlyph);
c->replace_glyphs_be16 (count, 1, (const uint16_t *) &ligGlyph, klass);
}
else
{

View File

@ -222,31 +222,20 @@ struct hb_apply_context_t
inline void replace_glyph (hb_codepoint_t glyph_index) const
inline void replace_glyph (hb_codepoint_t glyph_index,
unsigned int klass = 0) const
{
clear_property ();
buffer->cur().props_cache() = klass; /*XXX if has gdef? */
buffer->replace_glyph (glyph_index);
}
inline void replace_glyphs_be16 (unsigned int num_in,
unsigned int num_out,
const uint16_t *glyph_data_be) const
const uint16_t *glyph_data_be,
unsigned int klass = 0) const
{
clear_property ();
buffer->cur().props_cache() = klass; /* XXX if has gdef? */
buffer->replace_glyphs_be16 (num_in, num_out, glyph_data_be);
}
inline void guess_glyph_class (unsigned int klass)
{
/* XXX if ! has gdef */
buffer->cur().props_cache() = klass;
}
private:
inline void clear_property (void) const
{
/* XXX if has gdef */
buffer->cur().props_cache() = 0;
}
};