# Is there no direct, verbatim way to define a fontsize in points for a certain secondary font?

I’m writing my thesis in (Xe)LaTeX, using fontspec for font definitions. The document’s main font size is 12pt, passed to TeX via a \documentclass option. I want to define myself an auxiliary font with 10pt size for certain uses. Ideally, I would want to enter that size of the auxiliary directly when defining it with \newfontfamily.

Skim ahead to ‘the question’ section for what one could call a ‘too long, didn’t read’ summary.

# Potential solutions known to me

One thing I immediately noticed is that \footnotesize would scale the text to 10pt — the correct font size that I am looking for. I employed this in two different ways as can be seen later in the MWE.

Another option is to use fontspec’s SizeFeatures, as recommended in this answer.

A third one is to define a \fontsize — however, that requires calculating two different values; something I think TeX should do rather than me.

Finally, one can also Scale the font in its defintion as this answer recommends.

I did not find any direct ways to specify a font’s size via the \newfontfamily command in the fontspec documentation on CTAN.

# The MWE

\documentclass[12pt]{report} % see also note [1]
\usepackage{mathspec} % includes fontspec
\usepackage{polyglossia} % for languages — see note [2]
\setmainlanguage[babelshorthands=true,spelling=new]{german}
\usepackage{lipsum}

\setmainfont[Mapping=tex-text]{LiberationSerif} % my main font — see note [3].
\newfontfamily\antiquasans[Mapping=tex-text]{LiberationSans}  % A secondary font for demonstration
\newfontfamily\overpicfont[Mapping=tex-text, SizeFeatures={Size=10}]{LiberationSans} % defining with SizeFeatures
\newfontfamily\overpicscale[Mapping=tex-text, Scale=0.83]{LiberationSans} % defining with Scale

\newcommand\overpiccommand[1]{{\antiquasans\footnotesize #1}} % defined as an environment.

\begin{document}
\lipsum[1]                            % a comparison paragraph

{\antiquasans \lipsum[1]}             % a sans-serif paragraph with 12pt

\overpiccommand{\lipsum[1]}           % the environment including \footnotesize

{\overpicfont\footnotesize\lipsum[1]} % font forced to 10pt by SizeFeatures and footnotesize

{\overpicfont\lipsum[1]}              % font forced to 10pt by SizeFeatures

{\overpicscale\lipsum[1]}             % font scaled

\lipsum[1]                            % 12pt comparison paragraph

\end{document}


# Rendered output

The rendered output with a document font size of 12pt is split into two images as there was a page break.

From top to bottom:

• last line of standard (serif) text
• sans-serif with \antiquasans
• \overpiccommand environment, includes \antiquasans\footnotesize
• \overpicfont\footnotesize variant — includes both FontFeatures and \footnotesize. This is the paragraph split by a page break.
• using only FontFeatures
• using only Scale
• comparison text in 12pt serif typeface.

In the 10pt document, we can compare the following paragraphs:

• last line of standard (serif) text
• sans-serif with \antiquasans
• \overpiccommand environment, includes \antiquasans\footnotesize
• \overpicfont\footnotesize variant — includes both FontFeatures and \footnotesize. Note that \footnotesize defines 8pt here while the FontFeatures require 10pt.
• using only FontFeatures

# Testing results

The first thing that I noticed was that different ways to define 10pt in a 12pt document led to two different line heights — see the attached images. The fonts’ (both Liberation’s and LiberationSans’) standard 12pt line height is c. 5 mm. Using the SizeFeature forcing and the Scale factor, the line heights remained this even if the font size was smaller. Anything that included \footnotesize (the environment and the additional \footnotesize forcing) gave a line height of c. 4.2 mm consistent with the standard line height of the 10pt document.

Therefore, using the SizeFeatures or Scale options is not an option as it results in incorrect (too large) line spacing.

Further testing with the 10pt document revealed that SizeFeatures does not affect line height at all: the paragraph including \footnotesize and a SizeFeatures scaled font had a line height of c. 3 mm — consistent with 8pt footnotes — while the font size was clearly 10pt as requested by SizeFeatures.

# Conclusions

• As I stated before, I don’t want to use \fontsize. I want to somehow tell TeX to use a font size of 10pt in my 12pt document and let the engine do the required scaling.

• For the same reason, I am not happy with using SizeFeatures. These make the font size smaller but do not adjust the line height.

• Using a Scale argument also comes with that problem but also the added disadvantage that 10/12 is a nonfinite number. So rather than entering a clear 10pt, I have to make do with some approximation. A very bad solution.

• Using an environment would probably work if I had only inline examples, but I suspect it is going to fail for the intended uses I have. However, given that the environment definition worked, I can most likely define myself a command that would expand to the same thing.

• The least-best option is to just append a \footnotesize to every occurance of \overpicfont.

# The question

Does some way of adding a discreet, non-variable font size option exist when defining a new font family, such that TeX automatically chooses appealing line heights and adjusts all other sizes accordingly? Something along the lines of:

\newfontfamily\tenpointfont[size=10pt, other options]{MyCrazyFontsName}


## Notes

[1]: I also ran a comparison run without the 12pt option, i.e. with TeX’ standard font size of 10pt.

[2]: For some reason, I got an error when not including polyglossia and a language definition, hence I left it in the document. I don’t think it’s crucial in any way, though.

[3]: I have read that Mapping=tex-text and Ligatures=TeX are identical while the latter ensures compability with LuaLaTeX. Since I am only using XeLaTeX, I did not change this when copying from my last thesis.

• There is no "standard line height" for the font: this is determined by the size12.clo which is loaded by the article class and not by the font. Internally it uses \fontsize, and specifies both a fontsize and the leading. This is why using the builtin font changing commands work the way they do. So define your font family and then make wrappers which calculate the size correctly using \fontsize. The leading can be calculated to be whatever proportion of the fontsize you like. – Alan Munn Sep 12 '16 at 13:51
• If you also want to adjust the interline spacing, then \footnotesize is the correct way. – egreg Sep 12 '16 at 15:32
• it isn't at all clear from your question what you want that is different from \footnotesize which selects 10pt font on 12pt baseline in the report class 12pt option. – David Carlisle Sep 12 '16 at 15:44
• @DavidCarlisle I want something that is a single command. If \overpicfont\footnotesize is the shortest way to do this, then the answer is ‘no, there is no faster and direct way.’ – Jan Sep 12 '16 at 16:08
• you don't need to load a 10pt font just \antiquasans\footnotesize would be the normal way. You can of course define that to be a single command if you need it often. – David Carlisle Sep 12 '16 at 16:20

The font itself (and the fontspec font loading commands) do not specify the baseline spacing. The baseline spacing needs to be specified in the document class (or adjusted in the preamble). The class needs to specify the line spacing along with all other spacing, this is why the \fontsize command takes two arguments, it is up to the document designer to specify the baseline for each font size.
So the natural way to specify the font to be used at 10pt on a 12pt baseline would be \antiquasans\footnotesize it would in theory be possible to drop to a slightly lower level and avoid selecting the intermediate font just as \fontseries{bx}\fontshape{it}\selectfont avoids doing two \selectfont that would be implied by \bfseries\itshape so directly selecting the bold italic without first selecting bold or italic, however the gains compared to the rest of the work done in loading an opentype font are unlikely to be measurable.