# Find which font is used by xelatex

I posted an answer about including Unicode into pdflatex documents (https://tex.stackexchange.com/a/399571/81006), but in fact this answer (while working) demonstrates problems with xelatex (on Windows 7).

Summary: xelatex chooses a different font than the installed on Windows font.

Running this example through xelatex

\documentclass[multi=my,crop]{standalone}
\usepackage{pgffor}
\usepackage{fontspec}
%\setmainfont{DejaVu Sans}
\setmainfont{Symbola}
\begin{document}

smilie/😎,ghost/👻,pumpkin/🎃.

\end{document}


produces

On the other hand, in Symbola the same string in Character Map (and any other Windows application I checked) produces: ; note that a different rendition of GHOST is chosen. Inspecting the installed TTF file of Symbola with a font editor shows the latter glyph for HOST, and no variation selectors.

Moreover, if I change commenting in LaTeX file to choose DejaVu Sans instead of Symbola, then only rectangles are shown instead of characters. (While DejaVu Sans does not have GHOST and JACK-O-LANTERN, it does have SMILIE.)

Question: how to find which exactly font (file?) was used by xelatex? (I suspect that it picks up one of the older version of DejaVu/Symbola which are left in %SYSTEMROOT%/Fonts by the Windows’ font installation subsystem when newer versions of a font are installed.)

• Not an answer, but you can specify a font by filename with fontspec: \setmainfont{Symbola_hint.ttf}[Path = /usr/share/fonts/truetype/ancient-scripts/] – David Purton Nov 4 '17 at 3:47

XeLaTeX compiles your document to an intermediate format called Extended DVI before outputting it to PDF. Unfortunately, the XDV driver is not really verbose by default. Therefore, we first compile the document to the XDV format using

xelatex -no-pdf test.tex


and from there we call the driver with the -v option

xdvipdfmx -v test.xdv


On my machine, this outputs to the console

<FONTMAP:/usr/local/texlive/2017/texmf-var/fonts/map/pdftex/updmap/pdftex.map><FONTMAP:/usr/local/texlive/2017/texmf-var/fonts/map/dvipdfmx/updmap/kanjix.map><FONTMAP:/usr/local/texlive/2017/texmf-dist/fonts/map/dvipdfmx/ckx.map>test.xdv -> test.pdf
DVI Comment:  XeTeX output 2017.11.04:1642
<AGL:texglyphlist.txt><AGL:pdfglyphlist.txt><AGL:glyphlist.txt>[1</usr/share/fonts/truetype/ancient-scripts/Symbola_hint.ttf@9.96pt<NATIVE-FONTMAP:/usr/share/fonts/truetype/ancient-scripts/Symbola_hint.ttf/0/H/65536/0/0>
pdf_font>> Input encoding "Identity-H" requires at least 2 bytes.
pdf_font>> The -m <00> option will be assumed for "/usr/share/fonts/truetype/ancient-scripts/Symbola_hint.ttf".
(CID:Symbola)
pdf_font>> Type0 font "/usr/share/fonts/truetype/ancient-scripts/Symbola_hint.ttf" cmap_id=<Identity-H,0> opened at font_id=</usr/share/fonts/truetype/ancient-scripts/Symbola_hint.ttf/0/H/65536/0/0,0>.
>]
otf_cmap>> Creating ToUnicode CMap for "/usr/share/fonts/truetype/ancient-scripts/Symbola_hint.ttf"...
(CID:/usr/share/fonts/truetype/ancient-scripts/Symbola_hint.ttf[CIDFontType2])
Compression saved 52936 bytes
7360 bytes written

• I presume you mean “outputs to ‘console’” instead of “to command line”… In fact, one does not need a driver: the .xdv file already contains the full path — and it is wrong indeed: C:/windows/fonts/Symbola.ttf — while the latest, currently active, version is in Symbola-hints.ttf. So it is a bug in xelatex (of TeXLive-2016, BTW). Thanks! – Ilya Zakharevich Nov 4 '17 at 4:11
• Investigating the registry, I see that xetex should have used a moral analogue of reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" -f Symbola — which emits Symbola (TrueType) REG_SZ Symbola_hint.ttf. – Ilya Zakharevich Nov 4 '17 at 8:05

Following XeTeX documentation, I inserted

\XeTeXtracingfonts=1\relax


near beginning of document. It it very buggy, but still .log file contains guessable info (interlaced with overwritten memory :-[):

Requested font "DejaVu Sans" at 10.0pt
-> 5^^I/windows/fonts/DejaVuSans.ttf


(the correct file name on my system is DejaVuSans_2.ttf — since it is the 3rd version installed).