Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to use OpenType fonts in MetaPost labels?

I use MiKTeX 2.9. I hoped something like mpost --tex=dvilualatex <myfile>.mp might work, but no luck.

Suggestions?

I tried this, but I get an empty box where my label should be, even if I use the default fonts.

\startMPdefinitions
\stopMPdefinitions


\starttext
\startMPpage
beginfig(1);
  draw(0, 0)--(200,200);
  dotlabel.bot("ABCDEFG", (100,100));
endfig;
\stopMPpage

\stoptext
share|improve this question
    
Thanks to a patch by Dohyun Kim there are now btex ... etex commands available in luamplib. I’m not sure if it’s in the pretest already but it’s worth a try. –  phg May 16 '13 at 16:15
    
@morbusg Have you seen here:tex.stackexchange.com/questions/82675/… ? –  Scott H. May 16 '13 at 17:38
    
@ScottH. I had, but I had forgotten! Well there goes rep, but I didn't want to ask the exact same question. –  morbusg May 16 '13 at 21:10
    
@phg: Thanks for that info! If someone wants to put that into an answer I'll throw some bounty on his/her way (maybe with some patch instructions or something). Doesn't exactly bring closure to the OP, but hey. –  morbusg May 16 '13 at 21:18
    
@morbusg: The credit for the patch goes to Kim alone, we merely ported it. If it works for you, just send him a thank you email. –  phg May 17 '13 at 9:43
show 1 more comment

1 Answer

If you don't mind using ConTeXt to generate your metapost figures you can just use:

% ConTeXt font setup. This is similar to fontspec
% \usemodule[simplefonts]
% \setmainfont[Pagella]

\startMPdefinitions
  % Common MP code for all figures
\stopMPdefinitions

\starttext
\startMPpage
 % MP figure. Text enclosed in btex ... etex is parsed using ConTeXt
\stopMPpage
...
\startMPpage
...
\stopMPpage
\stoptext    

And then compile it using context filename.

PS: I am not sure what is the current status of ConTeXt on MikTeX. If MikTeX does not include ConTeXt, you could just install ConTeXt standalone (in a parallel tree) which is about 250MB.

share|improve this answer
    
Pardon my ConTeXt ignorance, but can I generate PS or SVG output from ConTeXt? I want to include the output in my existing LaTeX documents. –  Colin Fraizer Sep 15 '11 at 16:35
2  
@Colin: By default ConTeXt MkIV (the one that uses luatex engine) produces pdf. If you are using pdflatex you can use directly use the pdf. For latex, you will need to convert the pdf to eps (there are plenty of tools for that). ConTeXt does not generate SVG output. –  Aditya Sep 15 '11 at 18:49
    
I'm sorry to be such a bozo, but this still doesn't work for me. My labels are all just an empty square, even if I use the default fonts. –  Colin Fraizer Sep 16 '11 at 13:55
    
@Colin: A minimal example works fine here, so I am afraid that more details are needed on why things fail on your machine. This format of this forum is not suited to debugging such issue. Would you mind posting a minimal failing example along with the version of ConTeXt and Metapost that you are using on the ConTeXt mailing list (or even the metapost mailing list) –  Aditya Sep 16 '11 at 19:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.