From f211d5c291b4c947cfd732e873627567173057e4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 9 Jun 2012 03:11:22 -0400 Subject: [PATCH] More Oops! Fix fast-path with sub-type==0 --- src/hb-ot-layout-gpos-table.hh | 2 +- src/hb-ot-layout-gsub-table.hh | 2 +- util/shape-consumer.hh | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 48f0a9d..c8020d8 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -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 (lookup_type, Context, ChainContext) && hb_in_range (u.header.sub_format, 1, 2)); } diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index e62be98..f5f38cc 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -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 (lookup_type, Context, ChainContext) && hb_in_range (u.header.sub_format, 1, 2)); } diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh index 220daa4..11e4cc3 100644 --- a/util/shape-consumer.hh +++ b/util/shape-consumer.hh @@ -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); } -- 2.7.4