[Therion] Need metapost wizard: new text label
Tarquin Wilton-Jones
tarquin.wilton-jones at ntlworld.com
Thu Feb 27 09:02:22 CET 2020
Nice one :)
All simple enough to understand (I might put it on the wiki with some
explanatory comments).
> thelabel(txt, pos);
I notice in the main Therion Metapost, it uses
lab:=thelabel@#(txt, pos);
to make sure that it can respect alignment, which your code cannot.
Don't suppose you worked out how to pass the correct alignment value to
it, did you?
> interim bboxmargin:=6.5bp; % padding border->text
Just checking, since I don't know the "interim" keyword very well ...
Doesn't it need to be inside a "begingroup/endgroup" pair, in order to
know when to stop applying the "interim" value to the internal
bboxmargin variable?
As far as I can tell, you are modifying the global value of it, so all
subsequent uses of that internal variable will end up with your padding.
At least until the next "endgroup" happens somewhere above your code in
the stack.
(You are also trampling on any existing variables called lab, q or txt,
but this is normal for Therion's code for some reason. Personally, I
have started wrapping all of my symbol code in a group whenever it uses
variables, and then I save them in order to make a macro equivalent to a
"local" variable. This was needed in one case because I reused some
variable name with a different datatype, and caused Metapost to get upset.)
More information about the Therion
mailing list