5

I read from the official manual (http://wiki.contextgarden.net/Fonts_in_LuaTex#How_LuaTeX_handles_system_fonts) that I need to export OSFONTDIR="/usr/local/share/fonts;$HOME/.fonts" to specify where the fonts should be looked for. However, it will only search fonts and .fonts. If I have fonts in the sub directories of these two, they won't be discovered. I find it inconvenient.

Is it possible to make it search the subfolders?

1
  • Welcome to TeX-sx. Font searching by LuaTeX in this regard is format-neutral: the search path is an engine thing. I've altered the tags to reflect that.
    – Joseph Wright
    Commented Oct 30, 2014 at 7:30

3 Answers 3

5

Like other TeX-related environmental variables, controlling OSFONTDIR requires understanding how variables are expanded by kpathsea. The key is to know that // (two consecutive / chars) is treated as a 'recursive' marker. Thus what you want is

export OSFONTDIR="/usr/local/share/fonts//;$HOME/.fonts//"

Before you alter this value, I'd be tempted to check the current setting with

kpsewhich --var-value=OSFONTDIR

as it may already be correct.

2
  • I'm currently using my Windows system (TL2014) which reports C:/Windows/fonts// from kpsewhich --var-value=OSFONTDIR, which would be 'right', so I'd be cautious and check the value before making any changes.
    – Joseph Wright
    Commented Oct 30, 2014 at 8:37
  • 1
    Note that ConTeXt separates kpsewhich variables for MkII (which are defined in texmf.cnf) from those for MkIV (which are defined in texmfcnf.lua). To search for the variables in texmfcnf.lua, you need to use: mtxrun --expand-var OSFONTDIR.
    – Aditya
    Commented Nov 3, 2014 at 18:57
1

run

luaotfload-tool -fuvvv --log=stdout

and it shows you where fonts are searched

0

I'm not sure how or if you can do this in your TeX system, so this is just a partial answer. You can do something like (the syntax on your system might be different)

for d in $HOME/.fonts/*/; do
    OSFONTDIR+=":$d"
done

to recursively add all subdirectories of $HOME/.fonts to OSFONTDIR.

You must log in to answer this question.

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