From c0e1dfdab1a13def046e94d771f8a821ba2a10d9 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Mon, 14 Nov 2016 13:52:27 +0000 Subject: Workaround 0 line-width strokes in svg output. A line width of 0 has special meaning in PDF files. SVGs don't understand it, so modify our SVG output device to send all line widths smaller than 1 as being 1. --- source/fitz/svg-device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index 7397d059..8a83c97b 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -167,8 +167,11 @@ svg_dev_stroke_state(fz_context *ctx, svg_device *sdev, const fz_stroke_state *s exp = fz_matrix_expansion(ctm); if (exp == 0) exp = 1; + exp = stroke_state->linewidth/exp; + if (exp < 1) + exp = 1; - fz_printf(ctx, out, " stroke-width=\"%g\"", stroke_state->linewidth/exp); + fz_printf(ctx, out, " stroke-width=\"%g\"", exp); fz_printf(ctx, out, " stroke-linecap=\"%s\"", (stroke_state->start_cap == FZ_LINECAP_SQUARE ? "square" : (stroke_state->start_cap == FZ_LINECAP_ROUND ? "round" : "butt"))); -- cgit v1.2.3