mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-24 20:40:10 +01:00
[trace] Trim a few bytes from glyph arrays
Remove some redundant whitespace from the glyph arrays to improve readability and shrink the output file size.
This commit is contained in:
parent
248dd97075
commit
2261590875
1 changed files with 39 additions and 28 deletions
|
|
@ -2206,7 +2206,10 @@ _emit_glyphs (cairo_scaled_font_t *font,
|
|||
x = glyphs->x;
|
||||
y = glyphs->y;
|
||||
if (n < num_glyphs) { /* need full glyph range */
|
||||
fprintf (logfile, "[ %g %g [", x, y);
|
||||
bool first;
|
||||
|
||||
fprintf (logfile, "[%g %g [", x, y);
|
||||
first = true;
|
||||
while (num_glyphs--) {
|
||||
cairo_text_extents_t extents;
|
||||
|
||||
|
|
@ -2215,10 +2218,14 @@ _emit_glyphs (cairo_scaled_font_t *font,
|
|||
{
|
||||
x = glyphs->x;
|
||||
y = glyphs->y;
|
||||
fprintf (logfile, " ] %g %g [", x, y);
|
||||
fprintf (logfile, "] %g %g [", x, y);
|
||||
first = true;
|
||||
}
|
||||
|
||||
fprintf (logfile, " %lu", glyphs->index);
|
||||
if (! first)
|
||||
fprintf (logfile, " ");
|
||||
fprintf (logfile, "%lu", glyphs->index);
|
||||
first = false;
|
||||
|
||||
cairo_scaled_font_glyph_extents (font, glyphs, 1, &extents);
|
||||
x += extents.x_advance;
|
||||
|
|
@ -2226,37 +2233,41 @@ _emit_glyphs (cairo_scaled_font_t *font,
|
|||
|
||||
glyphs++;
|
||||
}
|
||||
fprintf (logfile, " ] ]");
|
||||
fprintf (logfile, "]]");
|
||||
} else {
|
||||
struct _data_stream stream;
|
||||
|
||||
fprintf (logfile, "[ %g %g <~", x, y);
|
||||
_write_base85_data_start (&stream);
|
||||
while (num_glyphs--) {
|
||||
cairo_text_extents_t extents;
|
||||
unsigned char c;
|
||||
if (num_glyphs == 1) {
|
||||
fprintf (logfile, "[%g %g <%x>]", x, y, glyphs->index);
|
||||
} else {
|
||||
fprintf (logfile, "[%g %g <~", x, y);
|
||||
_write_base85_data_start (&stream);
|
||||
while (num_glyphs--) {
|
||||
cairo_text_extents_t extents;
|
||||
unsigned char c;
|
||||
|
||||
if (fabs (glyphs->x - x) > TOLERANCE ||
|
||||
fabs (glyphs->y - y) > TOLERANCE)
|
||||
{
|
||||
x = glyphs->x;
|
||||
y = glyphs->y;
|
||||
_write_base85_data_end (&stream);
|
||||
fprintf (logfile, "~> %g %g <~", x, y);
|
||||
_write_base85_data_start (&stream);
|
||||
if (fabs (glyphs->x - x) > TOLERANCE ||
|
||||
fabs (glyphs->y - y) > TOLERANCE)
|
||||
{
|
||||
x = glyphs->x;
|
||||
y = glyphs->y;
|
||||
_write_base85_data_end (&stream);
|
||||
fprintf (logfile, "~> %g %g <~", x, y);
|
||||
_write_base85_data_start (&stream);
|
||||
}
|
||||
|
||||
c = glyphs->index;
|
||||
_write_base85_data (&stream, &c, 1);
|
||||
|
||||
cairo_scaled_font_glyph_extents (font, glyphs, 1, &extents);
|
||||
x += extents.x_advance;
|
||||
y += extents.y_advance;
|
||||
|
||||
glyphs++;
|
||||
}
|
||||
|
||||
c = glyphs->index;
|
||||
_write_base85_data (&stream, &c, 1);
|
||||
|
||||
cairo_scaled_font_glyph_extents (font, glyphs, 1, &extents);
|
||||
x += extents.x_advance;
|
||||
y += extents.y_advance;
|
||||
|
||||
glyphs++;
|
||||
_write_base85_data_end (&stream);
|
||||
fprintf (logfile, "~>]");
|
||||
}
|
||||
_write_base85_data_end (&stream);
|
||||
fprintf (logfile, "~> ]");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue