[NTG-context] Center text in an image (Metafun)

Fabrice Couvreur fabrice1.couvreur at gmail.com
Sun Sep 13 09:18:16 CEST 2015


Hi,
My image contains the text "Method 1" which is not centered, how can he be?
Thank you.
Fabrice

\setupcolors[state=start]


\definecolor[MyColorA][c=0.00, m=0.10, y=0.20, k=0.00]

\definecolor[MyColorB][c=0.00, m=0.62, y=1.00, k=0.00]

\definecolor[MyColorC][c=0.3, m=0.00, y=0.00, k=0.05]

\definecolor[MyColorD][c=0.6, m=0.00, y=0.00, k=0.10]

\definemixedcolumns
  [myColumn]
  [n=2,
   separator=rule,
   rulecolor=MyColorC,
   rulethickness=1pt,
   maxwidth=\availablehsize,
   balance=yes]

\setupalign[verytolerant,stretch,hanging]


\defineoverlay
  [Funny]
  [\useMPgraphic{Funny}]

\definelabel
  [MÉTHODE]
  [headstyle=\bf\smallcaps]


\startuseMPgraphic{Funny}
    interim linejoin := mitered ;
    interim linecap := squared ;
    path b ;
    picture p ;
    picture pic ;
    pic := textext.rt("\darkgreen Calculer les coordonnées d'un milieu") ;
    pic := pic shifted (OverlayWidth/4,OverlayHeight-ypart center
pic+.25ExHeight) ;
    p := textext.rt("\white\MÉTHODE") ;
    p := p shifted (0,OverlayHeight) ;
    b := boundingbox p shifted(1.5mm,0);
    drawoptions (withpen pencircle scaled 3mm withcolor \MPcolor{MyColorC})
;
    draw leftboundary OverlayBox shifted(1.5mm,0) ;
    fill b withcolor \MPcolor{MyColorD} ;
    draw p ;
    draw pic ;
    setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineframedtext
  [Methode]
  [before={\blank[line,halfline]},
   after={\blank},
   frame=off,
   background=Funny,
   width=\textwidth,
   height=fit,
   ]

\starttext


\startMethode

\startmyColumn

\input ward

\column

\input knuth

\stopmyColumn


\stopMethode
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20150913/fe03f400/attachment-0001.html>


More information about the ntg-context mailing list