[metapost] some question about pens

Taco Hoekwater taco at elvenkind.com
Wed Apr 2 11:17:54 CEST 2008

Hi Stephan (and list),

Stephan Hennig wrote:
> Hi,
> the attached code compares six variants of a stroked half circle drawn
> with a circled and squared pen (left and right column) and with linecap
> set to {rounded, squared, butt} (top to bottom).

I have forwarded your test file to Giuseppe Bilotta because of the
hanging metapost 1.003, and until he gets back to me I cannot promiss
100% definivive answers to your questions in the 'current' metapost,
but the following is probably all still true:

> (ii) For all examples in the left-hand column (rounded pen) the end
> points of the strokes seems to have a slightly wrong direction, i.e., it
> is not exactly "up" or "down".  A bug?

This looks like ghostscript bug. The generated PS code seems correct,
and when printing to a true PostScript engine (create actual hardcopy)
or when viewed converted to PDF (use Adobe software), it looks fine.

Perhaps it is worth filing a bug report to the gs people. Xpdf is also
a little bit off, but that is nothing compared to the massive gs

> (iii) For the upper and middle example in the right-hand column (squared
> pen with rounded/squared linecap) I'd expect exactly the same results.
> Or better, what exactly is the effect of linecap on squared pens?  The
> manual is not very verbose about that.

Taking into account the effect of the bug in (iv), this output is
almost what I would expect. (Jacko has proposed that MP should ignore
linecap for polygonal pens, but that would break orthogonality).

> (iv) Why are there diagonal end points in the middle and lower example
> in the right-hand column (squared pen, squared/butt linecap)?

This is already in the tracker:


Item 4, "Pensquare weirdness B".

The general cause of the problem is clear to me, but fixing it is still
a bit above my knowledge level. Basically, MP tracks the 'outside' of
the pen, and at the reversal point of the path, it jumps 180 degrees
(sort of) to the opposite side of the pen, across the diagonal.

Best wishes,

More information about the metapost mailing list