Using TexShop on Mac OS I try to compile a code:
\setupbodyfont[dejavu] \enableregime[utf] \mainlanguage[russian] \starttext Немного русского текста для пробы. \stoptext
But it gives me a transliterated page
Is there is a way to fix it?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.Sign up to join this community
Transliterated text is a "symptom" of using 8-bit ConTeXt MkII (pdfTeX) without setting up the fonts properly. Unicode letters are mapped to 256 glyphs and unless you switch the encoding to T2A, you'll get T1/EC encoding with the Latin alphabet.
Here's a proper MkII setup using Gentium:
\usetypescriptfile[type-gentium] \usetypescript[gentium][t2a] \setupbodyfont[gentium] \enableregime[utf-8] \mainlanguage[russian] \starttext Немного русского текста для пробы. \stoptext
However I would strongly advise you to try to use MkIV (LuaTeX) for Russian. In MkIV you don't need to use
\enableregime since the encoding is UTF-8 by default already.
The reason why you get a blank page is again because of the wrong font setup. The default Latin Modern font doesn't contain Cyrillic glyphs, so you basically get "empty glyphs" from LM. If you don't properly set up another font, for example if you try to use
\setupbodyfont[nonexistentname], ConTeXt doesn't throw any warnings, just silently ignores the switch and sticks with LM without displaying any Cyrillic.
If you switch to another font that lacks Cyrillic support, you'll get the same result as with LM: lots of missing glyphs. A notable example might be
\setupbodyfont[times] switching to TeX Gyre Termes which used to work in the beginning, but the Cyrillic support was later removed due to very bad quality and nobody willing to step in yet to fix it. The same is true for the whole TeX Gyre font family.
A working MkIV setup would be:
\setupbodyfont[gentium] \mainlanguage[russian] \starttext Немного русского текста для пробы. \stoptext
You can replace
[gentium] with any font that ConTeXt supports via typescripts as long as that font has support for Cyrillic. Examples include
If you want to use a font that's not predefined in ConTeXt, you either need to write your own typescript for it or use a
simplefonts module written by Wolfgang that has recently been integrated into ConTeXt. The following example uses Comic Sans installed by the system, but
\definefontfamily only works with TeX Live 2014 or the standalone distribution:
\definefontfamily[comic][serif][Comic Sans MS] \setupbodyfont[comic] \mainlanguage[russian] \starttext Немного русского текста для пробы. \stoptext
The example won't work with TL 2013. If you cannot afford to upgrade your distribution and want to use system fonts, you need to either write a typescript or load the
simplefonts module. But your example with dejavu should work out-of-the-box even with TL 2013. Just remove
\enableregime and make sure that you compile the example with LuaTeX, not with pdfTeX.