I dowloaded EB Garamond from https://github.com/georgd/EB-Garamond/releases/tag/nightly and copied all fonts, .otf and .ttf to ~/.fonts/e
The typeface contains different font files for the optical sizes 08pt and 12pt:
However, if I create a document which should contain EBGaramond12-Italic and compile it with LuaLaTeX, my PDF reader only shows the following fonts:
%!TEX program = lualatex
\documentclass{article}
\usepackage{fontspec}
% https://tex.stackexchange.com/a/79783/38905
\setmainfont[%
SizeFeatures={%
{Size={-12},
Font=*08-Regular,
ItalicFont=*08-Italic},
{Size={12-},
Font=*12-Regular,
ItalicFont=*12-Italic}
},
]{EB Garamond}
\begin{document}
\normalsize
ABCDEFGHIJKLMNOPQRSTUVWXYZ
\huge
ABCDEFGHIJKLMNOPQRSTUVWXYZ
\normalsize
\textit{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\huge
\textit{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\end{document}
This is how the PDF looks:
This was compiled with
This is LuaHBTeX, Version 1.15.0 (TeX Live 2022/TeX Live for SUSE Linux)
Development id: 7509
Why doesn't this work as expected and how can I work around this issue?
Best Answer
The
fontspec
manual says about usingSizeFeatures
withItalicFeatures
:While not explicitly mentioned, the same principle applies to
ItalicFont
: The font shape (like italic or upright) is applied first, before size processing, so you need to follow specific orders when combining them.Here you can do this by moving the italic fonts into the
SizeFeatures
of theItalicFeatures
: