[Therion] scaling line ornamentation - metapost
Bruce Mutton
bruce at tomo.co.nz
Fri Mar 30 09:50:02 CEST 2018
Hi
I'm wondering if there is a way to scale the size of line ornamentation with
the -scale option?
I am thinking about arrows (and map-connections) as in a previous post.
I notice that I can apply -scale to a line wall
Eg
line wall -scale xs
subtype debris
<list of coordinates>
endline
and the line will plot, but at always at normal scale. I can see why that
might be, as there seems to be no way to pass the scale value into the
metapost definition of the wall (or arrow) line object.
However if I put in a layout.
min-symbol-scale m
then the wall (or arrow) that has a scale of s or xs will not plot (as I
think is expected). So there is some crude on/off control, but I have not
found where it is done.
So I am wondering, is there some way that we can have more refined control
of the scale of line ornamentation (wall debris, blocks, arrow heads)?
I notice line arrow takes the special argument -head [both | none | begin].
Somewhere between the th2 file and the metapost arrow definition, the
argument -head gets changed to the variable Q that is parsed to the metapost
code, that controls which ends of the arrow line get arrow heads. I have
copied the code below. Whereabouts is the code that tells Therion that
-head is parsed to the metapost definition as Q?
Bruce
In th2 file.
line arrow -head both
<coordinates>
endline
In thline.mp or in a layout file.
code metapost
% Q = 0 -- no arrows
% 1 -- end
% 2 -- begin
% 3 -- both
def l_arrow (expr P, Q) =
T:=identity;
pickup PenB;
thdraw P;
p := (-.1u,-.5u)--(0,0)--(.1u,-.5u)--cycle;
% 0.25 changed to .5 and close end to get nicer arrowhead
if odd Q:
thfilldraw p rotated (angle(thdir(P,0))+90)
shifted (point 0 of P);
fi;
if Q>1:
thfilldraw p rotated (angle(thdir(P,length P))-90)
shifted (point infinity of P);
fi;
enddef;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180330/0c2f8450/attachment.htm>
More information about the Therion
mailing list