[buffer] HB_NODISCARD replace_glyph()

This commit is contained in:
Behdad Esfahbod 2021-03-15 13:33:44 -06:00
parent 607979d12f
commit 3f1998a065
4 changed files with 7 additions and 8 deletions

View File

@ -525,7 +525,7 @@ struct LigatureSubtable
hb_codepoint_t lig = ligatureData;
DEBUG_MSG (APPLY, nullptr, "Produced ligature %u", lig);
buffer->replace_glyph (lig);
if (unlikely (!buffer->replace_glyph (lig))) return;
unsigned int lig_end = match_positions[(match_length - 1u) % ARRAY_LENGTH (match_positions)] + 1u;
/* Now go and delete all subsequent components. */
@ -533,7 +533,7 @@ struct LigatureSubtable
{
DEBUG_MSG (APPLY, nullptr, "Skipping ligature component");
buffer->move_to (match_positions[--match_length % ARRAY_LENGTH (match_positions)]);
buffer->replace_glyph (DELETED_GLYPH);
if (unlikely (!buffer->replace_glyph (DELETED_GLYPH))) return;
}
buffer->move_to (lig_end);

View File

@ -215,7 +215,7 @@ struct hb_buffer_t
unsigned int num_out,
const hb_codepoint_t *glyph_data);
bool replace_glyph (hb_codepoint_t glyph_index)
HB_NODISCARD bool replace_glyph (hb_codepoint_t glyph_index)
{
if (unlikely (out_info != info || out_len != idx))
{

View File

@ -659,7 +659,7 @@ struct hb_ot_apply_context_t :
void replace_glyph (hb_codepoint_t glyph_index) const
{
_set_glyph_props (glyph_index);
buffer->replace_glyph (glyph_index);
(void) buffer->replace_glyph (glyph_index);
}
void replace_glyph_inplace (hb_codepoint_t glyph_index) const
{
@ -670,7 +670,7 @@ struct hb_ot_apply_context_t :
unsigned int class_guess) const
{
_set_glyph_props (glyph_index, class_guess, true);
buffer->replace_glyph (glyph_index);
(void) buffer->replace_glyph (glyph_index);
}
void output_glyph_for_component (hb_codepoint_t glyph_index,
unsigned int class_guess) const

View File

@ -334,9 +334,8 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
/* Is SARA AM. Decompose and reorder. */
hb_glyph_info_t &nikhahit = buffer->output_glyph (NIKHAHIT_FROM_SARA_AM (u));
_hb_glyph_info_set_continuation (&nikhahit);
buffer->replace_glyph (SARA_AA_FROM_SARA_AM (u));
if (unlikely (!buffer->successful))
return;
if (unlikely (!buffer->replace_glyph (SARA_AA_FROM_SARA_AM (u))))
break;
/* Make Nikhahit be recognized as a ccc=0 mark when zeroing widths. */
unsigned int end = buffer->out_len;