[Therion] Custom label style for a custom point
Bruce Mutton
bruce at tomo.co.nz
Tue Nov 26 20:36:57 CET 2019
Tarquin
No answer to your question, but to check that have seen these.
I looked at a similar thing a while ago. You have probably found this thread https://www.mail-archive.com/therion@speleo.sk/msg07234.html
Search for 'boxed label'. Sorry I have no time to figure out where I got to, I was going to write it up but did not get to it.
Also the wiki has some discussion of alignment and rotation of symbols https://therion.speleo.sk/wiki/metapost#symbol_sizing_and_positioning (down the page just a little).
My theory is that most Therion point symbols are defined so that alignments plot incorrectly if they also have a rotation applied.
ie T:=identity aligned A rotated R scaled S shifted P; aligns your symbol, then rotates your alignment!
and T:=identity rotated R aligned A scaled S shifted P; rotates your symbol, then applies the (correct) alignment.
Yes, both labels and arrows seem to be quite complicated, and interrelated with other features.
Bruce
-----Original Message-----
From: Therion <therion-bounces at speleo.sk> On Behalf Of Tarquin Wilton-Jones via Therion
Sent: Wednesday, 27 November 2019 07:14
To: therion at speleo.sk
Cc: Tarquin Wilton-Jones <tarquin.wilton-jones at ntlworld.com>
Subject: [Therion] ***UNCHECKED*** Custom label style for a custom point
Hi all,
Next puzzle...
I am trying to define a custom point type:
p_u_ropelength
This will allow me to specify rope lengths on a rigging topo. What I want is exactly what Therion does for a p_passageheight - a circle around a label, which has been the norm in UK topos for decades (though they are also sometimes written as a basic label with no circle). This should be easy, but Therion seems to hide the p_passageheight code, or at least put it somewhere I can't find it in order to work out how it works.
I am guessing it calls p_label with txt set to the text, pos set to the point position, and mode set to 5 (p_label_mode_passageheight). But somehow it is also specifying the scale and I can't see how it does that since it ignores my attempts, and it also seems to work with Align there, while with my own code, it applies align with the most tiny fractional changes, instead of moving the label as far as I would have expected.
Obviously I am doing something wrong.
def p_u_ropelength (expr P,R,S,A)=
T:=identity aligned A rotated R scaled S shifted P;
if known ATTR_text:
p_label(ATTR_text,P,R,5);
fi;
enddef;
Does anyone have a nice working example where A and S are correctly respected, so that I can see how to apply them when calling p_label? Do I have to manually parse A and call the correct p_label.lft(...) to get the right alignment, or is there a way to ask it to do that?
Incidentally, you can set orientation on a p_label, but not on a p_passageheight - the orientation is ignored. Seems like a bug...
_______________________________________________
Therion mailing list
Therion at speleo.sk
https://mailman.speleo.sk/listinfo/therion
More information about the Therion
mailing list