ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Background with rounded corners (Metafun)
@ 2017-08-22 22:12 Fabrice Couvreur
  2017-08-22 22:50 ` Aditya Mahajan
  0 siblings, 1 reply; 9+ messages in thread
From: Fabrice Couvreur @ 2017-08-22 22:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1261 bytes --]

Hello,
I would like to have three corners rounded as in the figure.
Thank you
Fabrice

\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]

\startuseMPgraphic{MyFrame}
 path b ;
 picture p ;
 p := textext.rt("\bf\tfx\white\framedtextparameter{Title}") ;
 p := p shifted (.3EmWidth,OverlayHeight-.6EmWidth) ;
 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}]

\defineframedtext
  [MyFrame]
  [frame=off,
   foregroundstyle={\switchtobodyfont[10pt]},
   background=MyFrame,
   align={verytolerant},
   height=fit]

\definefloat
  [recipe]
  [figure]

\setupfloat
  [recipe]
  [default={right,none}]
\showframe
\starttext
 \placerecipe{}
   {\startMyFrame[Title=Info,width=10cm]
      L'équivalent vingt pieds (EVP) est une unité de mesure de conteneurs
(de longueur courante 20 pieds, soit environ \unit{6,1 meter}).

      1 EVP représente environ \unit{38,5 cubic meter}.
    \stopMyFrame
   }
\input knuth


 \stoptext

[-- Attachment #1.2: Type: text/html, Size: 1651 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-09-08 12:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22 22:12 Background with rounded corners (Metafun) Fabrice Couvreur
2017-08-22 22:50 ` Aditya Mahajan
2017-08-22 23:01   ` Fabrice Couvreur
2017-08-22 23:19     ` Fabrice Couvreur
2017-08-22 23:20     ` Fabrice Couvreur
2017-08-30 16:07       ` Fabrice Couvreur
2017-08-30 20:45         ` Pablo Rodriguez
2017-08-30 20:53           ` Fabrice Couvreur
2017-09-08 12:37   ` Meer, Hans van der

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).