[Therion] Two minor bugs in metapost defs

Xavier Pennec Xavier.Pennec at sophia.inria.fr
Sat Dec 6 09:58:24 CET 2008


I found a few bugs in the metapost definitions that could be usefully 
corrected in the next versions:
In the subtype clay of wall, "Pickup PenA" is missing before drawing the 
wall line at the end, and the effect is that the line is drawn with PenC 
(thin).

def l_wall_clay_SKBB (expr P) =
  T:=identity;
  cas := 0;
  dlzka := arclength P;
  mojkrok:=adjust_step(dlzka, .5u);
  pickup PenC;
  q := (-0.15u,0){up}..{down}origin..{up}(0.15u,0);
  forever:
    t := arctime (cas + mojkrok/2) of P;
    thdraw q shifted (point t of P + .25u * unitvector(thdir(P,t) 
rotated -90));
    cas := cas + mojkrok;
    exitif cas > dlzka - (2*mojkrok/3); % for rounding errors
  endfor;
 >>>>> Pickup PenA
  thdraw P;
enddef;

I also noticed that sometimes the margin around a text is changed by the 
presence (or absence) of a point label.
After many trials, I finally identified that it comes from the value of 
bboxmargin which is reset in process_label.
It seems to me that an interim is missing before resetting bboxmargin in 
order to keep this change localized.

def process_label (expr cent, rot) =
  begingroup
<<<<   bboxmargin:=0.8bp;   
 >>>>   interim bboxmargin:=2bp;
    q:=((bbox lab) smoothed 2) rotatedaround (cent, rot);
    draw lab rotatedaround (cent, rot);
    write_circ_bbox(q);  % without corners smoothing it was enough to use
                         % write_bbox(q);
  endgroup;
enddef;


Xavier


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Xavier_Pennec.vcf
Type: text/x-vcard
Size: 166 bytes
Desc: not available
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20081206/d9b7a67d/attachment.vcf>


More information about the Therion mailing list