I recently installed context on my laptop running Debian unstable. The version of context is 2017.05.015 and I installed it using apt.

My intention is to use system fonts in my generated documents, so i followed the instructions provided on the context website (http://wiki.contextgarden.net/simplefonts).

  • I set an environment variable in my .zshrc (i use zsh): export OSFONTDIR=~"/usr/share/fonts//;/usr/local/share/fonts//;~/.fonts//"
  • started a new shell
  • updated the font database: mtxrun --script fonts --reload --force
  • and finally ran a command to find the new entries: mtxrun --script fonts --list --all

Unfortunately I had no luck finding my system fonts located in usr/share/fonts etc in the database, although the output of the reload command shows that it found system fonts:

fonts           | names | identifying system font files with suffix 'AFM'
fonts           | names | globbing path '/home/julian/.fonts/**.AFM'
fonts           | names | globbing path '/home/julian/usr/share/fonts/**.AFM'
fonts           | names | globbing path '/usr/local/share/fonts/**.AFM'
fonts           | names | 43 system files identified, 0 skipped, 0 duplicates, 43 hash entries added, runtime 0.146 seconds
fonts           | names | 135 files rejected due to clashes
fonts           | names | 182 double lookups in 'mappings'
fonts           | names | 39 double lookups in 'fallbacks'

I get only the default fonts listed, such as Latin Modern, and can't use system fonts in my documents.

The system font i want to use is referenced like this:

\definefontfamily [mainface] [rm] [dejavusans]
\definefontfamily [mainface] [ss] [dejavusans]
\definefontfamily [mainface] [tt] [dejavusans]
\definefontfamily [mainface] [mm] [dejavusans]

  • 1
    What happens if you run mtxrun --script fonts --list --pattern="Dejavu*" --all (assuming you have dejavu fonts installed). It will also help if you add a minimal example showing how you are trying to use system fonts.
    – Aditya
    Jan 30 '18 at 17:17
  • 1
    Don't use simplefonts and have a look at wiki.contextgarden.net/… Jan 30 '18 at 20:42
  • @Aditya: I tried to run your suggested line, but any font i have installed in /usr/share/fonts, /usr/local/share/fonts and ~/.fonts will not show up at all. According to the results of the update command, i have 558 registered fonts. The list however is significantly shorter. Jan 30 '18 at 23:18

Interesting solution:

All i did is removing the variable from .zshrc file and context seemed to use the default location, where it looks for font files. Maybe i did something wrong with it.

According to http://wiki.contextgarden.net/simplefonts:

In Linux, the standard value is:

OSFONTDIR= /usr/share/fonts//;$HOME/.fonts

  • Aside from your argument here (that I can't even get 'cause I'm no native english speaker). Is it just me, or you did set OSFONTDIR on your .zshrc file? I think it would be wiser if you set it as a global environment variable. For example, on my Gentoo box I created a file inside /etc/env.d/ and put in it the OSFONTDIR var with the values you'd want to set.
    – acidrums4
    Feb 5 '18 at 21:08

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.