<div dir="ltr"><div style="font-family:verdana,sans-serif" class="gmail_default">Hi Hans,<br><span class="gmail-" id="gmail-result_box" lang="en"><span>I think I</span> <span>was not</span> <span>very clear.</span><br><br><br><br><span>Title first framed :</span> <span>Hans</span><br></span><br><span class="gmail-" id="gmail-result_box" lang="en"><span>Title second framed :</span> <span>Hagen<br><br></span></span></div><div style="font-family:verdana,sans-serif" class="gmail_default"><span class="gmail-" id="gmail-result_box" lang="en"><span>Thanks<br></span></span></div><div style="font-family:verdana,sans-serif" class="gmail_default"><span class="gmail-" id="gmail-result_box" lang="en"><span>Fabrice<br><br>\setupbodyfont[pagella,11pt]<br><br>\setupcolors[state=start]<br><br>\defineframedtext<br>  [MyFrame]<br>  [before={\blank},<br>   after={\blank},<br>   frame=off,<br>   background=MyFrame,<br>   width=\textwidth,<br>   height=fit,<br>   style=italic]<br><br>\setvariables<br>  [text]<br>  [text1=Hans,<br>   text2=Hagen,]<br>   <br><br>\startuseMPgraphic{MyFrame}<br> path b;<br> picture p;<br> p := textext.rt("\white\getvariable{text}{text1}"); <br> p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);<br> b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;<br> fill OverlayBox withcolor lightgray;<br> fill b withcolor darkred;<br> draw bottomboundary OverlayBox withpen pencircle scaled 1pt  withcolor darkred;<br> draw topboundary OverlayBox withpen pencircle scaled 1pt  withcolor darkred;<br> draw p;<br> setbounds currentpicture to boundingbox currentpicture enlarged 2mm;<br>\stopuseMPgraphic<br><br>\defineoverlay<br>  [MyFrame]<br>  [\useMPgraphic{MyFrame}]<br><br>\starttext<br><br><br>\startMyFrame<br>\input knuth<br>\stopMyFrame<br><br>\startMyFrame<br>\input knuth<br>\stopMyFrame<br><br></span></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-26 16:15 GMT+02:00 Hans Hagen <span dir="ltr"><<a href="mailto:pragma@wxs.nl" target="_blank">pragma@wxs.nl</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 7/26/2016 3:12 PM, Fabrice Couvreur wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Hans,<br>
How to pass the "SomeText" parameter?<br>
</blockquote>
<br></span>
with setvariables and getvariable<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
\setupbodyfont[pagella,11pt]<br>
<br>
\setupcolors[state=start]<br>
<br>
\defineframedtext<br>
  [SomeText]<br>
  [before={\blank},<br>
   after={\blank},<br>
   frame=off,<br>
   background=MyFrame,<br>
   width=\textwidth,<br>
   height=fit,<br>
   style=italic]<br>
<br>
\startuseMPgraphic{MyFrame}<br>
 path b;<br>
 picture p;<br>
 p := textext.rt("\white SomeText");<br>
 p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);<br>
 b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;<br>
 fill OverlayBox withcolor lightgray;<br>
 fill b withcolor darkred;<br>
 draw bottomboundary OverlayBox withpen pencircle scaled 1pt  withcolor<br>
darkred;<br>
 draw topboundary OverlayBox withpen pencircle scaled 1pt  withcolor<br>
darkred;<br>
 draw p;<br>
 setbounds currentpicture to boundingbox currentpicture enlarged 2mm;<br>
\stopuseMPgraphic<br>
<br>
\defineoverlay<br>
  [MyFrame]<br>
  [\useMPgraphic{MyFrame}]<br>
<br>
\starttext<br>
<br>
<br>
\startSomeText{SomeText1}<br>
\input knuth<br>
\stopSomeText<br>
<br>
\startSomeText{SomeText2}<br>
\input knuth<br>
\stopSomeText<br>
<br>
\stoptext<br>
<br>
Thanks<br>
Fabrice<br>
<br>
2016-07-26 12:34 GMT+02:00 Hans Hagen <<a href="mailto:pragma@wxs.nl" target="_blank">pragma@wxs.nl</a><br></div></div>
<mailto:<a href="mailto:pragma@wxs.nl" target="_blank">pragma@wxs.nl</a>>>:<div><div class="h5"><br>
<br>
    On 7/26/2016 10:18 AM, Fabrice Couvreur wrote:<br>
<br>
        Hello,<br>
        Hans and Wolfgang really helped me to create new environments<br>
        with Metafun.<br>
        I think Hans continuous development Metafun. So my question is<br>
        simple:<br>
        can we optimize this code?<br>
<br>
<br>
    in what sense ...<br>
<br>
    speed? not much to gain<br>
<br>
    correctness? mayhe use "lightgray" and "darkred" for consistency<br>
<br>
    typography? sure, but more a discussion topic at the ctx meeting<br>
<br>
        Thanks,<br>
        Fabrice<br>
<br>
        \setupbodyfont[pagella,11pt]<br>
<br>
        \setupcolors[state=start]<br>
<br>
        \defineframedtext<br>
          [MyDefinition]<br>
          [before={\blank},<br>
           after={\blank},<br>
           frame=off,<br>
           background=MyFrame,<br>
           width=\textwidth,<br>
           height=fit,<br>
           style=italic]<br>
<br>
        \definelabel<br>
          [Définition]<br>
          [headstyle=\bf\smallcaps]<br>
<br>
        \startuseMPgraphic{MyFrame}<br>
         path b;<br>
         picture p;<br>
         p := textext.rt("\white\Définition");<br>
         p := p shifted (2BodyFontSize,OverlayHeight-ypart center<br>
        p+.25ExHeight);<br>
         b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth;<br>
         fill OverlayBox withcolor \MPcolor{lightgray};<br>
         fill b withcolor darkred;<br>
         draw bottomboundary OverlayBox withpen pencircle scaled 1pt<br>
        withcolor<br>
        darkred;<br>
         draw topboundary OverlayBox withpen pencircle scaled 1pt  withcolor<br>
        darkred;<br>
         draw p;<br>
         setbounds currentpicture to boundingbox currentpicture enlarged<br>
        2mm;<br>
        \stopuseMPgraphic<br>
<br>
        \defineoverlay<br>
          [MyFrame]<br>
          [\useMPgraphic{MyFrame}]<br>
<br>
        \starttext<br>
<br>
        \showframe<br>
<br>
        \startMyDefinition<br>
        \input knuth<br>
        \stopMyDefinition<br>
<br>
        \stoptext<br>
<br>
<br>
<br>
        ___________________________________________________________________________________<br>
        If your question is of interest to others as well, please add an<br>
        entry to the Wiki!<br>
<br></div></div>
        maillist : <a href="mailto:ntg-context@ntg.nl" target="_blank">ntg-context@ntg.nl</a> <mailto:<a href="mailto:ntg-context@ntg.nl" target="_blank">ntg-context@ntg.nl</a>> /<span class=""><br>
        <a href="http://www.ntg.nl/mailman/listinfo/ntg-context" rel="noreferrer" target="_blank">http://www.ntg.nl/mailman/listinfo/ntg-context</a><br>
        webpage  : <a href="http://www.pragma-ade.nl" rel="noreferrer" target="_blank">http://www.pragma-ade.nl</a> / <a href="http://tex.aanhet.net" rel="noreferrer" target="_blank">http://tex.aanhet.net</a><br>
        archive  : <a href="http://foundry.supelec.fr/projects/contextrev/" rel="noreferrer" target="_blank">http://foundry.supelec.fr/projects/contextrev/</a><br>
        wiki     : <a href="http://contextgarden.net" rel="noreferrer" target="_blank">http://contextgarden.net</a><br>
        ___________________________________________________________________________________<br>
<br>
<br>
<br>
    --<br>
<br>
    -----------------------------------------------------------------<br>
                                              Hans Hagen | PRAGMA ADE<br>
                  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands<br>
           tel: 038 477 53 69 | <a href="http://www.pragma-ade.nl" rel="noreferrer" target="_blank">www.pragma-ade.nl</a><br></span>
    <<a href="http://www.pragma-ade.nl" rel="noreferrer" target="_blank">http://www.pragma-ade.nl</a>> | <a href="http://www.pragma-pod.nl" rel="noreferrer" target="_blank">www.pragma-pod.nl</a><br>
    <<a href="http://www.pragma-pod.nl" rel="noreferrer" target="_blank">http://www.pragma-pod.nl</a>><span class=""><br>
    -----------------------------------------------------------------<br>
    ___________________________________________________________________________________<br>
    If your question is of interest to others as well, please add an<br>
    entry to the Wiki!<br>
<br></span>
    maillist : <a href="mailto:ntg-context@ntg.nl" target="_blank">ntg-context@ntg.nl</a> <mailto:<a href="mailto:ntg-context@ntg.nl" target="_blank">ntg-context@ntg.nl</a>> /<div><div class="h5"><br>
    <a href="http://www.ntg.nl/mailman/listinfo/ntg-context" rel="noreferrer" target="_blank">http://www.ntg.nl/mailman/listinfo/ntg-context</a><br>
    webpage  : <a href="http://www.pragma-ade.nl" rel="noreferrer" target="_blank">http://www.pragma-ade.nl</a> / <a href="http://tex.aanhet.net" rel="noreferrer" target="_blank">http://tex.aanhet.net</a><br>
    archive  : <a href="http://foundry.supelec.fr/projects/contextrev/" rel="noreferrer" target="_blank">http://foundry.supelec.fr/projects/contextrev/</a><br>
    wiki     : <a href="http://contextgarden.net" rel="noreferrer" target="_blank">http://contextgarden.net</a><br>
    ___________________________________________________________________________________<br>
<br>
<br>
<br>
<br>
___________________________________________________________________________________<br>
If your question is of interest to others as well, please add an entry to the Wiki!<br>
<br>
maillist : <a href="mailto:ntg-context@ntg.nl" target="_blank">ntg-context@ntg.nl</a> / <a href="http://www.ntg.nl/mailman/listinfo/ntg-context" rel="noreferrer" target="_blank">http://www.ntg.nl/mailman/listinfo/ntg-context</a><br>
webpage  : <a href="http://www.pragma-ade.nl" rel="noreferrer" target="_blank">http://www.pragma-ade.nl</a> / <a href="http://tex.aanhet.net" rel="noreferrer" target="_blank">http://tex.aanhet.net</a><br>
archive  : <a href="http://foundry.supelec.fr/projects/contextrev/" rel="noreferrer" target="_blank">http://foundry.supelec.fr/projects/contextrev/</a><br>
wiki     : <a href="http://contextgarden.net" rel="noreferrer" target="_blank">http://contextgarden.net</a><br>
___________________________________________________________________________________<br>
<br>
</div></div></blockquote><div class="HOEnZb"><div class="h5">
<br>
<br>
-- <br>
<br>
-----------------------------------------------------------------<br>
                                          Hans Hagen | PRAGMA ADE<br>
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands<br>
       tel: 038 477 53 69 | <a href="http://www.pragma-ade.nl" rel="noreferrer" target="_blank">www.pragma-ade.nl</a> | <a href="http://www.pragma-pod.nl" rel="noreferrer" target="_blank">www.pragma-pod.nl</a><br>
-----------------------------------------------------------------<br>
___________________________________________________________________________________<br>
If your question is of interest to others as well, please add an entry to the Wiki!<br>
<br>
maillist : <a href="mailto:ntg-context@ntg.nl" target="_blank">ntg-context@ntg.nl</a> / <a href="http://www.ntg.nl/mailman/listinfo/ntg-context" rel="noreferrer" target="_blank">http://www.ntg.nl/mailman/listinfo/ntg-context</a><br>
webpage  : <a href="http://www.pragma-ade.nl" rel="noreferrer" target="_blank">http://www.pragma-ade.nl</a> / <a href="http://tex.aanhet.net" rel="noreferrer" target="_blank">http://tex.aanhet.net</a><br>
archive  : <a href="http://foundry.supelec.fr/projects/contextrev/" rel="noreferrer" target="_blank">http://foundry.supelec.fr/projects/contextrev/</a><br>
wiki     : <a href="http://contextgarden.net" rel="noreferrer" target="_blank">http://contextgarden.net</a><br>
___________________________________________________________________________________</div></div></blockquote></div><br></div>