[test-buffer-serialize] Handle too-small out buffer
Need to handle too-small in buffer still.
This commit is contained in:
parent
39d50008f8
commit
a1101f09ca
|
@ -56,10 +56,6 @@ main (int argc, char **argv)
|
|||
hb_font_t *font = hb_font_create (face);
|
||||
hb_face_destroy (face);
|
||||
hb_font_set_scale (font, upem, upem);
|
||||
//hb_ot_font_set_funcs (font);
|
||||
#ifdef HAVE_FREETYPE
|
||||
//hb_ft_font_set_funcs (font);
|
||||
#endif
|
||||
|
||||
hb_buffer_t *buf;
|
||||
buf = hb_buffer_create ();
|
||||
|
@ -78,11 +74,17 @@ main (int argc, char **argv)
|
|||
if (*p && *p != '\n')
|
||||
ret = false;
|
||||
|
||||
hb_buffer_serialize_glyphs (buf, 0, hb_buffer_get_length (buf),
|
||||
out, sizeof (out), nullptr,
|
||||
font, HB_BUFFER_SERIALIZE_FORMAT_TEXT,
|
||||
HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS);
|
||||
puts (out);
|
||||
unsigned count = hb_buffer_get_length (buf);
|
||||
for (unsigned offset = 0; offset < count;)
|
||||
{
|
||||
unsigned len;
|
||||
offset += hb_buffer_serialize_glyphs (buf, offset, count,
|
||||
out, sizeof (out), &len,
|
||||
font, HB_BUFFER_SERIALIZE_FORMAT_TEXT,
|
||||
HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS);
|
||||
fwrite (out, 1, len, stdout);
|
||||
}
|
||||
fputs ("\n", stdout);
|
||||
}
|
||||
|
||||
hb_buffer_destroy (buf);
|
||||
|
|
Loading…
Reference in New Issue