On Fri, Oct 31, 2014 at 12:22:37PM +0100, Hans Hagen wrote:
> On 10/31/2014 10:15 AM, Tobias Columbus wrote:
> 
> >>>>def a_impl text t =
> >>>>   begingroup
> >>>>     save c ; picture c ; c := mycircle ;
> >>>>     clip c to bbox c scaled 0.5 ;
> 
> try this to see what happens:
> 
> % clip c to bbox c scaled 0.5 ;
> draw bbox c scaled 0.5 ;
> 
> and then this to solve it:
> 
> clip c to bbox (c scaled 0.5) ;

I tried your suggestions and attached both the example and output. Drawing and
clipping solves the problem indeed. But using only the modified clip either does
not solve the problem, or I am just too stupid to implement your solution.

Note also that in the modified example the context output coincides with the
mptopdf output if one draws the label before calling "test" the second time. (I
marked the position in the metapost file.)

Sorry for probably getting on your nerves ... 

> 
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
>                                              | www.pragma-pod.nl
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

-- 

Attachment: mwe-context.pdf
Description: Adobe PDF document

Attachment: mwe-mptopdf.pdf
Description: Adobe PDF document

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to