# fontawesome icons are getting too big using XeLaTeX

The following example must be compiled with XeLaTeX to reproduce the issue.

% arara: xelatex
\documentclass{article}
\usepackage{fontawesome}
\begin{document}
Text Text \faMobilePhone\ Text Text
\end{document}


Normally I am using TeXworks to compile and view the output. With the internal viewer I am getting the desired result. The following image demonstrates it:

However if I open the pdf with Preview (viewer of Mac) the scaling of the icon fails.

If I open the pdf file with Adobe Acrobat Reader the icon is still scaled correctly. If I print the page my printer is also not able to scale the icons correctly.

If I use LuaLaTeX everything seems to work correctly.

Can you reproduce the issue and do you know a solution?

-
Confirmed; seems to be a problem with the PDF engine on Mac OS X. If opened with Adobe Reader the size is correct; both it and the internal viewer of TeXworks don't rely on the PDF toolkit of Mac OS X. –  egreg Sep 19 '13 at 15:07
@egreg: Thanks for your replay. I couldn't find any related issue and I thought it was my flaw ;-). –  Marco Daniel Sep 19 '13 at 15:16
Is it a CFF-flavoured OpenType font (usually with a .otf extension) with a non-1000 UPM? If yes, then it is a known bug. –  Khaled Hosny Sep 19 '13 at 16:54
@KhaledHosny: Interesting. I am not enough familiar with fonts to know whether it's a non 1000 upm or not. But the bug seems to be similar. Thanks. –  Marco Daniel Sep 19 '13 at 18:29
The .otf file available from fortawesome.github.io/Font-Awesome, do indeed have a 1792 UPM size, so that is the bug. The only immediate solution is to convert the font to 1000 UPM units (using FontForge or similar). –  Khaled Hosny Sep 19 '13 at 18:53

xdvipdfmx (XeTeX’s output driver) has a bug with handling CFF-flavoured OpenType fonts (fonts usually with a .otf extension) with non-1000 UPM. It is a known bug with no known fix, unfortunately.

The Font Awesome has a 1792 UPM, so it suffers from this bugs.

One possible work around is to change the font to use 1000 UPM. FontForge can do this easily, from the GUI Element → Font Info → General → Em Size and change the value to 1000 while keeping the [x] Scale Outlines selected, so that FontForge can do the necessary scaling to compensate for the UPM change. Then generate a new OTF file. Using FontForge’s Python scripting, this can be done as:

import fontforge
font = fontforge.open("FontAwesome.otf")
font.em = 1000
font.generate("FontAwesome-1000upm.otf")


Another solution is to just use the TTF version of the font, but I’m not sure how compatible is it with the OTF version encoding-wise.

-
I'm facing the same trouble and, as I didn't succeed to generate the FontAwesome-1000upm.otf file, is it possible for you to make it available for download? BTW, what is then necessary (and sufficient)? Just to replace \newfontfamily{\FA}{FontAwesome} by \newfontfamily{\FA}{FontAwesome-1000upm} in the fontawesome.sty file? –  Denis Bitouzé Jun 16 at 16:20

then under fonts, install ttf instead of otf and in your *.sty file replace

\newfontfamily{\FA}{FontAwesome} with \newfontfamily{\FA}{FontAwesome Regular}

-
Welcome to TeX.SX! –  Claudio Fiandrino Jan 27 at 11:13
While I don't doubt that this answer works, could you explain why it does? –  ChrisS Aug 17 at 10:33
thanks a lot! Just wanted to point out, that this solution also solved the "inverse problem" (wrong scaling in Adobe Reader; correct scaling in every other reader I tried) –  JBantje Dec 1 at 10:11