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\ttfamilyinstead. Specific settings can be changed later on using\addfontfeatures. – TeXnician Aug 09 '17 at 12:33\addfontfeatures)? – TeXnician Aug 09 '17 at 13:51\special! That is a very important TeX primitive. – Henri Menke Jan 29 '19 at 22:04\special. @HenriMenke what happens though? – helt Jan 30 '19 at 12:27