[Therion] boxed label

Marco Corvi marco.corvi at gmail.com
Mon Sep 24 11:16:00 CEST 2018


hi bruce,

this is a boxed u:label
basically it gets the string as picture,
its bounding box corners, and define the x and y to draw the box,
then draw the string picture

point 10 20 u:label -attr val 20

def p_u_label ( expr p,r,s,t ) =
  picture pic;
  pic := thelabel( ATTR_val, (0,0)) scaled s;
 pair q[]; numeric n[], m[], v;
 path bb;
 v := defaultscale;
 qO = ulcorner pic;
 q1 = lrcorner pic;
 nO := ypart q0 + 2.5 * v;
 n1 := ypart q1 - 1.5*v;
 m0 := xpart q0 - v;
 m1 := xpart q1 + 1.5*v;
bb := (m0,n0) -- (m0,n1) -- (m1,n1) -- (m1,n0) -- cycle;
draw bb  rotated r shifted p;
draw pic rotated r shifted p;
enddef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20180924/0836ca9b/attachment.htm>


More information about the Therion mailing list