7

The following MWE:

\documentclass{article}
\usepackage{fontawesome}
\begin{document}
Text Text \faMobilePhone\ Text Text
\end{document}

when compiled with:

  • pdflatex and lualatex, works like a charm,
  • xelatex, is subject to the error:

    xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object.

    (and cannot create any PDF file).

Do you know what's going on?

Update

As requested by egreg, here is the console output of xelatex -output-driver="xdvipdfmx -vv" test.tex:

<FONTMAP:/home/bitouze/.texlive2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map><FONTMAP:/home/bitouze/.texlive2016/texmf-var/fonts/map/dvipdfmx/updmap/kanjix.map><FONTMAP:/usr/local/texlive/2016/texmf-dist/fonts/map/dvipdfmx/ckx.map>No dvi filename specified, reading standard input.
stdin -> test.pdf
DVI Comment:  XeTeX output 2016.10.14:1020
<AGL:texglyphlist.txt><AGL:pdfglyphlist.txt><AGL:glyphlist.txt>[1</usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf@9.96pt<NATIVE-FONTMAP:/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf/0/H/65536/0/0>
fontmap: /usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf/0/H/65536/0/0 -> /usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf(Identity-H)

pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf".
(CID:LMRoman10-Regular)
pdf_font>> Type0 font "/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf" cmap_id=<Identity-H,0> opened at font_id=</usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf/0/H/65536/0/0,0>.
></usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb@9.96pt<NATIVE-FONTMAP:/usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb/0/H/65536/0/0>
fontmap: /usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb/0/H/65536/0/0 -> /usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb(Identity-H)

pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb".
(CID:FontAwesome)
pdf_font>> Type0 font "/usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb" cmap_id=<Identity-H,0> opened at font_id=</usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb/0/H/65536/0/0,1>.
>]
otf_cmap>> Creating ToUnicode CMap for "/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf"...
(CID:/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf[VESFSG+LMRoman10-Regular][CIDFontType0][6 glyphs][1055 bytes])(CID:/usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb[QZYGOD+FontAwesome][CIDFontType0]
xdvipdfmx:warning: Invalid CMap
xdvipdfmx:fatal: pdf_ref_obj(): passed invalid object.

If I'm right, it points out that xetex or xdvipdfmx find the wrong type1 font (as guessed by Ulrike Fischer) but I'm still puzzled: what can I do against that? BTW:

$ fc-list | grep 'fontawesome'
/usr/local/texlive/2016/texmf-dist/fonts/type1/public/fontawesome/FontAwesome.pfb: FontAwesome:style=Regular
/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/fontawesome/FontAwesome.otf: FontAwesome:style=Regular
9
  • 1
    Works fine for me, and my first guess is always that xetex or xdvipdfmx find the wrong font (e.g. the type1 font). – Ulrike Fischer Oct 14 '16 at 8:12
  • 1
    I have no problem. Can you compile the example from the command line with xelatex -output-driver="xdvipdfmx -vv" test.tex and report the final part of the console output? – egreg Oct 14 '16 at 8:13
  • You could try \newfontfamily{\FA}{FontAwesome.otf} after loading the package. – Ulrike Fischer Oct 14 '16 at 8:50
  • 1
    Remove /usr/local/texlive/2016/texmf-dist/fonts/type1 in your fonts.conf or local.conf for fontconfig, because type1 fonts are almost unusable as native fonts. – Akira Kakuto Oct 14 '16 at 10:24
  • 2
    Try to change Urlike's comment as \newfontfamily{\FA}{[FontAwesome.otf]} – Akira Kakuto Oct 14 '16 at 10:51
7

You can try

\newfontfamily{\FA}{[FontAwesome.otf]}

after loading the fontawesome package (a simple modification of the comment by Ulrike Fischer). In general, directories for type1 fonts should be removed from search paths for fontconfig. Type1 fonts are almost unusable as native fonts in XeTeX, except for very simple encoding.

1
  • 4
    Just in case another person gets the same issue. Changing \newfontfamily to \setfontfamily does the trick. – Maximiliano Rodriguez Mar 6 '19 at 17:50
2

Another solution is to reject type1 fonts.

Add this <glob>-line to /etc/fonts/fonts.conf like this (take care of the correct parent tags):

<fontconfig>
    <selectfont>
        <rejectfont>
            <glob>/usr/share/texlive/texmf-dist/fonts/type1/*</glob>
        </rejectfont>
    </selectfont>
</fontconfig>

Attention: The commentar in the fonts.conf file says you should use local.conf instead of this file. But it is not on my system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.