% interface=english, output=pdf

\startMPinclusions
  verbatimtex
    \definefontsynonym [Serif]            [cmr10]
    \definefontsynonym [SerifBold]        [cmbx10]
    \definefontsynonym [SerifItalic]      [cmti10]
    \definefontsynonym [SerifSlanted]     [cmti10]
    \definefontsynonym [SerifBoldItalic]  [cmbxti10]
    \definefontsynonym [SerifBoldSlanted] [cmbxti10]
    \definefontsynonym [SerifCaps]        [cmr10]
    \definefontsynonym [SansItalic]       [txsssl8z]
   \definebodyfont [14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt]
        [rm] [default]
   \setupbodyfont[10pt]
   \setupinterlinespace[line=13pt]
 etex
\stopMPinclusions

\startuseMPgraphic{FunnyFrame} 
  picture pic; 
  numeric w, h, o; 
  pic:=textext.rt(\MPstring{FunnyFrame}); 
  w:=\overlaywidth;
  h:=\overlayheight;
  o:=BodyFontSize; 
  pic:=pic shifted (1.5o,h-ypart center pic); 
  fill boundingbox pic withcolor white;
  draw pic; 
  drawoptions (withpen pencircle scaled 1pt);% withcolor .625red); 
  draw (1.5o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner pic,h);
  draw boundingbox pic; 
  setbounds currentpicture to unitsquare xyscaled(w,h); 
\stopuseMPgraphic

\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}] 
\defineframedtext[FunnyText]
  [width=broad,height=fit,before={\blank[line]},after={\blank[line]},
   frame=off,background=FunnyFrame]
\def\FrameTitle#1{%
  \setMPtext{FunnyFrame}{\hbox spread 1em{\hss\ss\bfx\strut#1\hss}}}
\setMPtext{FunnyFrame}{}

\def\startexample{%
  \FrameTitle{Example}
  \startFunnyText
}
\def\stopexample{%
  \stopFunnyText
}



\starttext
\input tufte
\input tufte
\input tufte

\startexample
\input tufte
\stopexample

\input tufte
\input tufte
\input tufte
\stoptext
