[NTG-context] Passing the parameters of a frame in an environment \startMPcode ... \stopMPcode

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Mon Apr 20 09:21:41 CEST 2020


Fabrice Couvreur schrieb am 19.04.2020 um 22:55:
> Hi,
> I try to reproduce the figure as faithfully as possible. I tried for the 
> rounded corners to put the key corner = round, but it does not work.

1. To create a new framed-instance you need \defineframe, \setupframed 
isn't enough to set the values.

    I guess you assumed this works similar to xtables but this mechanism 
sets a few values to assure \setupxtable is enough in certain cases but 
even here you need \definextable in certain cases.

    When you create a new instance you have to use the name of the new 
instance as command name, e.g. \frameletter or use the \placeframed 
command which takes the name as argument, e.g. \placeframed[frameletter].

2. You can't pass the name of a framed-instance to \framed (backwards 
compatibility, performance ...), this is only possible with \startframed.

3. ConTeXt uses different mechanism to draw rectangular (unless you draw 
a closed frame) and rounded frame and the mechanism for rounded frames 
doesn't work with outlinetext.

4. To achieve the desired result you can now a) use MetaPost to draw the 
complete card (letter plus frame) or b) use only TeX to put the letter 
in a frame and rotate it.

%%%% begin tex example
\usecolors[svg]

\defineframed
   [frameletter]
   [width=1.25em,
    height=1.75em,
    foregroundstyle=\ssbfc,
    corner=round,
    radius=0.1\bodyfontsize,
    rulethickness=1pt]

\starttext

\startTEXpage[offset=\linewidth]
\dontleavehmode
\rotate [rotation=5] {\color[darkred]   {\frameletter{A}}}
\rotate [rotation=-5]{\color[green]     {\frameletter{L}}}
\rotate [rotation=5] {\color[mediumblue]{\frameletter{E}}}
\rotate [rotation=-5]{\color[darkviolet]{\frameletter{A}}}
\stopTEXpage

\stoptext
%%%% end tex example

Wolfgang


More information about the ntg-context mailing list