20

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:

enter image description here

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

enter image description here

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?

7
  • 3
    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
    Commented Sep 19, 2013 at 15:07
  • @egreg: Thanks for your replay. I couldn't find any related issue and I thought it was my flaw ;-). Commented Sep 19, 2013 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. Commented Sep 19, 2013 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. Commented Sep 19, 2013 at 18:29
  • 2
    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). Commented Sep 19, 2013 at 18:53

2 Answers 2

24

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.

1
  • 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? Commented Jun 16, 2014 at 16:20
7

Download https://fontawesome.com/v4.7.0/assets/font-awesome-4.7.0.zip

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

\newfontfamily{\FA}{FontAwesome} with \newfontfamily{\FA}{FontAwesome Regular}
2
  • 2
    While I don't doubt that this answer works, could you explain why it does?
    – ChrisS
    Commented Aug 17, 2014 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
    Commented Dec 1, 2014 at 10:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .