font-afk.lua /size: 6848 b    last modification: 2023-12-21 09:44
1if not modules then modules = { } end modules ['font-afk'] = {
2    version   = 1.001,
3    comment   = "companion to font-lib.mkiv",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files",
7    dataonly  = true,
8}
9
10-- For ligatures, only characters with a code smaller than 128 make sense, anything
11-- larger is encoding dependent. An interesting complication is that a character can
12-- be in an encoding twice but is hashed once.
13
14local allocate = utilities.storage.allocate
15
16fonts.handlers.afm.helpdata = {
17    ligatures = allocate { -- okay, nowadays we could parse the name but type 1 fonts
18        ['f'] = { -- don't have that many ligatures anyway
19            { 'f', 'ff' },
20            { 'i', 'fi' },
21            { 'l', 'fl' },
22        },
23        ['ff'] = {
24            { 'i', 'ffi' }
25        },
26        ['fi'] = {
27            { 'i', 'fii' }
28        },
29        ['fl'] = {
30            { 'i', 'fli' }
31        },
32        ['s'] = {
33            { 't', 'st' }
34        },
35        ['i'] = {
36            { 'j', 'ij' }
37        },
38    },
39    texligatures = allocate {
40     -- ['space'] = {
41     --     { 'L', 'Lslash' },
42     --     { 'l', 'lslash' }
43     -- },
44     -- ['question'] = {
45     --     { 'quoteleft', 'questiondown' }
46     -- },
47     -- ['exclam'] = {
48     --     { 'quoteleft', 'exclamdown' }
49     -- },
50        ['quoteleft'] = {
51            { 'quoteleft', 'quotedblleft' }
52        },
53        ['quoteright'] = {
54            { 'quoteright', 'quotedblright' }
55        },
56        ['hyphen'] = {
57            { 'hyphen', 'endash' }
58        },
59        ['endash'] = {
60            { 'hyphen', 'emdash' }
61        }
62    },
63    leftkerned = allocate {
64        AEligature = "A",  aeligature = "a",
65        OEligature = "O",  oeligature = "o",
66        IJligature = "I",  ijligature = "i",
67        AE         = "A",  ae         = "a",
68        OE         = "O",  oe         = "o",
69        IJ         = "I",  ij         = "i",
70        Ssharp     = "S",  ssharp     = "s",
71    },
72    rightkerned = allocate {
73        AEligature = "E",  aeligature = "e",
74        OEligature = "E",  oeligature = "e",
75        IJligature = "J",  ijligature = "j",
76        AE         = "E",  ae         = "e",
77        OE         = "E",  oe         = "e",
78        IJ         = "J",  ij         = "j",
79        Ssharp     = "S",  ssharp     = "s",
80    },
81    bothkerned = allocate {
82        Acircumflex = "A",  acircumflex = "a",
83        Ccircumflex = "C",  ccircumflex = "c",
84        Ecircumflex = "E",  ecircumflex = "e",
85        Gcircumflex = "G",  gcircumflex = "g",
86        Hcircumflex = "H",  hcircumflex = "h",
87        Icircumflex = "I",  icircumflex = "i",
88        Jcircumflex = "J",  jcircumflex = "j",
89        Ocircumflex = "O",  ocircumflex = "o",
90        Scircumflex = "S",  scircumflex = "s",
91        Ucircumflex = "U",  ucircumflex = "u",
92        Wcircumflex = "W",  wcircumflex = "w",
93        Ycircumflex = "Y",  ycircumflex = "y",
94
95        Agrave = "A",  agrave = "a",
96        Egrave = "E",  egrave = "e",
97        Igrave = "I",  igrave = "i",
98        Ograve = "O",  ograve = "o",
99        Ugrave = "U",  ugrave = "u",
100        Ygrave = "Y",  ygrave = "y",
101
102        Atilde = "A",  atilde = "a",
103        Itilde = "I",  itilde = "i",
104        Otilde = "O",  otilde = "o",
105        Utilde = "U",  utilde = "u",
106        Ntilde = "N",  ntilde = "n",
107
108        Adiaeresis = "A",  adiaeresis = "a",  Adieresis = "A",  adieresis = "a",
109        Ediaeresis = "E",  ediaeresis = "e",  Edieresis = "E",  edieresis = "e",
110        Idiaeresis = "I",  idiaeresis = "i",  Idieresis = "I",  idieresis = "i",
111        Odiaeresis = "O",  odiaeresis = "o",  Odieresis = "O",  odieresis = "o",
112        Udiaeresis = "U",  udiaeresis = "u",  Udieresis = "U",  udieresis = "u",
113        Ydiaeresis = "Y",  ydiaeresis = "y",  Ydieresis = "Y",  ydieresis = "y",
114
115        Aacute = "A",  aacute = "a",
116        Cacute = "C",  cacute = "c",
117        Eacute = "E",  eacute = "e",
118        Iacute = "I",  iacute = "i",
119        Lacute = "L",  lacute = "l",
120        Nacute = "N",  nacute = "n",
121        Oacute = "O",  oacute = "o",
122        Racute = "R",  racute = "r",
123        Sacute = "S",  sacute = "s",
124        Uacute = "U",  uacute = "u",
125        Yacute = "Y",  yacute = "y",
126        Zacute = "Z",  zacute = "z",
127
128        Dstroke = "D",  dstroke = "d",
129        Hstroke = "H",  hstroke = "h",
130        Tstroke = "T",  tstroke = "t",
131
132        Cdotaccent = "C",  cdotaccent = "c",
133        Edotaccent = "E",  edotaccent = "e",
134        Gdotaccent = "G",  gdotaccent = "g",
135        Idotaccent = "I",  idotaccent = "i",
136        Zdotaccent = "Z",  zdotaccent = "z",
137
138        Amacron = "A",  amacron = "a",
139        Emacron = "E",  emacron = "e",
140        Imacron = "I",  imacron = "i",
141        Omacron = "O",  omacron = "o",
142        Umacron = "U",  umacron = "u",
143
144        Ccedilla = "C",  ccedilla = "c",
145        Kcedilla = "K",  kcedilla = "k",
146        Lcedilla = "L",  lcedilla = "l",
147        Ncedilla = "N",  ncedilla = "n",
148        Rcedilla = "R",  rcedilla = "r",
149        Scedilla = "S",  scedilla = "s",
150        Tcedilla = "T",  tcedilla = "t",
151
152        Ohungarumlaut = "O",  ohungarumlaut = "o",
153        Uhungarumlaut = "U",  uhungarumlaut = "u",
154
155        Aogonek = "A",  aogonek = "a",
156        Eogonek = "E",  eogonek = "e",
157        Iogonek = "I",  iogonek = "i",
158        Uogonek = "U",  uogonek = "u",
159
160        Aring = "A",  aring = "a",
161        Uring = "U",  uring = "u",
162
163        Abreve = "A",  abreve = "a",
164        Ebreve = "E",  ebreve = "e",
165        Gbreve = "G",  gbreve = "g",
166        Ibreve = "I",  ibreve = "i",
167        Obreve = "O",  obreve = "o",
168        Ubreve = "U",  ubreve = "u",
169
170        Ccaron = "C",  ccaron = "c",
171        Dcaron = "D",  dcaron = "d",
172        Ecaron = "E",  ecaron = "e",
173        Lcaron = "L",  lcaron = "l",
174        Ncaron = "N",  ncaron = "n",
175        Rcaron = "R",  rcaron = "r",
176        Scaron = "S",  scaron = "s",
177        Tcaron = "T",  tcaron = "t",
178        Zcaron = "Z",  zcaron = "z",
179
180        dotlessI = "I",  dotlessi = "i",
181        dotlessJ = "J",  dotlessj = "j",
182
183        AEligature = "AE",  aeligature = "ae",  AE         = "AE",  ae         = "ae",
184        OEligature = "OE",  oeligature = "oe",  OE         = "OE",  oe         = "oe",
185        IJligature = "IJ",  ijligature = "ij",  IJ         = "IJ",  ij         = "ij",
186
187        Lstroke    = "L",   lstroke    = "l",   Lslash     = "L",   lslash     = "l",
188        Ostroke    = "O",   ostroke    = "o",   Oslash     = "O",   oslash     = "o",
189
190        Ssharp     = "SS",  ssharp     = "ss",
191
192        Aumlaut = "A",  aumlaut = "a",
193        Eumlaut = "E",  eumlaut = "e",
194        Iumlaut = "I",  iumlaut = "i",
195        Oumlaut = "O",  oumlaut = "o",
196        Uumlaut = "U",  uumlaut = "u",
197    }
198}
199