Changes

Jump to navigation Jump to search
2,142 bytes added ,  13:57, 14 March 2021
m
no edit summary
== 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]' turns on the lookup substitutions in the font which replace a line numeral with an oldstyle one. 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".  === Adding features on the fly === Sometimes you want to provisionally add OpenType features to a font. There are at least three ways to do this.# Use a low-level `font.handlers.otf.addfeature` callback function to define new OTF features. See Section 8.14 of [https://www.pragma-ade.com/general/manuals/fonts-mkiv.pdf fonts-mkiv manual] for details of the syntax, or refer to the examples [http://minimals.metatex.org/current/context/test/doc/context/tests/mkiv/fonts/extensions-001.tex here].# Define the new features in an `lfg` "goodies" file and load it with the `goodies` key. See [http://minimals.metatex.org/current/context/test/doc/context/tests/mkiv/fonts/greek-001.tex this example] with the corresponding [http://minimals.metatex.org/current/context/test/doc/context/tests/mkiv/fonts/oxoniensis.lfg lfg] file.# Use a feature file (in the `fea` format) and load it with the `featurefile` key. See [[Fontfeaturefiles]]. === Debugging features === For an OpenType to work properly, all the relevant glyphs must come from the same font (either the original font or one of the fallbacks). For example, the font [https://github.com/aminabedi68/Mikhak/tree/master/Font/ttf Mikhak] now misses glyphs for en dash and em dash, hence the `tlig` feature does not work to automatically change double or triple dashes to en and em dashes. This would not work even if we added fallbacks for those two characters. However, if we also create a fallback for the dash character, then this will work. <texcode>\starttext \definefontfallback[myfallback][dejavuserif*default][0x02d,0x2013,0x2014][check=yes,force=yes] \definefontsynonym[mytestfont][file:Mikhak-Medium.ttf][fallbacks=myfallback] \definedfont[mytestfont*arabic] foo--ofo---oof [\char"002D] [\char"2013] [\char"2014] \stoptext</texcode>  OpenType features can be complicated to understand or debug. One useful command to see how they are working is {{cmd|showotfcomposition}}. <texcode>\starttext% -1 for the second argument means RTL. Leave it out for LTR text.\showotfcomposition{mikhak-medium*arabic}{-1}{سلام علیکم}\stoptext</texcode> 
== Featuresets ==
25

edits

Navigation menu