diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 7d3eb56a5..ea0291280 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -559,7 +559,12 @@ struct AlternateSet /* If alt_index is MAX_VALUE, randomize feature if it is the rand feature. */ if (alt_index == HB_OT_MAP_MAX_VALUE && c->random) + { + /* Maybe we can do better than unsafe-to-break all; but since we are + * changing random state, it would be hard to track that. Good 'nough. */ + c->buffer->unsafe_to_break_all (); alt_index = c->random_number () % count + 1; + } if (unlikely (alt_index > count || alt_index == 0)) return_trace (false); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index f68e5206c..8b80aca05 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1933,8 +1933,6 @@ inline void hb_ot_map_t::apply (const Proxy &proxy, c.set_auto_zwj (lookups[table_index][i].auto_zwj); c.set_auto_zwnj (lookups[table_index][i].auto_zwnj); c.set_random (lookups[table_index][i].random); - if (c.random) - buffer->unsafe_to_break_all (); apply_string (&c, proxy.table.get_lookup (lookup_index),