[hb-shape] Adjust postioning output format
1. If there is any offset (x or y), print out both x and y offsets. 2. Always print out the advance in the major direction of the buffer. Ie. even for zero-advance glyphs, print a "+0". This is more intuitive.
This commit is contained in:
parent
6fd5335622
commit
c8149ca85e
|
@ -616,6 +616,7 @@ format_options_t::serialize_glyphs (hb_buffer_t *buffer,
|
|||
unsigned int num_glyphs = hb_buffer_get_length (buffer);
|
||||
hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
|
||||
hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, NULL);
|
||||
hb_direction_t direction = hb_buffer_get_direction (buffer);
|
||||
|
||||
g_string_append_c (gs, '[');
|
||||
for (unsigned int i = 0; i < num_glyphs; i++)
|
||||
|
@ -637,14 +638,14 @@ format_options_t::serialize_glyphs (hb_buffer_t *buffer,
|
|||
}
|
||||
|
||||
if (show_positions && (pos->x_offset || pos->y_offset)) {
|
||||
g_string_append_c (gs, '@');
|
||||
if (pos->x_offset) g_string_append_printf (gs, "%d", pos->x_offset);
|
||||
if (pos->y_offset) g_string_append_printf (gs, ",%d", pos->y_offset);
|
||||
g_string_append_printf (gs, "@%d,%d", pos->x_offset, pos->y_offset);
|
||||
}
|
||||
if (show_positions && (pos->x_advance || pos->y_advance)) {
|
||||
if (show_positions) {
|
||||
g_string_append_c (gs, '+');
|
||||
if (pos->x_advance) g_string_append_printf (gs, "%d", pos->x_advance);
|
||||
if (pos->y_advance) g_string_append_printf (gs, ",%d", pos->y_advance);
|
||||
if (HB_DIRECTION_IS_HORIZONTAL (direction) || pos->x_advance)
|
||||
g_string_append_printf (gs, "%d", pos->x_advance);
|
||||
if (HB_DIRECTION_IS_VERTICAL (direction) || pos->y_advance)
|
||||
g_string_append_printf (gs, ",%d", pos->y_advance);
|
||||
}
|
||||
|
||||
info++;
|
||||
|
|
Loading…
Reference in New Issue