vardef mycircle = save c ; picture c ; c := nullpicture ; addto c contour fullcircle scaled 2mm ; c enddef ; def test (expr m) expr p = path _p_ ; _p_ := p ; scantokens m enddef ; def only_clip text t = begingroup save c ; picture c ; c := mycircle ; clip c to bbox (c scaled 0.5) ; addto currentpicture also c t ; addto currentpicture doublepath _p_ t ; endgroup enddef ; def no_clip text t = begingroup save c; picture c ; c := mycircle ; addto currentpicture also c t ; addto currentpicture doublepath _p_ t ; endgroup enddef ; def draw_clip text t = begingroup save c ; picture c ; c := mycircle ; draw bbox (c scaled 0.5) ; clip c to bbox (c scaled 0.5) ; addto currentpicture also c t ; addto currentpicture doublepath _p_ t ; endgroup enddef ; beginfig(1) for macro = "only_clip", "no_clip", "draw_clip": test( macro ) (0,0) -- (1cm,0) dashed evenly ; % NOTE: % Drawing the label here makes the weird second dashed line go away. % label.rt(macro, (-5cm,0) ); currentpicture := currentpicture shifted (-2cm,0) ; test( macro ) (0,0) -- (1cm,0) ; label.rt(macro, (-5cm,0) ); currentpicture := currentpicture shifted(2cm,0.5cm ); endfor endfig ; end