# How to use a system font together with latex fonts

I am trying to use a display font for special headers -- it is Anton in truetype format, but to continue to use normal Latex fonts for the rest of the document. I thought this would be achieved by

\usepackage{droid}
\usepackage{ifxetex}
\ifxetex
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX} % To support LaTeX quoting style
\else
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\fi


but if this is compiled by xelatex, the droid package is ignored, and if by pdflatex, the Anton font is not available. Is there a way round this problem?

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Please post code we can copy-paste-compile to see the problem: a minimal working example (MWE). This makes it a lot easier to help! – cfr Dec 10 '14 at 0:34

\ifxetex detects whether you are compiling with XeTeX or not. If you are, it executes the if bit. If not, it executes the else bit. Moreover, you cannot use inputenc with XeTeX (so it is good, really, that that code is never read).

You can use 'normal LaTeX fonts' for the rest of the document, though. Just use the three lines of code from \usepackage{fontspec} and put \usepackage{droid} configuration afterwards, as loading fontspec sets the default families to Latin Modern.

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX} % To support LaTeX quoting style
\usepackage[T1]{fontenc}
\usepackage{droid}
\begin{document}
Some text.
\end{document}


However, you may prefer to use the Droid fonts in opentype/truetype format to take full advantage of XeTeX.

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX} % To support LaTeX quoting style

Note that I changed the value of \headerfont to prevent XeLaTeX hanging forever since I don't have the font you are using.