Move delimiter addition into hb-buffer-serialize
This commit is contained in:
parent
36ede56962
commit
c0716bb5dc
@ -125,6 +125,8 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
|
||||
|
||||
if (i)
|
||||
*p++ = ',';
|
||||
else
|
||||
*p++ = '[';
|
||||
|
||||
*p++ = '{';
|
||||
|
||||
@ -174,6 +176,8 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
|
||||
}
|
||||
|
||||
*p++ = '}';
|
||||
if (i == end-1)
|
||||
*p++ = ']';
|
||||
|
||||
unsigned int l = p - b;
|
||||
if (buf_size > l)
|
||||
@ -213,9 +217,14 @@ _hb_buffer_serialize_unicode_json (hb_buffer_t *buffer,
|
||||
char *p = b;
|
||||
if (i)
|
||||
*p++ = ',';
|
||||
else
|
||||
*p++ = '[';
|
||||
|
||||
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "%u", info[i].codepoint));
|
||||
|
||||
if (i == end-1)
|
||||
*p++ = ']';
|
||||
|
||||
unsigned int l = p - b;
|
||||
if (buf_size > l)
|
||||
{
|
||||
@ -257,6 +266,8 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
|
||||
|
||||
if (i)
|
||||
*p++ = '|';
|
||||
else
|
||||
*p++ = '[';
|
||||
|
||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES))
|
||||
{
|
||||
@ -297,6 +308,10 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
|
||||
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "<%d,%d,%d,%d>", extents.x_bearing, extents.y_bearing, extents.width, extents.height));
|
||||
}
|
||||
|
||||
if (i == end-1) {
|
||||
*p++ = ']';
|
||||
}
|
||||
|
||||
unsigned int l = p - b;
|
||||
if (buf_size > l)
|
||||
{
|
||||
@ -336,8 +351,14 @@ _hb_buffer_serialize_unicode_text (hb_buffer_t *buffer,
|
||||
|
||||
if (i)
|
||||
*p++ = '|';
|
||||
else
|
||||
*p++ = '<';
|
||||
|
||||
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "U+%04X", info[i].codepoint));
|
||||
|
||||
if (i == end-1)
|
||||
*p++ = '>';
|
||||
|
||||
unsigned int l = p - b;
|
||||
if (buf_size > l)
|
||||
{
|
||||
@ -487,7 +508,7 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
|
||||
* The serialized codepoints will look something like:
|
||||
*
|
||||
* ```
|
||||
* U+0651|U+0628
|
||||
* <U+0651|U+0628>
|
||||
* ```
|
||||
* - Glyphs are separated with `|`
|
||||
* - Unicode codepoints are expressed as zero-padded four (or more)
|
||||
|
@ -916,10 +916,6 @@ format_options_t::serialize (hb_buffer_t *buffer,
|
||||
hb_buffer_serialize_flags_t flags,
|
||||
GString *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 start = 0;
|
||||
|
||||
@ -934,10 +930,6 @@ format_options_t::serialize (hb_buffer_t *buffer,
|
||||
break;
|
||||
g_string_append (gs, buf);
|
||||
}
|
||||
if (hb_buffer_get_content_type(buffer) == HB_BUFFER_CONTENT_TYPE_UNICODE)
|
||||
g_string_append_c (gs, '>');
|
||||
else
|
||||
g_string_append_c (gs, ']');
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user