I am a big lover of the EB-Garamond fonts by Georg Duffner. As of now, he has made two sets of font files, EB-Garamond-8 and EB-Garamond-12, respectively for “design size 8pt” and “design size 12pt”. Is there a way to make fontspec
(and possibly unicode-math
, too) use EB-Garamond-8 fonts for small sizes e.g. sub/superscripts, footnotes… and EB-Garamond-12 fonts for regular sizes when using local font files¹?
If I use only EBGaramond12, the following code works if I put the EBGaramond12-* .otf files in a fonts/ directory sibling to the .tex²
\setmainfont[
Path=fonts/,
Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
RawFeature={+clig,+dlig,+cv11},]{EBGaramond12}
but if I try to adapt it to use the SizeFeatures
options
\setmainfont[
Path=fonts/,
Extension=.otf,
UprightFont=*-Regular,
ItalicFont=*-Italic,
BoldFont=*-Bold,
RawFeature={+clig,+dlig,+cv11},
SizeFeatures={
{Size={-12}, UprightFont=EBGaramond8-Regular, ItalicFont=EBGaramond8-Italic},
{Size={12-}, UprightFont=EBGaramond12-Regular, ItalicFont=EBGaramond12-Italic, BoldFont=EBGaramond12-Bold}
}]{EBGaramond12}
Then the document won't compile and I get the following error. Using complete names instead of wildcarded ones changes nothing.
The key 'fontspec/UprightFont' is unknown and is being ignored.
¹ It means that using features that automagically select the right system fonts is not an option.
² the file structure is
.
├── fonts
│ ├── EBGaramond08-Italic.otf
│ ├── EBGaramond08-Regular.otf
│ ├── EBGaramond12-Bold.otf
│ ├── EBGaramond12-Italic.otf
│ └── EBGaramond12-Regular.otf
└── paper.tex
SizeFeatures
option. Or vice-versa.