5

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

transliterated text

Is there is a way to fix it?

  • Are you using MkII or MkIV? What version of ConTeXt are using. – Aditya Apr 7 '14 at 22:05
  • @Aditya mtx-context | main context file: /usr/local/texlive/2013/texmf-dist/tex/context/base/context.mkiv mtx-context | current version: 2013.05.28 00:36 – filokalos Apr 8 '14 at 11:20
  • @Aditya I tried both in TeXShop when run in ConTeXt it gives me transliteration, when I run ConTeXt(LuaTex) there is absolutely no text on the page, just number of the page and a dot of the end of sentence. – filokalos Apr 8 '14 at 12:10
  • I don't know why, but after removing .mp and syntax.gz files it was fixed. File was produced with correct Russian in ConTeXt(LuaTex) for the font dejavu. For other fonts situation remains as it was described above. Any ideas? – filokalos Apr 8 '14 at 12:42
  • 1
    This works correctly with a recent context minimals ConTeXt MkIV 2014.03.28. I don't have access to TL2013, so cannot check why the test file fails there. – Aditya Apr 8 '14 at 19:20
8

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

"Немного русского текста для пробы." in Gentium

You can replace [gentium] with any font that ConTeXt supports via typescripts as long as that font has support for Cyrillic. Examples include [dejavu], [iwona], [antykwa-torunska], ...

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

"Немного русского текста для пробы." in Comic Sans

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.

|improve this answer|||||
  • 4
    Comic Sans? Gasp! ;-) – egreg Jun 5 '14 at 11:30
  • You are right. I added a PNG with the result to make it nicer :) (Seriously though, I didn't have that many "universally available" system fonts and this one seemed 'just right for the purpose'.) – Mojca Miklavec Jun 6 '14 at 12:40
  • @MojcaMiklavec Thank you for the great detailed answer!. :) – filokalos Jun 7 '14 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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