[lltx] luaotfload and OSFONTDIR

Philipp Stephani p.stephani2 at googlemail.com
Mon Jul 25 16:25:27 CEST 2011


2011/7/25 Ulrike Fischer <news3 at nililand.de>:
>
> The code in luaotfload which generates the font cache
> (otfl-font-nms.lua) contains the comment
>
> --[[
>  For the OS fonts, there are several options:
>   - if OSFONTDIR is set (which is the case under windows by default
> but not on the other OSs), it scans it at the same time as the texmf
> tree, in the scan_texmf_fonts.
>   - if not:
>    - under Windows and Mac OSX, we take a look at some hardcoded
> directories
>    - under Unix, we read /etc/fonts/fonts.conf and read the
> directories in it
>
>  This means that if you have fonts in fancy directories, you need
> to set them in OSFONTDIR.
> ]]
>
> Does setting somehow OSFONTDIR actually work somewhere?

Yes, it works on my system.

>
> I couldn't find anything in the code that looked as if luaotfload
> would actually use it (apart from log-lines).

The magic is in the distribution's texmf.cnf (e.g.,
/usr/local/texlive/2011/texmf/web2c/texmf.cnf):

% TrueType outline fonts.
TTFONTS = .;$TEXMF/fonts/{truetype,opentype}//;$OSFONTDIR//

% OpenType outline fonts.
OPENTYPEFONTS = .;$TEXMF/fonts/{opentype,truetype}//;$OSFONTDIR//

And these variables are used by luaotfload:

    local fontdirs = expandpath("$OPENTYPEFONTS"):gsub("^\.", "")
    fontdirs = fontdirs .. expandpath("$TTFONTS"):gsub("^\.", "")

> And various tests
> didn't do something either. (I'm not quite sure what in this context
> "OSFONTDIR" is -- a variable in texmf.cnf or an environment
> variable).

Both. If it is set in the environment, it overrides a texmf.cnf
variable. For example, I have in /usr/local/texlive/2011/texmf.cnf:

OSFONTDIR = ~/Library/Fonts;/Applications/Adobe
Reader.app/Contents/Resources/Resource/Font;/Library/Fonts;/System/Library/Fonts



More information about the lualatex-dev mailing list