1

I would like to use my own local fonts in my ConTeXt documents. They are stored in /usr/local/share/fonts/ like so:

├── cooper
│   ├── Cooper-BlackItalic.otf
│   ├── ...
├── Vollkorn
│   ├── Vollkorn-BlackItalic.otf
│   ├── ...
├── ... 

I've followed the instructions given in the "Use the fonts you want" page of the ConTeXt Garden, namely:

  • Set the OSFONTDIR environment variable to my font folder path:

    $ export OSFONTDIR=/usr/local/share/fonts

  • Run the following commands:

    $ mtxrun --generate

    $ mtxrun --script fonts --reload

Even after that, running

mtxrun --script fonts --list --all --pattern='*cooper*'

returns nothing. Trying to use them in a document also causes it to fallback to the default Latin Modern font. What am I doing wrong?

I've installed ConTeXt via texlive 2024, the following versions:

$ context --version
mtx-context     | ConTeXt Process Management 1.06
mtx-context     |
mtx-context     | main context file: /usr/local/texlive/2024/texmf-dist/tex/context/base/mkiv/context.mkiv
mtx-context     | current version: 2024.02.27 09:18
mtx-context     | main context file: /usr/local/texlive/2024/texmf-dist/tex/context/base/mkxl/context.mkxl
mtx-context     | current version: 2024.02.27 09:18
$ mtxrun --version
mtxrun          | ConTeXt TDS Runner Tool 1.32
mtxrun          | source path

Update: I can see the fonts from my $OSFONTDIR listed in the names.tma file, located in ~/.texlive2024/texmf-var/luametatex-cache/context/<random chars>/fonts/data/. But still they don't get listed by mtxrun --script fonts --list --all.

2
  • Welcome! To me it looks like you have done what one should, at least for the standalone installation. Maybe things work differently in a tex live installation.
    – mickep
    Commented Jul 19 at 20:19
  • I've had exactly this same issue, with even the exact same fonts. I seem to remember that the solution is to rename the files/folders so that everything is lowercase, but I'll see if I can find my exact solution and write a full answer later. Commented Jul 19 at 23:11

2 Answers 2

1

I just tried with files from

Stored in /usr/local/share/fonts/

$ tree  /usr/local/share/fonts/

/usr/local/share/fonts/
├── cooper
│   ├── Cooper Black Italic.otf
│   └── CooperBlack.otf
└── Vollkorn
    ├── Vollkorn-BlackItalic.ttf
    ├── Vollkorn-Black.ttf
    ├── ...

$ ls -la   /usr/local/share/fonts/cooper 
total 92
drwxr-xr-x 2 root root   4096 20 juil. 10:15  .
drwxrwsr-x 4 root staff  4096 20 juil. 10:15  ..
-rw-r--r-- 1 root root  42256 20 juil. 10:15 'Cooper Black Italic.otf'
-rw-r--r-- 1 root root  37448 20 juil. 10:15  CooperBlack.otf

then I check :

$ echo $OSFONTDIR
/home/username/.fonts:/usr/share/fonts:/usr/share/texlive/texmf-dist/fonts/:/usr/local/share/fonts

And finally :

$  mtxrun --version
mtxrun          | ConTeXt TDS Runner Tool 1.32
mtxrun          | source path

$ mtxrun --generate
$ mtxrun --script fonts --reload
$ mtxrun --script fonts --list --all --pattern='*cooper*'
identifier                   familyname     fontname                     filename   subfont   instances

cooperblack                  cooperblack    cooperblack                  /usr/local/share/fonts/cooper/CooperBlack.otf
cooperblackbold              cooperblack    cooperblack                  /usr/local/share/fonts/cooper/CooperBlack.otf
cooperblackitalic            cooperblack    cooperblackitalic            /usr/local/share/fonts/cooper/Cooper Black Italic.otf
cooperblackregular           cooperblack    cooperblack                  /usr/local/share/fonts/cooper/CooperBlack.otf
cooperhewittbold             cooperhewitt   cooperhewittbold             /usr/share/texlive/texmf-dist/fonts/opentype/public/cooperhewitt/CooperHewitt-Bold.otf
...
cooperhewittthinitalic       cooperhewitt   cooperhewittthinitalic       /usr/share/texlive/texmf-dist/fonts/opentype/public/cooperhewitt/CooperHewitt-ThinItalic.otf

Maybe to check :

  • echo $OSFONTDIR
  • read access to the font files
  • provide web link to the font files you are actually using, to reproduce
2
  • Thank you for the detailed investigation. I don't think the fonts themselves are the issue; I picked those two as exemples because they are free and open fonts (here are the pages for Vollkorn and Cooper). I've been using them all in LuaLaTeX for quite a while, without issues. As to ConTeXt-specific issues: echoing $OSFONTDIR shows me the variable was set correctly. At some point I might try installing ConTeXt from the official website, not from TeX Live, and see if it solves it.
    – impresso
    Commented Jul 21 at 15:34
  • Ah, and I know ConTeXt is looking in the right place because I can see all my fonts listed in the names.tda file (located in ~/.texlive2024/texmf-var/luametatex-cache/context/<random chars>/fonts/data). But when I issue the mtxrun --script fonts --list --all command, they're not there, and trying to use them in a document leads to an error.
    – impresso
    Commented Jul 21 at 15:39
1

Removing the TeX Live installation of ConTeXt and reinstalling it from ConTeXt Garden solved the issue.

If anyone is able to provide a fix for the original problem, that is, making local fonts work with TeX Live's ConTeXt, I'll be happy to mark it as the accepted solution.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .