# Using OTF with MiKTeX, XeLaTeX on Windows

Install free Cabin Open Type fonts in your home directory. Consider this file to be compiled with XeLaTeX:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Cabin}

\begin{document}

{\scshape test}

\end{document}


Use MiKTeX on Windows. When the package cabin is installed, then the small caps are ignored. When it is not installed, then the result is as desired.

When this is compiled on Linux using TeX Live, then the result is always as desired, whether the package is installed or not.

The same problem is with FiraSans. Any ideas how to solve this?

• Do I understand correctly: you're saying that simply installing the cabin package (not including it with \usepackage, but simply installing it on MiKTeX) makes the Cabin font not work? – ShreevatsaR Feb 14 '18 at 6:10
• @ShreevatsaR That may happen when the font paths are mixed up, so both installations of Cabin are found as valid. – TeXnician Feb 14 '18 at 6:19
• @ShreevatsaR Exactly, as in the example above. By the way, if I don't use fontspec , and instead use the package cabin (or FiraSans) and compile it XeLaTeX, then no problem: \documentclass{article} \usepackage{cabin} \begin{document} {\sffamily\scshape test} \end{document} – Jabot Feb 14 '18 at 6:19
• If can happen. If you have a font twice and xelatex searches both locations (on windows it searches the texmf tree and the system font folder) then a lot of bad things can happen. Possible solutions are to remove one of the fonts, use an absolute path, or to forbid xelatex to search one of the locations with a fontconfig setting tex.stackexchange.com/a/87906/2388. – Ulrike Fischer Feb 14 '18 at 8:46

As Ulrike Fischer has suggested in the comments and as described in https://tex.stackexchange.com/a/87906/2388, the problem is that MiKTeX is searching the texmf tree and using the Type 1 fonts first. If you want to use the fonts both with pdfTeX and XeLaTeX, then the best solution is to prevent MiKTeX from using the Type 1 fonts. (If, however, you only want to use the fonts with XeLaTeX, then just remove the relevant package together with the fonts in the texmf tree.)
This is what I did with FiraSans (on Windows 7). Located the localfont2.conf file at C:\Documents and Settings\UserName\Application Data\MikTeX\2.9\fontconfig\config and added these lines (I have MiKTeX installed in C:\miktex29):
<selectfont>

Then refreshed FNDB and updated formats in MiKTeX settings. After that compiling the MWE (replacing Cabin with FiraSans) with XeLaTeX yielded the expected result.