[metapost] MetaPost and XeTeX

José Carlos Santos jcsantos at fc.up.pt
Tue Jun 8 12:58:31 CEST 2010

On 08-06-2010 11:38, Nicola wrote:

>>>> Yesterday, Taco Hoekwater made a reference to MetaPost 2.0. I would like
>>>> to know if this new version will be able to work with XeTeX. [...] and I
>>>> wanted to be able to use within the graphics the same fonts that were
>>>> used within the text.
> If it's ok for you to create stand-alone PDF graphics and include that
> in your document, XeConTeXt has the ability to to what you want. This is
> a minimal document:
> \definetypeface [myface][rm][serif][hoefler][default][encoding=uc]
> \setupbodyfont[myface,12pt]
> \startMPenvironment
>     \switchtobodyfont[myface,12pt]
> \stopMPenvironment
> \starttext
> \setupcolors[state=start]
> \startMPpage
>     fill fullcircle scaled 3cm withcolor .7red;
>     label.bot(\sometxt{Hoefler text},(0,2mm));
> \stopMPpage
> \stoptext
> \end
> The code in \startMPpage-\stopMPpage is plain MetaPost code, with labels
> drawn by \sometxt rather than btex.. etex (there is also \textext, but
> for unknown reasons I've never been able to use it with XeTeX). If the
> code above is saved as myfig.tex then you can compile it with
> texexex --xtx myfig.tex
> to generate myfig.pdf. More details are provided in ConTeXt Wiki, in
> particular:
> http://wiki.contextgarden.net/Mpgraphic
> http://wiki.contextgarden.net/Fonts_in_XeTeX

Thanks. I will keep this possibility in mind, although it would be hard 
for me to follow it, since I use MiKTeX, which does not include ConTeXt.

Best regards,

Jose Carlos Santos

More information about the metapost mailing list