提交 f211d5c2 编写于 作者: B Behdad Esfahbod

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

上级 b1de6aa1
...@@ -1311,7 +1311,7 @@ struct PosLookupSubTable ...@@ -1311,7 +1311,7 @@ struct PosLookupSubTable
inline bool can_use_fast_path (unsigned int lookup_type) const inline bool can_use_fast_path (unsigned int lookup_type) const
{ {
/* Fast path, for those that have coverage in the same place. */ /* 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> (lookup_type, Context, ChainContext) &&
hb_in_range<unsigned int> (u.header.sub_format, 1, 2)); hb_in_range<unsigned int> (u.header.sub_format, 1, 2));
} }
......
...@@ -970,7 +970,7 @@ struct SubstLookupSubTable ...@@ -970,7 +970,7 @@ struct SubstLookupSubTable
/* Fast path, for those that have coverage in the same place. /* Fast path, for those that have coverage in the same place.
* Note that ReverseChainSingle can also go through this but * Note that ReverseChainSingle can also go through this but
* it's not worth the effort. */ * 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> (lookup_type, Context, ChainContext) &&
hb_in_range<unsigned int> (u.header.sub_format, 1, 2)); hb_in_range<unsigned int> (u.header.sub_format, 1, 2));
} }
......
...@@ -49,6 +49,7 @@ struct shape_consumer_t ...@@ -49,6 +49,7 @@ struct shape_consumer_t
{ {
output.new_line (); output.new_line ();
for (unsigned int i = 0; i < 10000; i++) {
shaper.populate_buffer (buffer, text, text_len); shaper.populate_buffer (buffer, text, text_len);
output.consume_text (buffer, text, text_len, shaper.utf8_clusters); output.consume_text (buffer, text, text_len, shaper.utf8_clusters);
...@@ -58,6 +59,7 @@ struct shape_consumer_t ...@@ -58,6 +59,7 @@ struct shape_consumer_t
output.shape_failed (buffer, text, text_len, shaper.utf8_clusters); output.shape_failed (buffer, text, text_len, shaper.utf8_clusters);
return; return;
} }
}
output.consume_glyphs (buffer, text, text_len, shaper.utf8_clusters); output.consume_glyphs (buffer, text, text_len, shaper.utf8_clusters);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册