[Tex/LaTex] How to make XeLaTeX recognize linked fonts with Windows

fontswindowsxetex

I can not get fontconfig, which XeLaTeX relies on, to recognize fonts that are in the Fonts folder as shortcuts (to fonts in other folders). fc-cache and fc-list ignore the shortcuts, which do not appear using the dir command.

Am I doing something wrong?

Best Answer

You can modify the configuration file fonts.conf of fontconfig library.

TeX Live

For TeX Live 2011, if you install it in e.g. C:\texlive, open C:\texlive\2011\texmf-var\fonts\conf\fonts.conf, there should be these lines:

<!--
    Find fonts in these directories

        You can add other directories if you have additional fonts.
        Example:
<dir>C:/Windows/fonts</dir>
<dir>c:/usr/local/share/texmf/fonts/opentype/dnscreen/hiragino</dir>
<dir>c:/usr/local/share/texmf/fonts/opentype/adobe/kozuka</dir>

-->

<dir>C:/Windows/fonts</dir>
<dir>C:/texlive/2011/texmf-dist/fonts/opentype</dir>
<dir>C:/texlive/2011/texmf-dist/fonts/truetype</dir>

You can add some lines as you wish.

MiKTeX

If you are using MiKTeX (installed in C:\miktex for example), you can see C:\miktex\fontconfig\config\fonts.conf and follow guide lines in the comments of the file. In fact, you should then open localfonts.conf to see the predefined directories, and then create a localfonts2.conf to add your own paths.

In fonts.conf:

<!--
    DO NOT EDIT THIS FILE.
    IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
    LOCAL CHANGES BELONG IN 'local.conf'.

    The intent of this standard configuration file is to be adequate for
    most environments.  If you have a reasonably normal environment and
    have found problems with this configuration, they are probably
    things that others will also want fixed.  Please submit any
    problems to the fontconfig bugzilla system located at fontconfig.org

    Note that the normal 'make install' procedure for fontconfig is to
    replace any existing fonts.conf file with the new version.  Place
    any local customizations in local.conf which this file references.

    Keith Packard
-->

<!-- Font directory list -->

    <include>C:\miktex/fontconfig/config/localfonts.conf</include>

And this is localfonts.conf:

<?xml version="1.0" encoding="UTF-8"?>

<!--
  DO NOT EDIT THIS FILE! It will be replaced when MiKTeX is updated.
  Instead, edit the configuration file localfonts2.conf.
-->

<fontconfig>
<include>localfonts2.conf</include>
<dir>C:\Windows\Fonts</dir>
<dir>C:\miktex\fonts\type1</dir>
<dir>C:\miktex\fonts\opentype</dir>
</fontconfig>