Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fontspec's font-not-found error on XeLaTeX #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yudai-nkt
Copy link

TL;DR: XeTeX cannot load fonts in TEXMF tree by their font name whereas LuaTeX can. Therefore we need to specify FontAwesome by file name so that both XeTeX and LuaTeX can load it.


Consider the following MWE:

\documentclass{article}
\usepackage{fontawesome}
\begin{document}
\faAdjust
\end{document}

While this MWE works with LuaLaTeX, it doesn't with XeLaTeX issuing the following error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "FontAwesome" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.45 \newfontfamily{\FA}{FontAwesome}

The reason for this pretty easy; it's clearly described in the fontspec documentation. Here is an excerpt from section 5.2 of v2.6d:

Fonts in such locations are visible to XeTeX but cannot be loaded by font name, only file name; LuaTeX does not have this restriction.

There are several ways to load fonts by file name, and I specified the extension .otf in the optional argument because this is convenient when we load bold and italic variants of a font (FontAwesome doesn't have variants, though).

Fix #12.

@dropsonic
Copy link

Please merge it. I had the same issue with this package and had to create my own "fixed" version of it.

@yudai-nkt
Copy link
Author

yudai-nkt commented Mar 22, 2019

@dropsonic FYI: You can give a try to fontawesome5 if you don't like putting the fixed fork in your TEXMFHOME or TEXMFLOCAL. I don't really look into the package, but at least

\documentclass{article}
\usepackage{fontawesome}
\begin{document}
\faAdjust
\end{document}

works well with XeLaTeX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants