summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-02-17 13:14:57 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-02-20 12:47:15 +0100
commit029d5db2c4928a0bb4c357fc4db53aa614eac7f9 (patch)
treeb197eafe48e3a04aad883fffb8485cecc4fd91a3 /source
parentf19daf828bd69fd0d78657208b56b44fa707d065 (diff)
downloadmupdf-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.c12
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;