Am 12.10.2013 um 19:39 schrieb Wolfgang Schuster
The module provides keys to apply a certain font and feature for each alternative (upright, italic etc.) of a font, a complete list with all keys is shown in the table below.
------------------------------------------------------- | Alternative | Font | Feature | |-----------------------------------------------------| | tf | regularfont | regularfeatures | | it | italicfont | italicfeatures | | sl | slantedfont | slantedfeatures | | bf | boldfont | boldfeatures | | bi | bolditalicfont | bolditalicfeatures | | bs | boldslantedfont | boldslantedfeatures | | sc | smallcapsfont | smallcapsfeatures | -------------------------------------------------------
The feature-keys expect the name from the \definefontfeature command, when you don’t specify a feature to a certain alternative the value from the “features” key is used.
When you want to set a certain font for a alternative there are different ways, I’m going to show the different ways with a few examples where I change the font for italic.
1. Use the filename of a font. With the “file:” prefix you can the tell the module to look for a file with the given name, when the file isn’t found the font from the tf-alternative is used. The file-method is also used when you omit the prefix.
\setupfontfamily [serif] [DejaVu Serif] [italicfont=file:dejavuserifbold]
\starttext Regular and \it Italic \stoptext
2. Use a certain style. When you use the “style: ”prefix the module looks for a certain style of the requested font.
\setupfontfamily [serif] [DejaVu Serif] [italicfont=style:bolditalic]
\starttext Regular and \it Italic \stoptext
3. Search for a font with a certain name. When you use the “name:” prefix the module looks for a font with the requested name. Names are internal values of a font which is sometimes the same as the filename.
\setupfontfamily [serif] [DejaVu Serif] [italicfont=name:dejavuserifbold]
\starttext Regular and \it Italic \stoptext
4. Use the spec information. When you use the “spec:” prefix you can request a font with a certain “weight” (bold or normal), “style” (italic or normal) and variant (smallcaps or normal).
\setupfontfamily [serif] [DejaVu Serif] [italicfont=spec:bold-italic]
\starttext Regular and \it Italic \stoptext
There is a possibility that I change the way to set font and features for alternatives in the feature to a way which is more compact and easier to parse in Lua.
I changed the way to set fonts and features for certain alternatives (the existing keys mentioned above will remain for a while) in the last beta and you can now set both values in a single setup. Below is a example where I changed the font and features for italic: \definefontfamily [mainface] [serif] [TeX Gyre Pagella] [it={style:bolditalic,features:smallcaps}] \setupbodyfont[mainface] \starttext Upright \it Italic \bf Bold \bi BoldItalic \stoptext The name for the keys are “tf”, “it”, “sl”, “bf”, “bi”, “bs” and “sc”. The values for the keys can be a font change with the methods mentioned above where the method and argument are separated by a colon. When you want to apply a feature use the “features” method. Wolfgang