|
|
|
@ -1487,11 +1487,13 @@ hb_ot_layout_lookup_would_substitute (hb_face_t *face, |
|
|
|
|
unsigned int glyphs_length, |
|
|
|
|
hb_bool_t zero_context) |
|
|
|
|
{ |
|
|
|
|
if (unlikely (lookup_index >= face->table.GSUB->lookup_count)) return false; |
|
|
|
|
auto &gsub = face->table.GSUB; |
|
|
|
|
if (unlikely (lookup_index >= gsub->lookup_count)) return false; |
|
|
|
|
OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context); |
|
|
|
|
|
|
|
|
|
const OT::SubstLookup& l = face->table.GSUB->table->get_lookup (lookup_index); |
|
|
|
|
return l.would_apply (&c, &face->table.GSUB->accels[lookup_index]); |
|
|
|
|
const OT::SubstLookup& l = gsub->table->get_lookup (lookup_index); |
|
|
|
|
auto *accel = gsub->get_accel (lookup_index); |
|
|
|
|
return accel && l.would_apply (&c, accel); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1830,11 +1832,9 @@ struct GSUBProxy |
|
|
|
|
typedef OT::SubstLookup Lookup; |
|
|
|
|
|
|
|
|
|
GSUBProxy (hb_face_t *face) : |
|
|
|
|
table (*face->table.GSUB->table), |
|
|
|
|
accels (face->table.GSUB->accels) {} |
|
|
|
|
accel (*face->table.GSUB) {} |
|
|
|
|
|
|
|
|
|
const GSUB &table; |
|
|
|
|
const OT::hb_ot_layout_lookup_accelerator_t *accels; |
|
|
|
|
const GSUB::accelerator_t &accel; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
struct GPOSProxy |
|
|
|
@ -1844,11 +1844,9 @@ struct GPOSProxy |
|
|
|
|
typedef OT::PosLookup Lookup; |
|
|
|
|
|
|
|
|
|
GPOSProxy (hb_face_t *face) : |
|
|
|
|
table (*face->table.GPOS->table), |
|
|
|
|
accels (face->table.GPOS->accels) {} |
|
|
|
|
accel (*face->table.GPOS) {} |
|
|
|
|
|
|
|
|
|
const GPOS &table; |
|
|
|
|
const OT::hb_ot_layout_lookup_accelerator_t *accels; |
|
|
|
|
const GPOS::accelerator_t &accel; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1911,12 +1909,13 @@ apply_string (OT::hb_ot_apply_context_t *c, |
|
|
|
|
const typename Proxy::Lookup &lookup, |
|
|
|
|
const OT::hb_ot_layout_lookup_accelerator_t &accel) |
|
|
|
|
{ |
|
|
|
|
bool ret = false; |
|
|
|
|
hb_buffer_t *buffer = c->buffer; |
|
|
|
|
unsigned subtable_count = lookup.get_subtable_count (); |
|
|
|
|
|
|
|
|
|
if (unlikely (!buffer->len || !c->lookup_mask)) |
|
|
|
|
return ret; |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
bool ret = false; |
|
|
|
|
|
|
|
|
|
c->set_lookup_props (lookup.get_props ()); |
|
|
|
|
|
|
|
|
@ -1962,6 +1961,10 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, |
|
|
|
|
auto &lookup = lookups[table_index][i]; |
|
|
|
|
|
|
|
|
|
unsigned int lookup_index = lookup.index; |
|
|
|
|
|
|
|
|
|
auto *accel = proxy.accel.get_accel (lookup_index); |
|
|
|
|
if (unlikely (!accel)) continue; |
|
|
|
|
|
|
|
|
|
if (buffer->messaging () && |
|
|
|
|
!buffer->message (font, "start lookup %u feature '%c%c%c%c'", lookup_index, HB_UNTAG (lookup.feature_tag))) continue; |
|
|
|
|
|
|
|
|
@ -1969,7 +1972,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, |
|
|
|
|
* (plus some past glyphs). |
|
|
|
|
* |
|
|
|
|
* Only try applying the lookup if there is any overlap. */ |
|
|
|
|
if (proxy.accels[lookup_index].digest.may_have (c.digest)) |
|
|
|
|
if (accel->digest.may_have (c.digest)) |
|
|
|
|
{ |
|
|
|
|
c.set_lookup_index (lookup_index); |
|
|
|
|
c.set_lookup_mask (lookup.mask); |
|
|
|
@ -1979,8 +1982,8 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, |
|
|
|
|
c.set_per_syllable (lookup.per_syllable); |
|
|
|
|
|
|
|
|
|
apply_string<Proxy> (&c, |
|
|
|
|
proxy.table.get_lookup (lookup_index), |
|
|
|
|
proxy.accels[lookup_index]); |
|
|
|
|
proxy.accel.table->get_lookup (lookup_index), |
|
|
|
|
*accel); |
|
|
|
|
} |
|
|
|
|
else if (buffer->messaging ()) |
|
|
|
|
(void) buffer->message (font, "skipped lookup %u feature '%c%c%c%c' because no glyph matches", lookup_index, HB_UNTAG (lookup.feature_tag)); |
|
|
|
|