summaryrefslogtreecommitdiff
path: root/source/xps/xps-path.c
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2014-07-18 22:15:12 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-08-19 17:09:11 +0200
commita27c538cc3262377166251c73c9b09ff7f67192b (patch)
tree6fd8c99dd2d244f5a751c6ae144f533a4555c816 /source/xps/xps-path.c
parentdac6ec31abd2a4e19f1bee26b95bcbb508522bf1 (diff)
downloadmupdf-a27c538cc3262377166251c73c9b09ff7f67192b.tar.xz
don't render non-empty dashing with zero-length phase
Adobe Reader and Microsoft XPS viewer differ in their handling of non-empty dashed strokes where the phase is 0: Adobe Reader considers these to be faulty and omits them while Microsoft XPS Viewer renders them the same as an empty dash (i.e. solid). This patch makes Fitz no longer render such strokes and ensures that MuXPS never emits them so that the desired behavior results (this is the easier implementation since XPS rendering code renders stroked paths in a single location whereas PDF rendering does it all over the place). See https://code.google.com/p/sumatrapdf/issues/detail?id=2339 for a testcase.
Diffstat (limited to 'source/xps/xps-path.c')
-rw-r--r--source/xps/xps-path.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/xps/xps-path.c b/source/xps/xps-path.c
index 84ee53f0..7b71575f 100644
--- a/source/xps/xps-path.c
+++ b/source/xps/xps-path.c
@@ -957,6 +957,16 @@ xps_parse_path(xps_document *doc, const fz_matrix *ctm, char *base_uri, xps_reso
while (*s && *s != ' ')
s++;
}
+ if (dash_len > 0)
+ {
+ /* fz_stroke_path doesn't draw non-empty paths with phase length zero */
+ float phase_len = 0;
+ int i;
+ for (i = 0; i < dash_len; i++)
+ phase_len += stroke->dash_list[i];
+ if (phase_len == 0)
+ dash_len = 0;
+ }
stroke->dash_len = dash_len;
}
}