Hello,
How to make the width of framedtext automatically adapts to its contents.
Fabrice
\definefloat
[recipe]
[figure]
\setupfloat
[recipe]
[default={right,none}]
\definecolor[MyColorA][r=0.8784, g=0.8784, b=0.8784]
\definecolor[MyColorB][c=0.00,m=0.27,y=1.00,k=0.00]
\defineframedtext
[MyFrame]
[before={\blank},
after={\blank},
frame=off,
background=MyFrame,
width=6cm,
height=fit]
\startuseMPgraphic{MyFrame}
path b;
picture p;
p := textext.rt("\tfx\white\framedtextparameter{Title}");
p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight);
b := boundingbox p enlarged .3EmWidth ;
fill OverlayBox withcolor \MPcolor{MyColorA};
fill b withcolor \MPcolor{MyColorB} ;
draw p ;
setbounds currentpicture to boundingbox currentpicture enlarged 2mm ;
\stopuseMPgraphic
\defineoverlay
[MyFrame]
[\useMPgraphic{MyFrame}]
\starttext
\placerecipe{}{
\startMyFrame[Title=Info]
L'histogramme est constitué de rectangles dont les bases correspondent aux classes et dont les aires sont proportionnelles aux effectifs ou fréquences des classes.
\stopMyFrame}
\input Knuth
\stoptext