[NTG-context] [metafun] MPenvironment / font switching

Philipp Gesang gesang at stud.uni-heidelberg.de
Thu Jun 9 23:20:57 CEST 2011


Hi all,

I’m struggling with the font used in metapost. The only way to
actually change it appears to be enclosing the mp graphic in two
statements of \setupbodyfont[…] -- which I need to avoid. In the
following example, the background text should be typeset (drawn)
as lm sans, whereas the main font should be left untouched
(serif).

·································································

\startMPenvironment %[global]
  \switchtobodyfont[sans]
  %\setupbodyfont[sans]
\stopMPenvironment

%\start\setupbodyfont[sans]
\startuseMPgraphic{bg}
  verbatimtex \setupbodyfont[sans] etex ;
  draw btex I wanna get rid of those serifs! etex
    xysized (21cm, 5cm) withcolor blue ;
\stopuseMPgraphic

\definelayer[bg][x=0,y=0,width=\paperwidth,height=\paperheight]
\setlayer[bg]{%
  %\setupbodyfont[sans]
  \useMPgraphic{bg}
}
\setupbackgrounds[paper][background=bg]
\setupbackgrounds[state=repeat]
%\stop

\starttext
\dorecurse{42}{I’d really like to keep my serifs! }
\stoptext

·································································

Wrapping the mp code inside a group is fatal.
\[start|stop]MPenvironment doesn’t seem to have an effect at all
unless called with the “global” flag -- in which case it will
change the main body font as well. Also, inside mp’s
“[verbatim|b]tex ...  etex” font switches refuse to work.

I’m really puzzled here, any hints? Thanks in advance
Philipp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20110609/f0b85cf2/attachment.pgp>


More information about the ntg-context mailing list