[metapost] internal pen question
Hans Hagen
j.hagen at xs4all.nl
Thu Dec 10 01:32:37 CET 2020
On 12/10/2020 12:38 AM, Walt Burkhard wrote:
> Hello,
>
> What size variable is set when using the statement
> pickup pencircle scaled 1 ;
> I would like to be able to examine the current "size" of the pen
> without actually writing anything. I am only intending to use this
> variable when
> I know the pen is a circle too.
actually fullcircle is defined as being the pencircle (which is an
approximation of a circle)
you scale to 1 so the dimensions are 1 bp
\startMPpage
pickup pencircle scaled 1 ;
message(llcorner fullcircle); % negative values .5
message(llcorner image (draw origin));
draw makepath currentpen ;
draw fullcircle withcolor "red" ;
currentpicture := currentpicture scaled 10cm;
% etc
\stopMPpage
its gets a bit less clear when you use a real penshape (different x/y
scale and rotation or so); mp then has to determine the boundingbox and
there was a time when that was somewhat bugged because for some pens it
can be tricky
because mp targets postscript circular pens are using native ps drawing
while special pens result in two (transformed) paths where again some
inaccuracy can creep into a boundingbox calculation (the already decades
old mp to pdf converter in (pdf)tex has to do some magic to keep
accuracy ok)
when you use special pens you sometimes have to increase the boundingbox
a little to prevent clipping (for the circular pen that is centered in
the origin half the pen traverses outside a path); nowadays we have a so
called high resolution boundingbox but that was not in the original
postscript (high res bboxes were actually comments picked up by drivers
that were aware of them) so in those times one had definitely to make
sure that rounding went the right direction
(there is some pen infrastructure in plain mp but that comes from mf and
relates to fontdrawing and is probably never really used, at least i
never did)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
More information about the metapost
mailing list.