[Therion] Need metapost wizard: new text label

Tarquin Wilton-Jones tarquin.wilton-jones at ntlworld.com
Sun Mar 1 22:23:37 CET 2020


>> 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?

I have worked it out, see my thread "Metapost variable macro suffixes".
I will add it to my existing function which takes the point alignment
parameter and turns it into the right suffix in the "thelabel" call or
p_label call, whichever one ends up getting used.

Your code also didn't apply rotation to the ornamentation. You need
something like this:
draw ((bbox lab) smoothed 4) rotatedaround (pos,rotation);

Note that this applies the rotation around the point position, so
alignment and rotation at the same time is weird. This is the same with
regular labels though - Therion bug that Bruce is fond of :) - so at
least this is consistent with Therion itself.

Your code hardcoded rotation to a very specific 0.001 degrees, which was
weird. I assume you had intended to use 0 or a variable (my code uses
the rotation parameter of the point symbol).

>> 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.

This was correct. You needed to use begingroup+endgroup or use a vardef
instead of a def (with vardef, it automatically applies a
begingroup+endgroup). Therion's Metapost uses both of these approaches
to avoid the problem.



More information about the Therion mailing list