Changes

Jump to navigation Jump to search
44 bytes removed ,  19:41, 21 March 2013
no edit summary
= Features in general =
In MkIV there are two kinds of font feature directly visible to the user: ''meta-featurefeatureset'' and ''open-type feature''.
== Open-type features ==
The open-type features are specified in the font and are composed of individual "lookups" which specify each substitution and positioning action to be performed in the processing. These open-type features are plugged in and out of the "stack" of lookups to be processed in the MkIV open type handler. These features are represented by a 4-character name (<i>onum</i>, <i>smcp</i>, etc.) and in MkIV are associated with a keyval that turns it on ("yes") or off ("no"). For example, '[onum=yes]'. Here the key 'yes' means "include open-type feature ''onum'' into the processed stack"; the key 'no' means "do not include open-type feature ''onum'' in the processed stack".
== Meta-features Featuresets ==
A meta-feature featureset is a composed of a set of open-type features. Meta-features Featuresets are specified using <cmd>\definefontfeature</cmd>. For each given body font in the typeface we specify the ''global'' default set of <i>open-type</i> features to be used for that font. This is usually done in the preamble to our document, an environment file, or a typescript file, or the like.
For example, using TeX-Gyre Schola we can specify the following default, global set open-type features in the preamble:
All other open-type features in the font are not included in the processing.
Now when we want to change the default, we use <cmd>\definefontfeature</cmd> to specify local meta-featuresfeaturesets. The command <cmd>feature</cmd> and its siblings is then used to control the action of those meta-featuresfeaturesets. Here are the commands:
<texcode>
= Sample file with examples =
Let us now go through a complete sample file with examples. Let us first define our global default meta-feature featureset and activate it with a typescript:
<texcode>
In the above note that we start with just a global, default feature set of kerns, ligatures, and line numerals.
Now when we want to change the default, we use <cmd>\definefontfeature</cmd> to specify meta-featuresfeaturesets. The command <cmd>feature</cmd> and its siblings is then used to control the action of those meta-featuresfeaturesets.
At this stage which open-type feature is being plugged into or unplugged from the stack is invisible to the user. We just speak in terms of meta-featuresfeaturesets. TeX-Gyre Schola has a decent set of open-type features. Using a few of them, let us set up a few meta-featuresfeaturesets:
<texcode>
</texcode>
Above, all of our meta-features featuresets are mapped to open-type features that plug into the stack.
<texcode>
</texcode>
Of course, a meta-feature featureset set can include more than one open-type feature. In advanced applications this will be the norm:
<texcode>
</texcode>
NOTE: In this case we have to specify 'lnum=no' because it is already defined in our default feature set in the preamble etc. Depending on the The order of lookups in the font one has to watch out for thisitself could conceivably have an impact as well.
<texcode>
</texcode>
Above, each meta-feature featureset is mapped to an open-type feature set that plugs into or unplugs from the stack. But we can mix things up:
<texcode>
</texcode>
The above two illustrate the point that meta-features featuresets hide from the user which actual open-type features are being plugged into or unplugged from the stack.
Now let's put some of the above meta-features featuresets in action. Note the use of synonyms in both the activated code and in the comments:
<texcode>
% \resetandaddfeature[!][f:noligatures] \SAMPLE \blank
% Let's revive one of the old meta-featuresfeaturesets
\feature[>][f:upsidedown] \SAMPLE \blank
<texcode>
\addff{<metafeature>featureset} % Add absolute font-feature set -- replaces default set\subff{<metafeature>featureset} % Subtract absolute font-feature set -- replaces default set\addfs{<metafeature>featureset} % Add font-feature set on top of current stack\subfs{<metafeature>featureset} % Subtract font-feature set from current stack
</texcode>
67

edits

Navigation menu