7

I have the following snipped of code

\usemodule  [simplefonts][size=12pt]
\setmainfont[DejaVu Sans]

\starttext

Test text

Тестовый текст

\stoptext

And this works great. ConTeXt compiles it and the font is correct. But if I change font to

\usemodule  [simplefonts][size=12pt]
\setmainfont[Liberation Sans]

\starttext

Test text

Тестовый текст

\stoptext

then result will be of wrong font and russian text is not rendered.

The font names are taken from output of fc-list program (Linux). ConTeXt installed from texlive, version is

mtx-context     | ConTeXt Process Management 0.60
mtx-context     |
mtx-context     | main context file: /usr/share/texmf-dist/tex/context/base/context.mkiv
mtx-context     | current version: 2013.05.28 00:36
  • I use ConteXt in Windows and i dont have problem like that, it's ok. – Hirwanto Dec 27 '13 at 12:01
  • 1
    Check your corresponding .log file. Also, you probably don't have Liberation Sans installed. – prash Dec 27 '13 at 12:27
9

ConTeXt MkIV does not rely on system font mechanism to get the font name. So the information returned by fc-cache is useless. Instead use the mtx-fonts script to find the name of the font.

  1. Run

    mtxrun --script fonts --list --pattern=liberation --all
    

    which gives

    liberationmono                   liberationmono                   LiberationMono-Regular.ttf
    liberationmonobold               liberationmonobold               LiberationMono-Bold.ttf
    liberationmonobolditalic         liberationmonobolditalic         LiberationMono-BoldItalic.ttf
    liberationmonoitalic             liberationmonoitalic             LiberationMono-Italic.ttf
    liberationmononormal             liberationmono                   LiberationMono-Regular.ttf
    liberationsans                   liberationsans                   LiberationSans-Regular.ttf
    liberationsansbold               liberationsansbold               LiberationSans-Bold.ttf
    liberationsansbolditalic         liberationsansbolditalic         LiberationSans-BoldItalic.ttf
    liberationsansitalic             liberationsansitalic             LiberationSans-Italic.ttf
    liberationsansnarrow             liberationsansnarrow             LiberationSansNarrow-Regular.ttf
    liberationsansnarrowbold         liberationsansnarrowbold         LiberationSansNarrow-Bold.ttf
    liberationsansnarrowbolditalic   liberationsansnarrowbolditalic   LiberationSansNarrow-BoldItalic.ttf
    liberationsansnarrowitalic       liberationsansnarrowitalic       LiberationSansNarrow-Italic.ttf
    liberationsansnarrownormal       liberationsansnarrowitalic       LiberationSansNarrow-Italic.ttf
    liberationsansnormal             liberationsans                   LiberationSans-Regular.ttf
    liberationserif                  liberationserif                  LiberationSerif-Regular.ttf
    liberationserifbold              liberationserifbold              LiberationSerif-Bold.ttf
    liberationserifbolditalic        liberationserifbolditalic        LiberationSerif-BoldItalic.ttf
    liberationserifitalic            liberationserifitalic            LiberationSerif-Italic.ttf
    liberationserifnormal            liberationserifitalic            LiberationSerif-Italic.ttf
    
  2. If the above does not list the fonts, regenerate the font database.

     mtxrun --script font --reload --force
    
  3. If the fonts are still not listed, check the value of OSFONTDIR using

    mtxrun --expand-var OSFONTDIR
    

    You can force the search path using

     OSFONTDIR=/path/to/font mtxrun --script font --reload --force
    
  • I am not getting similar list for liberation but I am getting same list for --pattern=dejavu. Liberation fonts are installed and there is TTF files in /usr/share/fonts/liberation-fonts just like DejaVu has in /usr/share/fonts/dejavu – s9gf4ult Dec 28 '13 at 5:17
  • Perhaps the fonts were installed after ConTeXt. Run mtxrun --script fonts --reload --force and try again. – Aditya Dec 28 '13 at 5:19
  • 1
    @s9gf4ult Also try forcing the search path: OSFONTDIR=/path/to/font mtxrun --script fonts --reload – Philipp Gesang Dec 28 '13 at 10:55
  • 2
    @s9gf4ult Could be just a typo: The font is spelled “liberation”, without the extra “t”. Btw you can use wildcards, e.g. --pattern=liber* will show Liberation and Libertine, if installed. – Philipp Gesang Dec 29 '13 at 10:22
  • 1
    It was a typo. mtxrun --script fonts --list --pattern='liberat*' --all shows all I need. – s9gf4ult Dec 29 '13 at 11:02

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.