[kerx] Actually hook up, and fix crash

This commit is contained in:
Behdad Esfahbod 2018-10-10 13:24:51 -04:00
parent b3390990f5
commit 7727e73756
3 changed files with 10 additions and 4 deletions

View File

@ -260,6 +260,12 @@ struct Lookup
}
}
inline const T& get_value_or_null (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
{
const T *v = get_value (glyph_id, num_glyphs);
return v ? *v : Null(T);
}
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);

View File

@ -109,8 +109,8 @@ struct KerxSubTableFormat2
inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right,
const char *end, unsigned int num_glyphs) const
{
unsigned int l = *(this+leftClassTable).get_value (left, num_glyphs);
unsigned int r = *(this+rightClassTable).get_value (right, num_glyphs);
unsigned int l = (this+leftClassTable).get_value_or_null (left, num_glyphs);
unsigned int r = (this+rightClassTable).get_value_or_null (right, num_glyphs);
unsigned int offset = l + r;
const FWORD *v = &StructAtOffset<FWORD> (&(this+array), offset);
if (unlikely ((const char *) v < (const char *) &array ||

View File

@ -826,6 +826,8 @@ hb_ot_position_complex (const hb_ot_shape_context_t *c)
if (c->plan->apply_gpos)
c->plan->position (c->font, c->buffer);
else if (c->plan->apply_kerx)
hb_aat_layout_position (c->plan, c->font, c->buffer);
switch (c->plan->shaper->zero_width_marks)
{
@ -875,8 +877,6 @@ hb_ot_position (const hb_ot_shape_context_t *c)
_hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer);
_hb_buffer_deallocate_gsubgpos_vars (c->buffer);
//hb_aat_layout_position (c->font, c->buffer);
}
static inline void