Use hb_buffer_serialize to trace in utils
This commit is contained in:
parent
58bcc1cedd
commit
a0203a28bb
@ -137,7 +137,7 @@ struct output_buffer_t
|
|||||||
g_string_set_size (gs, 0);
|
g_string_set_size (gs, 0);
|
||||||
format.serialize_line_no (line_no, gs);
|
format.serialize_line_no (line_no, gs);
|
||||||
g_string_append_printf (gs, "trace: %s buffer: ", message);
|
g_string_append_printf (gs, "trace: %s buffer: ", message);
|
||||||
format.serialize_glyphs (buffer, font, output_format, format_flags, gs);
|
format.serialize (buffer, font, output_format, format_flags, gs);
|
||||||
g_string_append_c (gs, '\n');
|
g_string_append_c (gs, '\n');
|
||||||
fprintf (options.fp, "%s", gs->str);
|
fprintf (options.fp, "%s", gs->str);
|
||||||
}
|
}
|
||||||
|
@ -910,31 +910,16 @@ format_options_t::add_options (option_parser_t *parser)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
format_options_t::serialize_unicode (hb_buffer_t *buffer,
|
format_options_t::serialize (hb_buffer_t *buffer,
|
||||||
GString *gs)
|
|
||||||
{
|
|
||||||
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
|
||||||
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
|
|
||||||
|
|
||||||
g_string_append_c (gs, '<');
|
|
||||||
for (unsigned int i = 0; i < num_glyphs; i++)
|
|
||||||
{
|
|
||||||
if (i)
|
|
||||||
g_string_append_c (gs, ',');
|
|
||||||
g_string_append_printf (gs, "U+%04X", info->codepoint);
|
|
||||||
info++;
|
|
||||||
}
|
|
||||||
g_string_append_c (gs, '>');
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
format_options_t::serialize_glyphs (hb_buffer_t *buffer,
|
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_serialize_format_t output_format,
|
hb_buffer_serialize_format_t output_format,
|
||||||
hb_buffer_serialize_flags_t flags,
|
hb_buffer_serialize_flags_t flags,
|
||||||
GString *gs)
|
GString *gs)
|
||||||
{
|
{
|
||||||
g_string_append_c (gs, '[');
|
if (hb_buffer_get_content_type(buffer) == HB_BUFFER_CONTENT_TYPE_UNICODE)
|
||||||
|
g_string_append_c (gs, '<');
|
||||||
|
else
|
||||||
|
g_string_append_c (gs, '[');
|
||||||
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
||||||
unsigned int start = 0;
|
unsigned int start = 0;
|
||||||
|
|
||||||
@ -942,15 +927,19 @@ format_options_t::serialize_glyphs (hb_buffer_t *buffer,
|
|||||||
{
|
{
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
unsigned int consumed;
|
unsigned int consumed;
|
||||||
start += hb_buffer_serialize_glyphs (buffer, start, num_glyphs,
|
start += hb_buffer_serialize (buffer, start, num_glyphs,
|
||||||
buf, sizeof (buf), &consumed,
|
buf, sizeof (buf), &consumed,
|
||||||
font, output_format, flags);
|
font, output_format, flags);
|
||||||
if (!consumed)
|
if (!consumed)
|
||||||
break;
|
break;
|
||||||
g_string_append (gs, buf);
|
g_string_append (gs, buf);
|
||||||
}
|
}
|
||||||
g_string_append_c (gs, ']');
|
if (hb_buffer_get_content_type(buffer) == HB_BUFFER_CONTENT_TYPE_UNICODE)
|
||||||
|
g_string_append_c (gs, '>');
|
||||||
|
else
|
||||||
|
g_string_append_c (gs, ']');
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
format_options_t::serialize_line_no (unsigned int line_no,
|
format_options_t::serialize_line_no (unsigned int line_no,
|
||||||
GString *gs)
|
GString *gs)
|
||||||
@ -978,7 +967,7 @@ format_options_t::serialize_buffer_of_text (hb_buffer_t *buffer,
|
|||||||
if (show_unicode)
|
if (show_unicode)
|
||||||
{
|
{
|
||||||
serialize_line_no (line_no, gs);
|
serialize_line_no (line_no, gs);
|
||||||
serialize_unicode (buffer, gs);
|
serialize (buffer, font, HB_BUFFER_SERIALIZE_FORMAT_TEXT, HB_BUFFER_SERIALIZE_FLAG_DEFAULT, gs);
|
||||||
g_string_append_c (gs, '\n');
|
g_string_append_c (gs, '\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1003,6 +992,6 @@ format_options_t::serialize_buffer_of_glyphs (hb_buffer_t *buffer,
|
|||||||
GString *gs)
|
GString *gs)
|
||||||
{
|
{
|
||||||
serialize_line_no (line_no, gs);
|
serialize_line_no (line_no, gs);
|
||||||
serialize_glyphs (buffer, font, output_format, format_flags, gs);
|
serialize (buffer, font, output_format, format_flags, gs);
|
||||||
g_string_append_c (gs, '\n');
|
g_string_append_c (gs, '\n');
|
||||||
}
|
}
|
||||||
|
@ -635,9 +635,7 @@ struct format_options_t : option_group_t
|
|||||||
|
|
||||||
void add_options (option_parser_t *parser) override;
|
void add_options (option_parser_t *parser) override;
|
||||||
|
|
||||||
void serialize_unicode (hb_buffer_t *buffer,
|
void serialize (hb_buffer_t *buffer,
|
||||||
GString *gs);
|
|
||||||
void serialize_glyphs (hb_buffer_t *buffer,
|
|
||||||
hb_font_t *font,
|
hb_font_t *font,
|
||||||
hb_buffer_serialize_format_t format,
|
hb_buffer_serialize_format_t format,
|
||||||
hb_buffer_serialize_flags_t flags,
|
hb_buffer_serialize_flags_t flags,
|
||||||
|
Loading…
Reference in New Issue
Block a user