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?
Best Answer
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:
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.