From f0d427993c1b9b40f1bc0b77ed9c0433099f2a5d Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 12 Jan 2012 15:34:30 +0000 Subject: 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. --- pdf/pdf_interpret.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pdf') 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; -- cgit v1.2.3