[Therion] scaling a line thickness in Metapost
Tarquin Wilton-Jones
tarquin.wilton-jones at ntlworld.com
Sun Nov 24 09:47:58 CET 2019
> Apparently you can use "save"
> within a begingroup section to make variables local, so I am playing
> with that right now to see if I can work out how to use it.
Easy enough:
def l_u_foo
begingroup; %allow local variables to work
save scale, bar, baz; %declare local variables
string scale;
if known ATTR_scale:
scale:=ATTR_scale;
else:
scale:="m";
fi;
...
endgroup;
enddef;
I tried using vardef instead, but couldn't get it to work.
"save" actually temporarily saves the existing (global) value of a
variable, then restores is after the endgroup. But it has the effect of
creating a local variable.
More information about the Therion
mailing list