summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-01-12 15:34:30 +0000
committerRobin Watts <robin.watts@artifex.com>2012-01-12 20:15:09 +0000
commitf0d427993c1b9b40f1bc0b77ed9c0433099f2a5d (patch)
treec89144197a2aafec4dac4a05506dad93e098ebdc /pdf
parent269a44d92e2fc15631b86cc0c7135baf2023f312 (diff)
downloadmupdf-f0d427993c1b9b40f1bc0b77ed9c0433099f2a5d.tar.xz
Support proper XPS mitering. (And stroke fixes).
XPS differs from PS/PDF/etc in the way it handles miters; rather than simply converting a miter that's overly long to a bevel, it truncates it at the miter limit. As such it needs to be handled correctly. For clarity, expose new enumerated types for linejoins and linecaps, and use these throughout code. When we upgrade our freetype, we can move to using proper xps mitering in that too. Add new fz_matrix_max_expansion function to return a safer expansion value that works in the case where we scale up in one direction and down in another. In the xps path drawing code, avoid generating unnecessary linetos. Thanks to Zeniko for spotting these and providing implementations.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_interpret.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c
index fe0e1ce8..0976912e 100644
--- a/pdf/pdf_interpret.c
+++ b/pdf/pdf_interpret.c
@@ -818,10 +818,10 @@ pdf_init_gstate(pdf_gstate *gs, fz_matrix ctm)
gs->ctm = ctm;
gs->clip_depth = 0;
- gs->stroke_state.start_cap = 0;
- gs->stroke_state.dash_cap = 0;
- gs->stroke_state.end_cap = 0;
- gs->stroke_state.linejoin = 0;
+ gs->stroke_state.start_cap = FZ_LINECAP_BUTT;
+ gs->stroke_state.dash_cap = FZ_LINECAP_BUTT;
+ gs->stroke_state.end_cap = FZ_LINECAP_BUTT;
+ gs->stroke_state.linejoin = FZ_LINEJOIN_MITER;
gs->stroke_state.linewidth = 1;
gs->stroke_state.miterlimit = 10;
gs->stroke_state.dash_phase = 0;