[NTG-context] Center a text (Metafun)

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Sat Mar 6 11:30:33 CET 2021


Fabrice Couvreur schrieb am 06.03.2021 um 11:17:
> Hi Hans,
> Some time ago, you offered this code to respond to a specific request 
> from me. I used this code again and wanted to know if it was possible 
> for the title "Algorithm" to be automatically centered based on the content.
> Thank you
> Fabrice
> 
> 
> \definecolor[MyBlue][c=0.2 , m=0.03, y=0.00, k=0.00]
> 
> \definecolor[maincolor] [b=.5]
> 
> \defineframedtext
>     [MyFrame]
>     [frame=off,
>      background=MyFrame,
>      width=fit,
>      height=fit,
>      style=small]
> 
> \startuseMPgraphic{MyFrame}
>       path b;
>       picture p;
>       p := textext.rt("\tfx\bf\white\framedtextparameter{Title}");
>       p := p shifted (2BodyFontSize,OverlayHeight-ypart center 
> p+.25ExHeight);

      p := textext.t("\tfx\bf\white\framedtextparameter{Title}");
      p := p shifted (OverlayWidth/2,OverlayHeight-ypart center 
p+.25ExHeight);

Wolfgang


More information about the ntg-context mailing list