[Therion] Defining a user symbol that contains a short text string

Bruce Mutton bruce at tomo.co.nz
Thu May 31 11:20:23 CEST 2018


Thanks to Dave I did a little reading, and have come up with a partial
solution.

 

In the screenshot below, the top line shows that .

point 0 0 u:graffiti -align b (or centre or t)

works correctly.

The second line shows that -scale xs, s, l and xl work OK for the circle and
box, but not the label.

Similar for -orientation (rotation) on the third line.

 

For some reason the centre of the scale and rotation transformation is in
the wrong place for the label.  There is something I am doing wrong with the
label part of the symbol definition.  Any ideas?





 

My code so far looks like.

code metapost

def p_u_graffiti (expr pos,theta,sc,al)=

  U:=(.2u,.5u);

  T:=identity aligned al rotated theta scaled sc shifted pos;

  

  %# pos and al work fine in label below, but theta and sc transformed about
far off point???

  label (btex Gr etex, pos) rotated theta scaled sc aligned al;  % btex and
etex are wrappers around code to be process by tex

  

  thdraw unitsquare scaled u shifted (-0.5u,-0.5u) rotated 45 withpen PenD;
% diagonal box with thin pen

  thdraw fullcircle scaled u withpen PenD;  

enddef;

 

initsymbol("p_u_graffiti")

text en "point u:graffiti" "Historic graffiti"

Bruce

 

From: Bruce Mutton <bruce at tomo.co.nz> 
Sent: Tuesday, 29 May 2018 10:15 PM
To: 'List for Therion users' <therion at speleo.sk>
Subject: Defining a user symbol that contains a short text string

 

Good evening

I'd like to make a user defined symbol that is simply an ascii text string.
A quick and dirty adhoc symbol if you like. If I was going to be fancy, I
would add a box around it like in the example of Dave Clucas that I have
copied and modified below.

 

So rather than defining the shape of the omega symbol using metapost, I'd
like to hard code an ascii character, say "E".

The yellow shaded text below needs to be replaced with some simple metapost,
but I am too lazy to research and trial things.

I notice that other examples tend to use a copy of the p_label definition,
and modify that.  I would rather not head down that route, as then my custom
code would overwrite potential future improvements to Therion's source code.


 

My plan is not really to create an alternative to the entrance symbol, but
rather to create a template quick and dirty creation of single use or
unusual symbols, that can be enumerated in the legend.

 

Does anyone happen to know how to modify the code below to do what I
describe?

 

Thanks

Bruce

 

 
<https://therion.speleo.sk/wiki/_detail/metapost:entrancesymbol.png?id=metap
ost> 

code metapost

def p_u_ent (expr pos,theta,sc,al)=

  U:=(.2u,.5u);

  T:=identity aligned al rotated theta scaled sc shifted pos;

  path p;

  p = (-.3u,-.25u) -- (-.2u,-.25u){dir 135} .. (0u, .25u) .. {dir
225}(.2u,-.25u) -- (.3u,-.25u); % define omega shape

  thdraw p withpen PenA;  % draw it with fat pen

  thdraw unitsquare scaled u shifted (-0.5u,-0.5u) rotated 45 withpen PenD;
% diagonal box with thin pen

enddef;

 

initsymbol("p_u_ent")
  
def p_u_ent_legend =
         p_u_ent( <I forget where to find code for point drawing in the
legend> )
enddef;
endcode
text en "point u:ent" "E for entrance" #text to appear in legend
 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180531/5077baf5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 8640 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180531/5077baf5/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 36421 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180531/5077baf5/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 4840 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180531/5077baf5/attachment-0002.png>


More information about the Therion mailing list