[coretext/uniscribe/directwrite/graphite/fallback] Update for unsafe-to-break

Fixes https://github.com/behdad/harfbuzz/issues/615

We'll see which bots I broke.
This commit is contained in:
Behdad Esfahbod 2017-11-10 17:14:27 -08:00
parent 4de03a1585
commit e4da380200
6 changed files with 24 additions and 4 deletions

View File

@ -305,7 +305,7 @@ struct hb_buffer_t {
info.cluster = cluster; info.cluster = cluster;
} }
int inline int
_unsafe_to_break_find_min_cluster (const hb_glyph_info_t *info, _unsafe_to_break_find_min_cluster (const hb_glyph_info_t *info,
unsigned int start, unsigned int end, unsigned int start, unsigned int end,
unsigned int cluster) const unsigned int cluster) const
@ -314,7 +314,7 @@ struct hb_buffer_t {
cluster = MIN<unsigned int> (cluster, info[i].cluster); cluster = MIN<unsigned int> (cluster, info[i].cluster);
return cluster; return cluster;
} }
void inline void
_unsafe_to_break_set_mask (hb_glyph_info_t *info, _unsafe_to_break_set_mask (hb_glyph_info_t *info,
unsigned int start, unsigned int end, unsigned int start, unsigned int end,
unsigned int cluster) unsigned int cluster)
@ -326,6 +326,19 @@ struct hb_buffer_t {
info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK; info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
} }
} }
inline void
unsafe_to_break_all (void)
{
for (unsigned int i = 0; i < len; i++)
info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
}
inline void
safe_to_break_all (void)
{
for (unsigned int i = 0; i < len; i++)
info[i].mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
}
}; };

View File

@ -1262,6 +1262,8 @@ resize_and_retry:
} }
} }
buffer->unsafe_to_break_all ();
#undef FAIL #undef FAIL
fail: fail:

View File

@ -927,8 +927,7 @@ hb_directwrite_shape_experimental_width(hb_font_t *font,
hb_bool_t res = _hb_directwrite_shape_full (shape_plan, font, buffer, hb_bool_t res = _hb_directwrite_shape_full (shape_plan, font, buffer,
features, num_features, width); features, num_features, width);
if (res) buffer->unsafe_to_break_all ();
buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS;
return res; return res;
} }

View File

@ -143,5 +143,7 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
if (HB_DIRECTION_IS_BACKWARD (direction)) if (HB_DIRECTION_IS_BACKWARD (direction))
hb_buffer_reverse (buffer); hb_buffer_reverse (buffer);
buffer->safe_to_break_all ();
return true; return true;
} }

View File

@ -416,5 +416,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
if (feats) gr_featureval_destroy (feats); if (feats) gr_featureval_destroy (feats);
gr_seg_destroy (seg); gr_seg_destroy (seg);
buffer->unsafe_to_break_all ();
return true; return true;
} }

View File

@ -1032,6 +1032,8 @@ retry:
if (backward) if (backward)
hb_buffer_reverse (buffer); hb_buffer_reverse (buffer);
buffer->unsafe_to_break_all ();
/* Wow, done! */ /* Wow, done! */
return true; return true;
} }