On Thu, 3 May 2012, Marco wrote:

The wiki claims setting up an MPenvironment is enough to change the
font in MetaPost graphics:

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

\starttext
        This should be serif.

        \startMPcode
                draw textext("This should be in sans.");
        \stopMPcode
\stoptext

However, this has no effect. All text is in default serif font. If
[global] is provided, all text is in sans font. I am aware of a
similar issue in a thread last year¹, but the solution didn't really
address the problem. textext("\sans This should be sans.") works
here, but the point is that the MPenvironment fails. Why is that?

Metapost now runs as a library. All the text is first typeset by ConTeXt and metapost only knows the bounding box of the labels.

You can try (untested):

\starttext

This is serif

\switchtobodyfont[sans]
\startMPcode
draw textext("This should be sans");
\stopMPcode

\stoptext

Aditya
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to