I am working with the example:
beginfig(1);
label.urt("Текст на русском.", origin);
label.llft("Text in English.", origin);
endfig;
The output contains:
Missing character: There is no 208 in font cmr10!
Missing character: There is no 162 in font cmr10!
Missing character: There is no 208 in font cmr10!
...
What I've tried:
- different values of the
prologues
variable (1,2 and 3) - in the beginning of the
.mp
file I wrote:
verbatimtex
\usepackage[utf8]{inputenc}
\usepackage[T2A]{fontenc}
\usepackage[russian]{babel}
\nofiles
etex;
- also I added to the
mpost
command an option-tex=latex
(hoping MetaPost would take the language settings in LaTeX…)
As I understand, the cmr10
font contains Russian symbols. So what do I have to tell MetaPost that it would 'understand' these letters? I've looked through the MetaPost Manual and browsed over the Internet about the problem — nothing found…
Best Answer
It is possible to get this to work with good old
mpost
, but it is 2021 now and frankly it is much easier to uselualatex
instead. If I wrap the OP example up inluamplib
, and choose an appropriate font with good Unicode support, like this:then compiling with
lualatex
produces this:which is probably what you want. Notice that the font selection is done at the LaTeX level and that Unicode UTF8 is the default encoding.
I do all of my MP work like this now, simply for the better integration with LaTeX. And if you can't use
lualatex
for the rest of your document, then you can at least produce separate PDF files using thestandalone
class, as my example shows.For documentation, try
texdoc luamplib
on your local system. Or have a look at sections 11 and 12 of my Drawing with Metapost document (in preparation...). And this earlier answer.Plain old Metapost version
If you are (for whatever reason) really stuck with plain
mpost
, then you might be able to get away with something like this.Provided that your system has a Cyrillic font called
fcmr6z
then compiling this with plainmpost
should produce:And just for reference, here is the font layout:
But the
luamplib
solution is a much better way to go!