More Oops! Fix fast-path with sub-type==0

This commit is contained in:
Behdad Esfahbod 2012-06-09 03:11:22 -04:00
parent b1de6aa1f3
commit f211d5c291
3 changed files with 4 additions and 2 deletions

View File

@ -1311,7 +1311,7 @@ struct PosLookupSubTable
inline bool can_use_fast_path (unsigned int lookup_type) const
{
/* Fast path, for those that have coverage in the same place. */
return likely (lookup_type < Context) ||
return likely (lookup_type && lookup_type < Context) ||
(hb_in_range<unsigned int> (lookup_type, Context, ChainContext) &&
hb_in_range<unsigned int> (u.header.sub_format, 1, 2));
}

View File

@ -970,7 +970,7 @@ struct SubstLookupSubTable
/* Fast path, for those that have coverage in the same place.
* Note that ReverseChainSingle can also go through this but
* it's not worth the effort. */
return likely (lookup_type < Context) ||
return likely (lookup_type && lookup_type < Context) ||
(hb_in_range<unsigned int> (lookup_type, Context, ChainContext) &&
hb_in_range<unsigned int> (u.header.sub_format, 1, 2));
}

View File

@ -49,6 +49,7 @@ struct shape_consumer_t
{
output.new_line ();
for (unsigned int i = 0; i < 10000; i++) {
shaper.populate_buffer (buffer, text, text_len);
output.consume_text (buffer, text, text_len, shaper.utf8_clusters);
@ -58,6 +59,7 @@ struct shape_consumer_t
output.shape_failed (buffer, text, text_len, shaper.utf8_clusters);
return;
}
}
output.consume_glyphs (buffer, text, text_len, shaper.utf8_clusters);
}