diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-02-17 13:14:57 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-02-20 12:47:15 +0100 |
commit | 029d5db2c4928a0bb4c357fc4db53aa614eac7f9 (patch) | |
tree | b197eafe48e3a04aad883fffb8485cecc4fd91a3 /source | |
parent | f19daf828bd69fd0d78657208b56b44fa707d065 (diff) | |
download | mupdf-029d5db2c4928a0bb4c357fc4db53aa614eac7f9.tar.xz |
Fix svg text output when text span is all whitespace or empty.
We were emitting unbalanced quotes for the x and y attributes.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/svg-device.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index 8a69d223..09b3d82d 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -310,7 +310,7 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const break; } - fz_printf(ctx, out, " x="); + fz_printf(ctx, out, " x=\""); was_wspace = 0; for (i=start; i < span->len; i++) { @@ -323,9 +323,11 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const p.x = it->x; p.y = it->y; fz_transform_point(&p, &inverse); - fz_printf(ctx, out, "%c%g", i == start ? '\"' : ' ', p.x); + if (i > start) + fz_putc(ctx, out, ' '); + fz_printf(ctx, out, "%g", p.x); } - fz_printf(ctx, out, "\" y="); + fz_printf(ctx, out, "\" y=\""); was_wspace = 0; for (i=start; i < span->len; i++) { @@ -338,7 +340,9 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const p.x = it->x; p.y = it->y; fz_transform_point(&p, &inverse); - fz_printf(ctx, out, "%c%g", i == start ? '\"' : ' ', p.y); + if (i > start) + fz_putc(ctx, out, ' '); + fz_printf(ctx, out, "%g", p.y); } fz_printf(ctx, out, "\">\n"); was_wspace = 0; |