# Scaling fonts with XeLaTeX

Various posts I've seen about using XeLaTeX suggest something like the following setup for fonts:

\documentclass{article}

\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{unicode-math}
\setdefaultlanguage[variant=american]{english}
\setotherlanguages{french,german}
\defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX}
\setmainfont{TeX Gyre Termes}[Scale=1.0]
\setmathfont{TeX Gyre Termes Math}

\usepackage[math]{blindtext}

\begin{document}
\blindtext[1]
\end{document}


Questions:

1. Is Ligatures=TeX actually needed, or is that already the default with fontspec?
2. What exactly does the option Scale=MatchLowercase accomplish there? I'm not seeing any difference in the output if I omit it.
3. Why is the option Scale=1.0 needed in \setmainfont? I do see that omitting it shrinks the text font (see output below). But why are TeX Gyre Termes and TeX Gyre Termes Math not already designed to be compatible in size?

Output:

• Answer to question 1: Yes. See documentation of fontspec, part II section 1, "the default setup for font loading automatically adds the Ligatures=TeX feature for the \setmainfont and \setsansfont commands." Jul 13 '20 at 16:02
• Matchlowercase will scale the sans and mono spaced font so the height of lowercase letters match the those of the main font. So you won’t see that in your example. The default scale of the main font may not necessarily be 1.0 and seems to be a bit lower for Termes. It appears that the scale of the math font matches that of the main font in your examples. Jul 13 '20 at 16:09
• @HerbSchulz: The scale of the math font matches that of the main font in both sample outputs, no matter whether I include Scale=1.0 or not? Jul 13 '20 at 17:18
• @murray : looks that way to me. Jul 13 '20 at 17:30

The Ligatures=TeX option is used by default for all fonts declared with \setmainfont and \setsansfont. How?

When fontspec is loaded, it looks for a fontspec.cfg file, with the usual precedence rules. If no local file is found, the global one is input, which contains

\defaultfontfeatures
[\rmfamily,\sffamily]
{Ligatures=TeX}

\defaultfontfeatures
[\ttfamily]
{WordSpace={1,0,0},
HyphenChar=None,
PunctuationSpace=WordSpace}


Declaring \defaultfontfeatures{Ligatures=TeX} can be useful for declaring other fonts with \newfontfamily or \newfontface. Beware to not do it with monospaced font families. Declaring it before loading any font would override the default and apply it also to \setmonofont, which is usually unwanted.

The options Scale=MatchUppercase or Scale=MatchLowercase make no sense before declaring the main font, because they'd scale the main font against Latin Modern. They make little sense inside \defaultfontfeatures anyway, because fonts have usually quite different ideas on how the x-height compares to the full height of the glyphs, so judgment has to be applied for each font.

Of course Scale=1.0 is not needed if you don't apply scaling beforehand.

• So exactly what should the order of the commands be in that preamble block starting at \usepackage{fontspec} and ending at \setmathfont{TeX Gyre Termes Math}? Jul 13 '20 at 17:22
• @murray Just remove the \defaultfontfeatures line. And Scale=1.0 Jul 13 '20 at 17:41
• Now I'm really confused: Don't I need at least \defaultfontfeatures{Scale=MatchLowercase so that if I include another font, e.g. one for Cyrillic, it matches? And excluding Scale=1.0, as the output shows, does change the size of the main font while, it appears, keeping the math font properly scaled to match it. Jul 13 '20 at 17:51
• @murray You may need it after the main declarations \setmainfont and \setsansfont. But, as I said, it mostly depends on what font families you load, because they might not all benefit from the same type of scaling. It's definitely wrong before \setmainfont. You want to scale fonts relatively to the main font, don't you? Not relatively to Latin Modern thay you may even be not using. Jul 13 '20 at 19:23

Answer to question 1: Yes. See documentation of fontspec, part II section 1,

... the default setup for font loading automatically adds the Ligatures=TeX feature for the \setmainfont and \setsansfont commands.

To question 2: See documentation of fontspec, part II section 6.2,

... the Scale feature also accepts options MatchLowercase and MatchUppercase, which will scale the font being selected to match the current default roman font to either the height of the lowercase or uppercase letters, respectively; ...

To question 3: I guess it is used to override the default Scale=MatchLowercase. Otherwise the newly set roman font (by using \setmainfont) with be scaled to match default roman font Latin Modern Roman. (Not sure, need to be checked.)