[buffer] HB_NODISCARD replace_glyphs()

pull/2900/head
Behdad Esfahbod 4 years ago
parent 906c9928bb
commit 607979d12f
  1. 7
      src/hb-buffer.hh
  2. 10
      src/hb-ot-shape-complex-hangul.cc
  3. 2
      src/hb-ot-shape-normalize.cc

@ -210,9 +210,10 @@ struct hb_buffer_t
HB_INTERNAL void clear_output ();
HB_INTERNAL void clear_positions ();
HB_INTERNAL bool replace_glyphs (unsigned int num_in,
unsigned int num_out,
const hb_codepoint_t *glyph_data);
HB_INTERNAL HB_NODISCARD
bool replace_glyphs (unsigned int num_in,
unsigned int num_out,
const hb_codepoint_t *glyph_data);
bool replace_glyph (hb_codepoint_t glyph_index)
{

@ -231,7 +231,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
chars[0] = 0x25CCu;
chars[1] = u;
}
buffer->replace_glyphs (1, 2, chars);
(void) buffer->replace_glyphs (1, 2, chars);
}
else
{
@ -273,7 +273,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_codepoint_t s = SBase + (l - LBase) * NCount + (v - VBase) * TCount + tindex;
if (font->has_glyph (s))
{
buffer->replace_glyphs (t ? 3 : 2, 1, &s);
(void) buffer->replace_glyphs (t ? 3 : 2, 1, &s);
end = start + 1;
continue;
}
@ -323,9 +323,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_codepoint_t new_s = s + new_tindex;
if (font->has_glyph (new_s))
{
buffer->replace_glyphs (2, 1, &new_s);
if (unlikely (!buffer->successful))
break;
(void) buffer->replace_glyphs (2, 1, &new_s);
end = start + 1;
continue;
}
@ -349,7 +347,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan HB_UNUSED,
(!tindex || font->has_glyph (decomposed[2])))
{
unsigned int s_len = tindex ? 3 : 2;
buffer->replace_glyphs (1, s_len, decomposed);
(void) buffer->replace_glyphs (1, s_len, decomposed);
/* If we decomposed an LV because of a non-combining T following,
* we want to include this T in the syllable.

@ -229,7 +229,7 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c,
if (font->get_variation_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index()))
{
hb_codepoint_t unicode = buffer->cur().codepoint;
buffer->replace_glyphs (2, 1, &unicode);
(void) buffer->replace_glyphs (2, 1, &unicode);
}
else
{

Loading…
Cancel
Save