Hagen - Pragma ADE
Hagen - Pragma ADE Hagen - Pragma ADE
56 Features of all, all we get to see is a Lua table, and in ConT E Xt even that one gets sanitized and optimized into a more useable table. However, as the data that comes with a font is a good indication of what a font is capable of, we will discuss some of it in an appendix. In this section we will discuss the basic principles and categories of features. 5.2.2 Feature sets Because in the next examples we will demonstrate features, we need to know how we can tell ConT E Xt what features to use. Although you can add explicit feature definitions to a font specification, I strongly advice you not to do this but use the more abstract mechanism of feature sets. These are defined as follows: \definefontfeature [MyFeatureSet] [alpha=yes, beta=no, gamma=123] Such a set is bound to a font with the * specifier, as in: \definefont [MyFontInstance] [MyNiceFont*MyFeatureSet at 12pt] In most cases the already defined default feature set will suffice. It often makes sense to use that one as base for new definitions: \definefontfeature [MyFeatureSet] [default] [alpha=yes, beta=no, gamma=123] The second argument can be a list, as in: \definefontfeature [MyFeatureSet] [MyFirstSet,MySecondSet] [alpha=yes, beta=no, gamma=123] Of course you need to know what features a font support, and one way to find out is: mtxrun --script font --list --info --pattern=pagella
Don’t be too surprised if different fonts show different features and even similar features can be implemented differently. Sometimes you really need to know the font, but fortunately many fonts come with examples. 5.2.3 Main categories There are two (but potentially more) main groups of features: those that deal with substitution, and those that lead to positioning. It is not really needed to know the gory details, but it helps to know at least a bit about them as it can help to track down issues with fonts. There are several substitutions possible: • a single substitution replaces one glyph by another • a multiple substitution replaces one glyph by one or more • a ligature substitution replaces multiple glyphs by one glyph • an alternate substitution replaces one glyph by one out of a set Like it or not, but these categories are not always used as intended: they just are a way of replacing one or more glyphs by one or more other glyphs. This means that when for instance ij gets replaced by one glyph (given that the font supports it) a ligature substitution is used, even when in fact we have to do with a diftong that can be represented by one character. No matter what features you will use, keep in mind that they are nothing more than a combination of substitutions and positioning directives. So, the de facto standard ligature building feature liga indeed uses a ligature substitution, but other features with names that resemble no ligatures might use this substitution as well. An example of a single substitution is an oldstyle (onum) although it can as well be implemented as a choice out of alternate glyphs. Another example is smallcaps (smcp). Nowdays these are more or less standard features for a grown up font, while in the past they came as separate fonts. So, instead of loading an extra font, one sticks to one and selects the feature that does the substitution. A second category concerns relative positioning. Again we have several variants: • a single positioning moves a glyph over one of two axis and can change the width and/or height • a pair positioning also moved glyphs but concerns two adjacent glyphs • a cursive positioning operates on a range of glyphs and is used to visually connect them In addition there are three ways to anchor marks onto glyphs: • a mark can be anchored on a base glyph • a mark can be anchored on a specific (visual) component of a ligature • a mark can be anchored on another mark In base mode the single, alternate and ligature substitutions can rather easily be mapped onto the traditional T E X font handling mechanism and this is what happens 57 Features
- Page 8 and 9: 6 Introduction In this manual we wi
- Page 10 and 11: 8 Font formats a b g l q . ; ? ffi
- Page 12 and 13: 10 Font formats When T E X ships ou
- Page 14 and 15: 12 A.4 A.3 Font formats multiple ac
- Page 16 and 17: 14 Font formats can be rules that t
- Page 18 and 19: 16 Font formats /fonts/tfm/vendor/t
- Page 20 and 21: 18 Modes raw tfm normalized tfm raw
- Page 22 and 23: 20 Modes shown next: kern cyrl dflt
- Page 24 and 25: 22 Modes ccmp cyrl mkd абвгде
- Page 26 and 27: 24 Modes dlig latn gag abcdefghijkl
- Page 28 and 29: 26 Modes liga latn nsm abcdefghijkl
- Page 30 and 31: 28 Modes salt latn mol abcdefghijkl
- Page 32 and 33: 30 Modes glyph 256 font 42: U+00074
- Page 34 and 35: 32 Modes glyph 256 font 33: U+00061
- Page 36 and 37: 34 Modes glyph 256 font 33: U+00065
- Page 38 and 39: 36 Modes optimizer that can apply a
- Page 40 and 41: 38 Modes ا خLJَ﮲ ف﮲َ step
- Page 42 and 43: 40 Modes dir +TRT glyph 256 font 49
- Page 44 and 45: 42 Modes and now we get: 123 normal
- Page 46 and 47: 44 Modes MkIV run can be faster tha
- Page 48 and 49: 46 Lookups \font \MyFontG = lmr12 s
- Page 50 and 51: 48 Lookups 3.4 Name Say that we wan
- Page 52 and 53: 50 Lookups We add another specifier
- Page 54 and 55: 52 Methods \definefont [MyFont] [Bo
- Page 56 and 57: 54 Methods } copyright = "ConTeXt d
- Page 60 and 61: 58 Features in base mode. A single
- Page 62 and 63: 60 Features accumulate within a wor
- Page 64 and 65: 62 Features features analyze=yes, c
- Page 66 and 67: 64 Features \definedfont[lmroman10-
- Page 68 and 69: 66 Features single substitutions or
- Page 70 and 71: 68 F -0.492 eatures result ffi feat
- Page 72 and 73: 70 Features font 80: lmroman10-regu
- Page 74 and 75: 72 Features font 46: cambria.ttf @
- Page 76 and 77: 74 Features } } This goodie file is
- Page 78 and 79: 76 Features { name = "msbm10.tfm",
- Page 80 and 81: 78 Features \starttypescript[somefo
- Page 82 and 83: 80 Features \setupbodyfont [mojcasf
- Page 84 and 85: 82 Features } normalweight = "extra
- Page 86 and 87: 84 Features "QF.waqf", "SKTH.waqf",
- Page 88 and 89: 86 Features featureset=smallcaps] O
- Page 90 and 91: 88 Features } }, When defining the
- Page 92 and 93: 90 Features local defaultfraction =
- Page 94 and 95: 92 Features } } ["LMRoman-Bold"] =
- Page 96 and 97: 94 Features In fact, in addition to
- Page 98 and 99: 96 Features } This time the applica
- Page 100 and 101: 98 Features step 1 I don't wanna kn
- Page 102 and 103: 100 Features If you’re lucky your
- Page 104 and 105: 102 Scripts
Don’t be too surprised if different fonts show different features and even similar features<br />
can be implemented differently. Sometimes you really need to know the font, but<br />
fortunately many fonts come with examples.<br />
5.2.3 Main categories<br />
There are two (but potentially more) main groups of features: those that deal with substitution,<br />
and those that lead to positioning. It is not really needed to know the gory<br />
details, but it helps to know at least a bit about them as it can help to track down issues<br />
with fonts.<br />
There are several substitutions possible:<br />
• a single substitution replaces one glyph by another<br />
• a multiple substitution replaces one glyph by one or more<br />
• a ligature substitution replaces multiple glyphs by one glyph<br />
• an alternate substitution replaces one glyph by one out of a set<br />
Like it or not, but these categories are not always used as intended: they just are<br />
a way of replacing one or more glyphs by one or more other glyphs. This means that<br />
when for instance ij gets replaced by one glyph (given that the font supports it) a ligature<br />
substitution is used, even when in fact we have to do with a diftong that can be<br />
represented by one character.<br />
No matter what features you will use, keep in mind that they are nothing more than<br />
a combination of substitutions and positioning directives. So, the de facto standard<br />
ligature building feature liga indeed uses a ligature substitution, but other features<br />
with names that resemble no ligatures might use this substitution as well.<br />
An example of a single substitution is an oldstyle (onum) although it can as well be<br />
implemented as a choice out of alternate glyphs. Another example is smallcaps (smcp).<br />
Nowdays these are more or less standard features for a grown up font, while in the past<br />
they came as separate fonts. So, instead of loading an extra font, one sticks to one and<br />
selects the feature that does the substitution.<br />
A second category concerns relative positioning. Again we have several variants:<br />
• a single positioning moves a glyph over one of two axis and can change the width<br />
and/or height<br />
• a pair positioning also moved glyphs but concerns two adjacent glyphs<br />
• a cursive positioning operates on a range of glyphs and is used to visually connect<br />
them<br />
In addition there are three ways to anchor marks onto glyphs:<br />
• a mark can be anchored on a base glyph<br />
• a mark can be anchored on a specific (visual) component of a ligature<br />
• a mark can be anchored on another mark<br />
In base mode the single, alternate and ligature substitutions can rather easily be<br />
mapped onto the traditional T E X font handling mechanism and this is what happens<br />
57<br />
Features