I use xetex and fontspec to work with custom fonts like this:
\usepackage{fontspec}
\setmainfont{AGaramondPro}[Path = fonts/garamond/,%
BoldFont = *-Bold.otf,
BoldItalicFont = *-BoldItalic.otf,
ItalicFont = *-Italic.otf,
UprightFont = *-Regular.otf,
RawFeature={%
+onum % odd style figures
}]
\newfontfamily{\special}[Path = fonts/garamond/,%
BoldFont = *-Bold.otf,
BoldItalicFont = *-BoldItalic.otf,
ItalicFont = *-Italic.otf,
UprightFont = *-Regular.otf,
RawFeature={+c2sc,+scmp}]{AGaramondPro}
I keep asking myself if i can DRY it, so i define the font only once.
The font above is just an example. I have other fonts, where i would like to enable/disable certain RawFeatures for all instances without copy-pasting everywhere...
So the goal is that i can do something like
lorem {\ttfamily ipsum \special{dolor} amet}
and dolor
is then set in Garamond small capitals, and not in mono.
\Mono
? You can use\ttfamily
instead. Specific settings can be changed later on using\addfontfeatures
.\addfontfeatures
)?\special
! That is a very important TeX primitive.\special
. @HenriMenke what happens though?