From 94d43c008ab4ec2281b693af1f4014b1ebce1b14 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 4 Dec 2021 16:56:39 -0800 Subject: [PATCH] [buffer] Merge and rename clear_glyph_flags() --- src/hb-buffer.hh | 5 ++--- src/hb-coretext.cc | 2 +- src/hb-directwrite.cc | 2 +- src/hb-fallback-shape.cc | 2 +- src/hb-graphite2.cc | 2 +- src/hb-ot-layout-gsub-table.hh | 2 +- src/hb-uniscribe.cc | 2 +- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh index bde28933e..a2ad9945c 100644 --- a/src/hb-buffer.hh +++ b/src/hb-buffer.hh @@ -450,11 +450,10 @@ struct hb_buffer_t } } - void unsafe_to_break_all () { unsafe_to_break_impl (0, len); } - void safe_to_break_all () + void clear_glyph_flags (hb_mask_t mask = 0) { for (unsigned int i = 0; i < len; i++) - info[i].mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK; + info[i].mask = (info[i].mask & ~HB_GLYPH_FLAG_DEFINED) | (mask & HB_GLYPH_FLAG_DEFINED); } }; DECLARE_NULL_INSTANCE (hb_buffer_t); diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 4b6c67c1e..a512f3b8b 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -1213,7 +1213,7 @@ resize_and_retry: } } - buffer->unsafe_to_break_all (); + buffer->clear_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_BREAK); #undef FAIL diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc index 2b327e081..dea87b8cd 100644 --- a/src/hb-directwrite.cc +++ b/src/hb-directwrite.cc @@ -762,7 +762,7 @@ retry_getglyphs: if (isRightToLeft) hb_buffer_reverse (buffer); - buffer->unsafe_to_break_all (); + buffer->clear_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_BREAK); delete [] clusterMap; delete [] glyphIndices; diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc index c5b7c2c23..f8524ecc8 100644 --- a/src/hb-fallback-shape.cc +++ b/src/hb-fallback-shape.cc @@ -117,7 +117,7 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan HB_UNUSED, if (HB_DIRECTION_IS_BACKWARD (direction)) hb_buffer_reverse (buffer); - buffer->safe_to_break_all (); + buffer->clear_glyph_flags (); return true; } diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index 209207f1e..42420ac0b 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -439,7 +439,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan HB_UNUSED, if (feats) gr_featureval_destroy (feats); gr_seg_destroy (seg); - buffer->unsafe_to_break_all (); + buffer->clear_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_BREAK); return true; } diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 710c5fbbb..b7ce30135 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -566,7 +566,7 @@ struct AlternateSet { /* 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 (); + c->buffer->unsafe_to_break (0, c->buffer->len); alt_index = c->random_number () % count + 1; } diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index 3dc4c0937..0e5a114f7 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -878,7 +878,7 @@ retry: if (backward) hb_buffer_reverse (buffer); - buffer->unsafe_to_break_all (); + buffer->clear_glyph_flags (HB_GLYPH_FLAG_UNSAFE_TO_BREAK); /* Wow, done! */ return true;