[metapost] Open/True Type Fonts

Mojca Miklavec mojca.miklavec.lists at gmail.com
Sat May 17 12:34:59 CEST 2008

On Fri, May 16, 2008 at 6:06 PM, Troy Henderson wrote:
> Has anyone been successful at using Open/True Type fonts in MetaPost
> figures?  I have read that some have done it with ConTeXt, but since I
> am a LaTeX user, it would be nice if MetaPost could call XeLaTeX
> (similar to the way it can call TeX or LaTeX) to process the labels.
> For example, instead of using something like
> verbatimtex
> %&latex
> \documentclass{minimal}
> \begin{document}
> etex
> perhaps something similar like
> verbatimtex
> %&xelatex
> \documentclass{minimal}
> \usepackage{fontspec}
> \setmainfont{Adobe Garamond Pro} % For example
> \begin{document}
> etex
> could be used.  This specific method does not work even with calling
> MetaPost by `mpost -tex=xelatex`.  Any ideas on how to facilitate
> this?

Hello Troy,

I guess that you're using standalone metapost images (.mp files), right?

In that case, why don't you simply use ConTeXt to generate the pdf
images, and you will still be able to include them in your LaTeX
documents? The only thing you need to learn about ConTeXt is how to
start and stop document/image, how to setup colors & fonts and how to
use labels. (With LuaTeX you can use the standard btex ... etex
constructs, but with XeTeX the only way to get the labels right is to
use \sometxt.)

% the most primitive way to use fonts - you can use the high-level
interface of course
\font\a="Adobe Garamond Pro"\a
% enable colors
% bugfix to get withcolor working on text

draw fillcircle scaled 3cm;
draw \sometxt{This is some \TeX{}t with Garamond.} xscaled 1.3 rotated
30 withcolor blue;

Try to compile it with
    texexec --xtx filename.tex

If you need multiple figures, you can also make a multiple-page
document and include page X of document when including figures into
your document.


More information about the metapost mailing list