summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/context/manuals/reference/en/co-fonts.tex
blob: 13af078175a83312ff1418e073e9d36ab2a82661 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
\startcomponent co-fonts
% we assume that there are fontfiles demofont.afm/pfb
%
% runtools mfonts.rb

% \loadmapfile[texnansi-test-test.map]

\environment contextref-env
\product contextref

% some typescript examples

\startbuffer[funny]
\definetypeface [funny] [rm] [serif] [palatino] [default] [encoding=texnansi]
\definetypeface [funny] [ss] [sans]  [palatino] [default] [encoding=texnansi]
\definetypeface [funny] [tt] [mono]  [palatino] [default] [encoding=texnansi]
\definetypeface [funny] [mm] [math]  [palatino] [default] [encoding=texnansi]
\stopbuffer

\startbuffer[joke]
\definetypeface [joke] [rm] [serif] [times]     [default] [encoding=texnansi]
\definetypeface [joke] [ss] [sans]  [helvetica] [default] [rscale=0.9,
                                                           encoding=texnansi]
\definetypeface [joke] [tt] [mono]  [courier]   [default] [rscale=1.1,
                                                           encoding=texnansi]
\definetypeface [joke] [mm] [math]  [times]     [default] [encoding=texnansi]
\stopbuffer

\startbuffer[nojoke]
\definetypeface [nojoke] [rm] [serif] [times]     [default] [encoding=texnansi]
\definetypeface [nojoke] [ss] [sans]  [helvetica] [default] [encoding=texnansi]
\definetypeface [nojoke] [tt] [mono]  [courier]   [default] [encoding=texnansi]
\definetypeface [nojoke] [mm] [math]  [times]     [default] [encoding=texnansi]
\stopbuffer

\startbuffer[whow]
\definetypeface [whow] [rm] [serif] [modern] [latin-modern] [encoding=ec]
\definetypeface [whow] [ss] [sans]  [modern] [latin-modern] [encoding=ec]
\definetypeface [whow] [tt] [mono]  [modern] [latin-modern] [encoding=ec]
\definetypeface [whow] [mm] [math]  [modern] [latin-modern] [encoding=ec]
\stopbuffer

\getbuffer[funny,nojoke,joke,whow]

\chapter[fonts]{Fonts}
\index{font+definition}
\section{Introduction}
\index{fonts}

This chapter will cover the details of defining fonts and collections of fonts, and it
will explain how to go about installing fonts in both \MKII\ and \MKIV. It helps if
you know what a font is, and are familiar with the \CONTEXT\ font switching macros.

The original \CONTEXT\ font model was based on plain \TEX, but evolved into a more
extensive one primarily aimed at consistently typesetting \PRAGMA's educational
documents. The fact that pseudo caps had to be typeset in any font shape in the
running text as well as superscripts, has clearly determined the design. The font
model has been relatively stable since 1995.

Currently there are three layers of font definitions:

\startitemize

\item  simple font definitions: such definitions provide
       \type {\named} access to a specific font in a
       predefined size

\item  body font definitions: these result in a coherent
       set of fonts, often from a same type foundry or 
       designer, that can be used intermixed as a \quote{style}

\item  typescript definitions: these package serif, sans serif,
       mono spaced and math and other styles in such a way
       that you can conveniently switch between different
       combinations

\stopitemize

These three mechanisms are actually build on top of each
other and all rely on a low level mapping mechanism
that is responsible for resolving the real font file name
and the specific font encoding used.

When \TEX\ users install one of the \TEX\ distributions, like \TEX-live,
automatically a lot of fonts will be installed on their system.
Unfortunately it is not that easy to get a clear picture of what fonts
are there and what is needed to use them.  And although the \type {texmf}
tree is prepared for commercial fonts, adding newly bought fonts is not
trivial. To compensate this, \CONTEXT\ \MKII\ comes with
\type{texfont.pl}, a program that can install fonts for you. And if the
global setup is done correctly, \MKIV\ and \XETEX\ can use the fonts
installed in your operation system without the need for extra
installation work.

\section {Font files and synonyms}
\macro{\tex{definefontsynonym}}
\macro{\tex{setupfontsynonym}}


In \CONTEXT, whenever possible you should define symbolic names for fonts.
The mapping from such symbolic names onto real font names can be done such
that it takes place unnoticed by the user. This is good, since the name can
depend on the encoding, in which case the name is obscure and hard to
remember. The trick is knowing how to use the \type{\definefontsynonym}
command.

\placefloat[][]{none}{\showsetup{definefontsynonym}}

The first argument is the synonym that is being defined or redefined. This
synonym should be something simpler than the original name that's easier to
use. Redefinition is not only allowed but often very useful. The second
argument is the replacement of the synonym.  This replacement can be a real
font name, but it can also be another synonym.  The optional third argument
can be used for to specify font settings.

There is no limit on the number of synonyms that can chained together, but the
last one in the chain has to be a valid font name. \CONTEXT\ knows it has
reached the bottom level when there is no longer any replacement possible.

Font settings actually take place at the bottom level, since they are
closely related to specific instances of fonts. Any settings that are
defined higher up in the chain percolate down, unless they are already
defined at the lower level.

\startbuffer[synonymargs]
\vskip 1ex
\starttabulate[|lT|p|]
\NC encoding \NC The font file encoding for \TFM-based (\MKII) fonts.\NC \NR
\NC handling \NC The font handling for \MKII\ (see  previous chapter).\NC \NR
\NC features \NC The font handling for \MKIV\ and \XETEX\ (see previous chapter).\NC \NR
\NC mapping  \NC letter case change mapping for \MKII\ that may be used in special
                 cases; never actually used in the \CONTEXT\ core. 
                 See~\in{chapter}[languages] on languages for details.\NC \NR
\stoptabulate
\vskip 1ex
\stopbuffer

\getbuffer[synonymargs]

Here is an example of the use of font synonyms:

\startexample
\starttyping
\definefontsynonym [Palatino] [uplr8t]   [encoding=ec]
\stoptyping
\stopexample

In this example, the argumnet \type{uplr8t} is the real font (the actual
file name is \type{uplr8t.tfm}, but file extensions are normally
omitted), and it contains the metrics for the Type~1 font URW Palladio L
in EC encoding.  From now on, the name \type{Palatino} can be used in
further font definitions to identify this font, instead of the
dreadfully low||level (and hard to remember) name \type{uplr8t} and its
accompanying encoding.

\subsection{Font names}

In \PDFTEX, the real font is the name of the \TEX\ metrics file, minus the
extension, as we saw already. In \XETEX\ and \MKIV\ a font name is a bit more
complex, because in both cases OpenType fonts can be accessed directly by
their official font name (but with any embedded spaces stripped out) as well
as via the disk file name.

In these two systems, \CONTEXT\ first attempts to find the font using the
official font name. If that doesn't work, then it tries to use the font by
file name as a fallback. Since this is not very efficient and also because
it may generate (harmless, but alarming looking) warnings, it is possible to
force \CONTEXT\ into one or the other mode by using a prefix, so you will
most often see synonym definitions like this:

\startexample
\starttyping
\definefontsynonym [MSTimes]       [name:TimesNewRoman] [features=default]
\definefontsynonym [Iwona-Regular] [file:Iwona-Regular] [features=default]
\stoptyping
\stopexample

In \XETEX, the \type{file} prefix implies that \XETEX\ will search for an
OpenType font (with extension \type{otf} or \type{ttf}) and if that fails
it will try to find a \TEX\ font (with extension \type{tfm}). In \MKIV, the
list is a little longer: OpenType (\type{otf}, \type{ttf}), Type~1
(\type{afm}), \OMEGA\ (\type{ofm}), and finally \TEX\ (\type{tfm}).

The use of aliases to hide the complexity of true font names is already
very useful, but \CONTEXT\ goes further than that.  An extra synonym level
is normally defined that attaches this font name to a generic name like
\type{Serif} or \type{Sans}.

\startexample
\starttyping
\definefontsynonym [Serif] [Palatino]
\stoptyping
\stopexample

An important advantage of using names like \type {Serif} in macro and
style definitions is that it can easily be remapped onto a completely
different font than \type{Palatino}. This is often useful when you are
experimenting with a new environment file for a book or when you are
writing a \CONTEXT\ module.

In fact, inside an environment file it is useful to go even further and
define new symbolic names that map onto \type {Serif}.

\starttyping
\definefontsynonym [TitleFont] [Serif]
\stoptyping

By using symbolic names in the main document and in style and macro
definitions, you can make them independent of a particular font and let
them adapt automatically to the main document fonts. That is of course
assuming these are indeed defined in terms of \type{Serif}, \type{Sans},
etcetera. All the \CONTEXT\ predefined typescripts are set up this way, and
you are very much encouraged to stick to the same logic for your own font
definitions as well.

The list of \quote{standard} symbolic names is given
in~\in{table}[tab:symbolic font names]

\startbuffer[symfontnames]
\vskip 1ex
\starttabulate[|lT|lT|l|]
\NC \rm\bf name          \NC \rm \bf style, alternative \NC \rm \bf explanation \NC \NR
\NC Blackboard           \NC --       \NC Used by the \type{\bbd}  macro \NC \NR
\NC Calligraphic         \NC --       \NC Used by the \type{\cal}  macro \NC \NR
\NC Fraktur              \NC --       \NC Used by the \type{\frak} macro \NC \NR
\NC Gothic               \NC --       \NC Used by the \type{\goth} macro \NC \NR
\NC OldStyle             \NC --       \NC Used by the \type{\os} macro   \NC \NR
\NC MPtxtfont            \NC --       \NC The default font for \METAPOST \NC \NR
\NC Calligraphy          \NC cg,tf    \NC \NC \NR
\NC Handwriting          \NC hw,tf    \NC \NC \NR
\NC MathRoman(Bold)      \NC mm,mr(bf)\NC \NC \NR
\NC MathItalic(Bold)     \NC mm,mi(bf)\NC \NC \NR
\NC MathSymbol(Bold)     \NC mm,sy(bf)\NC \NC \NR
\NC MathExtension(Bold)  \NC mm,ex(bf)\NC \NC \NR
\NC MathAlpha(Bold)      \NC mm,ma(bf)\NC \NC \NR
\NC MathBeta(Bold)       \NC mm,mb(bf)\NC \NC \NR
\NC MathGamma(Bold)      \NC mm,mc(bf)\NC \NC \NR
\NC MathDelta(Bold)      \NC mm,md(bf)\NC \NC \NR
\NC Mono                 \NC tt,tf    \NC \NC \NR
\NC MonoBold             \NC tt,bf    \NC \NC \NR
\NC MonoItalic           \NC tt,it    \NC \NC \NR
\NC MonoBoldItalic       \NC tt,bi    \NC \NC \NR
\NC MonoSlanted          \NC tt,sl    \NC \NC \NR
\NC MonoBoldSlanted      \NC tt,bs    \NC \NC \NR
\NC MonoCaps             \NC tt,sc    \NC \NC \NR
\NC Sans                 \NC ss,tf    \NC \NC \NR
\NC SansBold             \NC ss,bf    \NC \NC \NR
\NC SansItalic           \NC ss,it    \NC \NC \NR
\NC SansBoldItalic       \NC ss,bi    \NC \NC \NR
\NC SansSlanted          \NC ss,sl    \NC \NC \NR
\NC SansBoldSlanted      \NC ss,bs    \NC \NC \NR
\NC SansCaps             \NC ss,sc    \NC \NC \NR
\NC Serif                \NC rm,tf    \NC \NC \NR
\NC SerifBold            \NC rm,bf    \NC \NC \NR
\NC SerifItalic          \NC rm,it    \NC \NC \NR
\NC SerifBoldItalic      \NC rm,bi    \NC \NC \NR
\NC SerifSlanted         \NC rm,sl    \NC \NC \NR
\NC SerifBoldSlanted     \NC rm,bs    \NC \NC \NR
\NC SerifCaps            \NC rm,sc    \NC \NC \NR
\stoptabulate
\vskip 1ex
\stopbuffer

%this table almost takes up a page, so we should give it one to itself
\placetable
  [page]
  [tab:symbolic font names]
  {Standard symbolic font names, and the style||alternative pair they belong to.}
  {\getbuffer[symfontnames]}

\subsection{Adjusting font settings}

As mentioned earlier, the items in the third argument of
\type{\definefontsynonym} percolate down the chain of
synonyms. Occasionally, you may want to splice some settings into that
chain, and that is where \type{\setupfontsynonym} comes in handy. 

\showsetup{setupfontsynonym}

For example, the predefined \MKII\ typescripts for font handling that we saw in
the previous chapter contain a sequence of commands like this:

\startexample
\starttyping
\setupfontsynonym [Serif]       [handling=pure]
\setupfontsynonym [SerifBold]   [handling=pure]
\setupfontsynonym [SerifItalic] [handling=pure]
...
\stoptyping
\stopexample

The first line means \quote{adjust the \type{handling} setting of only the
  \type{Serif} font to \type{pure}}. Any font lower down in the synonym chain
won't receive this setting. Another example might be setting a font variant
for {\sc small caps}:

\startexample
\starttyping
\setupfontsynonym [SerifSmallCaps]       [features=smallcaps]
\stoptyping
\stopexample

\section {Simple font definitions}
\macro{\tex{definefont}}
\macro{\tex{definedfont}}

The most simple font definition takes place with \type {\definefont}. 

\showsetup{definefont}

This macro defines a font with the same name as the first argument and
you can use its name as an identifier to select that font. The second
argument works in the same way as the second argument to
\type{\definefontsynonym}: you can use either a font synonym or a real
font. There is an optional third argument that can be either a bare
number like \type{1.5 }, or a named setup
(see~\in{section}[sec:setups]). In case of a bare number, that is a local
setting for the interline space. In case of a setup, that setup can do
whatever it wants.

\startbuffer [dingbat]
\loadmapfile [koeieletters]
\definefont  [ContextLogo] [koeielogos at 72pt]
\ContextLogo \char 2
\stopbuffer

For instance:

\startexample
\typebuffer[dingbat]
\stopexample

will result in 

\startreality
\getbuffer[dingbat]
\stopreality

If you want a fixed size font like in the example above, you can define a
font using the primitive \TEX\ \type {at} or \type {scaled} modifiers.

Be warned that \type {at} is often useful, but \type {scaled} is somewhat
unreliable since it scales the font related to its internal design size,
and that is often unknown.  Depending on the design size is especially
dangerous when you use symbolic names, since different fonts have
different design sizes, and designers differ in their ideas about what a
design size is. Compare for instance the 10pt instance of a Computer
Modern Roman with Lucida Bright (which more looks like a 12pt then).

\starttyping
\definefont [TitleFont] [Serif scaled 2400]
\stoptyping

Hardcoded sizes can be useful in many situations, but they can be
annoying when you want to define fonts in such a way that their
definitions adapt themselves to their surroundings.  That is why
\CONTEXT\ provides an additional way of scaling:

\starttyping
\definefont [TitleFont] [Serif sa 2.4]
\stoptyping

The \type {sa} directive means as much as \quote {scaled at
the body font size}. Therefore this definition will lead to
a 24pt scaling when the (document) body font size equals
10pt. Because the definition has a lazy nature, the font
size will adapt itself to the current body font size.

There is an extra benefit to using \type{sa} instead of \type{at}.
Instead of a numeric multiplier, you can also use the identifiers that
were defined in the body font environment that specified the related
dimensions. For example, this scales the font to the \type {b} size,
being 1.440 by default:

\starttyping
\definefont [TitleFont] [Serif sa b]
\stoptyping

In fact, if you use a bare name like in 

\starttyping
\definefont [TitleFont] [Serif]
\stoptyping

it will internally be converted to

\starttyping
\definefont [TitleFont] [Serif sa *]
\stoptyping

which in turn expands into the current actual font size, after the
application of size corrections for super|| and subscripts etc. 

For example

\startbuffer[saex]
\definefont [TitleFont] [Sans]
{\TitleFont test} and {\tfc \TitleFont test}
\stopbuffer

\startexample
\typebuffer[saex]
\stopexample

gives

\startreality
\getbuffer[saex]
\stopreality

A specialized alternative to \type {sa} that is sometimes useful is \type
{mo}. Here the size maps onto to body font size only after it has passed
through an optional size remapping. Such remappings are defined by the
macro \type{\mapfontsize}:

\showsetup{mapfontsize}

Such remapping before applying scaling is sometimes handy for math fonts,
where you may want to use slightly different sizes than the ones given in
the body font environment. In the \CONTEXT\ distribution, this happens
only with the Math Times fonts, where the predefined typescript contains
the following lines:

\starttyping
\mapfontsize [5pt]    [6.0pt]
\mapfontsize [6pt]    [6.8pt]
\mapfontsize [7pt]    [7.6pt]
\mapfontsize [8pt]    [8.4pt]
\mapfontsize [9pt]    [9.2pt]
\mapfontsize [10pt]   [10pt]
\mapfontsize [11pt]   [10.8pt]
\mapfontsize [12pt]   [11.6pt]
\mapfontsize [14.4pt] [13.2pt]
\stoptyping

As we have seen, \type{\definefont} creates a macro name for a font
switch. For ease of use, there is also a direct method to access a 
font:

\showsetup{definedfont}

Where the argument has exactly the same syntax as the second argument to
\type{\definefont}. In fact, this macro executes \type{\definefont} 
internally, and then immediately switches to the defined font.


\section {Defining body fonts}
\macro{\tex{definebodyfont}}


In older versions of \CONTEXT, the model for defining fonts that will be
described in this section was the top||level user interface.  These days,
typescripts are used at the top||level, and the body font definitions are
wrapped inside of those. 

Most commercial fonts have only one design size, and when you create a
typescript for such fonts, you can simply reuse the predefined size
definitions. Later on we will see that this means you can just refer to a
\type{default} definition.

Still, you may need (or want) to know the details of body font definitions
if you create your own typescripts, especially if the fonts are not all
that standard.  For example, because Latin Modern comes in design sizes,
there was a need to associate a specific font with each bodyfont size.  You
may find yourself in a similar situation when you attempt to create a
typescript for a \quote{professional} commercial font set.

The core of this intermediate model is the \type{\definebodyfont} command
that is used as follows:

\starttyping
\definebodyfont [10pt] [rm] [tf=tir at 10pt]
\stoptyping

This single line actually defines two font switches \type{\tf} for use
after a \type{\rm} command, and \type{\rmtf} for direct access.

\blank

As one can expect, the first implementation of a font model in \TEX\ is
also determined and thereby complicated by the fact that the Computer
Modern Roman fonts come in design sizes. As a result, definitions can look
rather complex and because most \TEX\ users start with those fonts, font
definitions are considered to be complex. 

Another complicating factor is that in order to typeset math, even more
(font) definitions are needed. Add to that the fact that sometimes fonts
with mixed encodings have to be used, i.e.\ with the glyphs positioned in
different font slots, and you can understand why font handling in \TEX\
is often qualified as \quote {the font mess}. Flexibility simply has its
price.

Like most other \TEX\ users, Hans Hagen started out using the Computer
Modern Roman fonts. Since these fonts have specific design sizes,
\CONTEXT\ supports extremely accurate \type{\definebodyfont} definitions with
specific font names and sizes for each combination. The following is an
example of that:

\startbuffer[font-6]
\definebodyfont [12pt] [rm]
    [ tf=cmr12,
     tfa=cmr12 scaled \magstep1,
     tfb=cmr12 scaled \magstep2,
     tfc=cmr12 scaled \magstep3,
     tfd=cmr12 scaled \magstep4,
      bf=cmbx12,
      it=cmti12,
      sl=cmsl12,
      bi=cmbxti10 at 12pt,
      bs=cmbxsl10 at 12pt,
      sc=cmcsc10 at 12pt]
\stopbuffer

\typebuffer[font-6]

It should be clear to you that for fonts with design sizes, similar
\type{\definebodyfont} commands will have to be written for each of the
requested body font sizes. But many commercial fonts do not come in
design sizes at all.  In fact, many documents have a rather simple design
and use only a couple of fonts for all sizes.

The previous example used the available \TEX||specifications \type {scaled}
and \type {at}, but (as we say already) \CONTEXT\ supports special keyword
that is a combination of both: \type {sa} (scaled at).

For example, for the Helvetica Type~1 font definition we could define:

\startbuffer[font-7]
\definebodyfont [12pt] [ss]
  [tf=hv  sa 1.000,
   bf=hvb sa 1.000,
   it=hvo sa 1.000,
   sl=hvo sa 1.000,
  tfa=hv  sa 1.200,
  tfb=hv  sa 1.440,
  tfc=hv  sa 1.728,
  tfd=hv  sa 2.074,
   sc=hv  sa 1.000]
\stopbuffer

\typebuffer[font-7]

The scaling is done in relation to the bodyfont size. In analogy with
\TEX's \type {\magstep} we can use \type {\magfactor}: instead of \type
{sa 1.440} we could specify \type {sa \magfactor2}. 

If you are happy with the relative sizes as defined in the body font
environment (and there is no reason not to), the \type{\definebodyfont}
can be four lines shorter. That is because \CONTEXT\ predeclares a whole
collection of names that combine the styles \type{rm}, \type{ss}, \type{tt},
\type{tf}, \type{hw} and \type{cg} with the alternatives \type{bf}, 
\type{it}, \type{sl}, \type{bi}, \type{bs}, and  \type{sc} with the
postfixes \type{a}, \type{b}, \type{c}, \type{d}, \type{x} and \type{xx}.

For the combination of \type{ss} and \type{sl}, the following identifiers
are predeclared: 

\starttyping
\ss    \ssa   \ssb   \ssc   \ssd    \ssx  \ssxx
\sl   \sla  \slb  \slc  \sld   \slx \slxx
\sssl  \sssla \ssslb \ssslc \sssld 
\stoptyping


And because there are no more sizes in the definition any more, we can
just as well combine all of the requested sizes in a single
\type{\definebodyfont} by using a list of sizes as the first
argument. This means exactly the same as repeating that whole list five
(or more) times, but saves a lot of typing:

\starttyping
\definebodyfont [12pt,11pt,10pt,9pt,8pt] [ss]
  [tf=hv  sa 1.000,
   bf=hvb sa 1.000,
   it=hvo sa 1.000,
   sl=hvo sa 1.000,
   sc=hv  sa 1.000]
\stoptyping

Because the font names (may) depend on the encoding vector, we had better
use the previously discussed method for mapping symbolic names. So, any one
of the three following lines can be used, but the third one is best:

\starttyping
\definebodyfont [10pt,11pt,12pt] [ss] [tf=hv        sa 1.000]
\definebodyfont [10pt,11pt,12pt] [ss] [tf=Helvetica sa 1.000]
\definebodyfont [10pt,11pt,12pt] [ss] [tf=Sans      sa 1.000]
\stoptyping


And in the actual \CONTEXT\ core, the default body fonts are in fact
defined with commands like this:

\startbuffer[font-5]
\definebodyfont [default] [rm]
  [ tf=Serif       sa 1,
    ...
    it=SerifItalic sa 1,
    ... ]
\stopbuffer

\typebuffer[font-5]

We saw that \type {\tf} is the default font. Here \type {\tf} is defined as
\typ{Serif sa 1} which means that it is a serif font, scaled to a normal
font size. This \type {Serif} is mapped elsewhere on for example \typ
{Palatino} which in turn is mapped on the actual filename \type {uplr8t},
as demonstrated earlier.

\showsetup{definebodyfont}

The macro syntax for \type{\definebodyfont} is a bit abbreviated. Besides
the two||letter keys that are listed for the third argument, it is also
possible to assign values to font identifiers with the alphabetic suffixes
\type{a} through \type{d} like \type{tfa} as well as the ones with an
\type{x} or \type{xx} suffix like \type{bfx}. You can even define totally new
keywords, if you want that.

As an example we will define a bigger fontsize of \type {\tf}:

\startbuffer
\definebodyfont [10pt,11pt,12pt] [rm] 
    [tfe=Serif at 48pt,
     ite=SerifItalic at 48pt]
\tfe Big {\it Words}.
\stopbuffer

\startexample
\typebuffer
\stopexample

This becomes:

\startreality
\startlinecorrection
\getbuffer
\stoplinecorrection
\stopreality

Note that there is a small trick here: the assignment to \type{ite} is
needed for the command \type{\it} to work properly. Without that, the 
command \type{\it} would run the \quote{normal} version of \type{it} and
that has a size of 11pt.


The keywords \type{mr}, \type {ex}, \type {mi}, \type {sy}, \type {ma},
\type {mb},\type {mc} and \type{md} all relate to math families. As was
already hinted at in~\in{table}[tab:symbolic font names], these have
extended relatives suffixed by \type{bf} for use within bold math
environments. 

Calls of \type{\definebodyfont} for the \type{mm} style look quite
different from the other styles, because they set up these special
keywords, and nothing else.  The first four keys are required in all math
setups just to do basic formula typesetting, the other four (\type{ma}
\dots \type{md}) can be left undefined. Those are normally used for fonts
with special symbols or alphabets like the AMS symbol fonts \type{msam}
and \type{msbm}.

Here is what a setup for a fairly standard \type{mm} could look like:

\startexample
\starttyping
\definebodyfont [10pt] [mm]
    [mr=cmr10,
     ex=cmex10,
     mi=cmmi10,
     sy=cmsy10]

\definebodyfont [17.3pt,14.4pt,12pt,11pt,10pt,9pt] [mm]
    [ma=msam10 sa 1,
     mb=msbm10 sa 1]
\stoptyping
\stopexample

The keys \type{mc} and \type{md} are left undefined. This example
explicitly shows how multiple \type{\definebodyfont}s are combined by
\CONTEXT\ automatically and that there is no need to do everything 
within a single definition (in fact this was already implied by the
\type{tfe} trick above.)

Apart from the calling convention as given in the macro syntax that has
already been shown, there are a few alternative forms of
\type{\definebodyfont} that can be used to defined and call body fonts by
name:

\showsetup{definebodyfontDEF}

This was used in the default serif font defintion shown above: the first
argument to \type{\definebodyfont} was the identifier \type{default}
because these definitions were to be used from within other definitions.  

An actual size will be provided by the commands at the top||level in the
calling chain, the third argument in that \type{\definebodyfont} call will
also be \type{default} instead of actually specifying settings.

\showsetup{definebodyfontREF}

The use of the \type{default} actually happens deep inside \CONTEXT\ so
there is clear code that can be shown, but if it was written out, a call
would for example look like this:

\startexample
\starttyping
\definebodyfont
  [17.3pt,14.4pt,12pt,11pt,10pt,9pt,8pt,7pt,6pt,5pt,4pt]
  [rm,ss,tt,mm]
  [default]
\stoptyping
\stopexample

To end this section: for advanced \TEX\ users there is the
dimension||register \type {\bodyfontsize}. This variable can be used to set
fontwidths. The number (rounded) points is available in \type
{\bodyfontpoints}.

This way of defining fonts has been part of \CONTEXT\ from
the beginning, but as more complicated designs started to
show up, we felt the need for a more versatile mechanism.

\section {Typescripts and typefaces}

\macro{\tex{usetypescript}}
\macro{\tex{usetypescriptfile}}
\macro{\tex{starttypescript}}
\macro{\tex{definetypeface}}

On top of the existing traditional font module, \CONTEXT\ now provides a
more abstract layer of typescripts and building blocks for definitions
and typefaces as font containers. The original font definition files have
been regrouped into such typescripts thereby reducing the number of files
involved.

As we saw earlier, \quote{using} a typescript is done via the a call to the
macro \type{\usetypescript}. Here is the macro syntax setup again:

\showsetup{usetypescript}

Typescripts are in fact just organized definitions, and \quote{using} a
typescript therefore actually means nothing more than executing the set of
definitions that is contained within a particular typescript.

The main defining command for typescripts is a start||stop pair that wraps
the actual macro definitions. 

\starttyping
\starttypescript [...] [...] [...]
   ....
\stoptypescript
\stoptyping

As with \type{\usetypescript}, there can be up to three arguments, and
these two sets of arguments are linked to eachother: the values of the 
first and second argument in the call to \type{\starttypescript} of

\startexample
\starttyping
\starttypescript [palatino] [texnansi,ec,qx,t5,default]
  ...
\stoptypescript
\stoptyping
\stopexample

are what make the \MKII-style call to \type{\usetypescript}

\startexample
\starttyping
\usetypescript [palatino] [ec]
...
\stoptyping
\stopexample

possible and meaningful: the first argument in both cases is the same so
that this matches, and the second argument of \type{\usetypescript} appears
in the list that is the second argument of \type{\starttypescript}, so this
also matches. \CONTEXT\ will execute all matching blocks it knows about:
there may be more than one.

To perform the actual matching, \CONTEXT\ scans through the list of known
\type{\starttypescript} blocks for each of the combinations of items in 
the specified arguments of \type{\usetypescript}. These blocks can be
preloaded definitions in \TEX's memory, or they may come from a file.

There is a small list of typescript files that is tried always, and by
using \type{\usetypescriptfile} you actually add extra ones at the end of
this list.

The automatically loaded files for the three possible engines are, 
in first to last order:

\starttabulate[|lT|lT|lT|p|]
\NC \rmbf pdftex \NC \rmbf xetex \NC \rmbf luatex  \NC \rmbf explanation \NC \FR
\NC type-tmf     \NC type-tmf    \NC type-tmf      \NC Core \TEX\ community fonts\NC \NR
\NC type-siz     \NC type-siz    \NC type-siz      \NC Font size setups\NC \NR
\NC type-one     \NC             \NC               \NC Type~1 free fonts\NC \NR
\NC              \NC type-otf    \NC type-otf      \NC OpenType free fonts\NC \NR
\NC              \NC type-xtx    \NC               \NC MacOSX font support\NC \NR
\NC type-akb     \NC             \NC               \NC Basic Adobe Type~1 mappings\NC \NR
\NC type-loc     \NC type-loc    \NC type-loc      \NC A user configuration file\NC \NR
\stoptabulate

Extra arguments to \type{\usetypescript} are ignored, and that is why that
same two-argument call to \type{\usetypescript} works correctly in \MKIV\
as well, even tough the typescript itself uses only a single argument:

\startexample
\starttyping
\starttypescript [palatino]
  ...
\stoptypescript
\stoptyping
\stopexample

On the other hand, extra arguments to \type{\starttypescript} are not
ignored: a \type{\starttypescript} with two specified arguments will not
be matched by a \type{\usetypescript} that has only one specified
argument. 

However, you can force any key at all to match by using the special
keyword \type{all} in your \type{\usetypescript} or
\type{\starttypescript}.   We will see later that this use of a 
wildcard is sometimes handy.


\subsection{A typescript in action}

Before we can go on and explain how to write \type{\starttypescript}
blocks, we have to step back for a moment to the macro
\type{\definetypeface}, and especially to the third, fourth and fifth
argument:

\startexample
\starttyping
\starttypescript [palatino] [texnansi,ec,qx,t5,default]
\definetypeface[palatino] [rm] [serif] [palatino] [default]
...
\stoptyping
\stopexample

Remember how in the previous chapter there were the tables that listed all
the predefined combinations? It was said there that these \quote{\dots are
nothing more than convenience names that are attached to a group of fonts
by the person that wrote the font definition}. 

Here is how that works: these arguments of \type{\definetypeface} are
actually used as parts of \type{\usetypescript} calls. To be preciese,
inside the macro definition of \type{\definetypeface}, there are the
following lines:

\startexample
\starttyping
\def\definetypeface 
  ...
  \usetypescript[#3,map][#4][name,default,\typefaceencoding,special]
  \usetypescript[#3][#5][size]
  ...
\stoptyping
\stopexample

In our example \type{#3} is \type{serif}, \type{#4} is \type{palatino},
and \type{#5} is default. The value of \type{\typefaceencoding} is
inherited from the calling \type{\usetypescript}. That means that the two
lines expand into:

\starttyping
\usetypescript[serif,map][palatino] [name,default,ec,special]
\usetypescript[serif][default][size]
\stoptyping

And those typescripts will be searched for. This example is using \MKII,
so the list of typescript files is \type{type-tmf}, \type{type-siz}, 
\type{type-one}, \type{type-akb}, and \type{type-loc}. The first two 
arguments of \type{\usetypescript} are handled depth first, so first all
\quote{serif} typescripts are tried against all the files in the list and
then all the \quote{map} typescripts.

Not all of the seached typescript blocks are indeed present in the list
of files that have to be scanned, but a few are, and one apparently even
more than once:

\starttabulate[|lT|l|l|l|]
\NC type-tmf.tex \NC serif \NC palatino \NC name                     \NC\NR
\NC type-one.tex \NC serif \NC palatino \NC texnansi,ec,8r,t5        \NC\NR
\NC type-one.tex \NC serif \NC palatino \NC ec,texnansi,8r           \NC\NR
\NC type-one.tex \NC map   \NC all      \NC --                       \NC\NR
\NC type-siz.tex \NC serif \NC default  \NC size                     \NC\NR
\stoptabulate

All of the found blocks are executed, so let's look at them in order

\starttyping
\starttypescript [serif] [palatino] [name]
    \definefontsynonym [Serif]            [Palatino]
    \definefontsynonym [SerifBold]        [Palatino-Bold]
    \definefontsynonym [SerifItalic]      [Palatino-Italic]
    \definefontsynonym [SerifSlanted]     [Palatino-Slanted]
    \definefontsynonym [SerifBoldItalic]  [Palatino-BoldItalic]
    \definefontsynonym [SerifBoldSlanted] [Palatino-BoldSlanted]
    \definefontsynonym [SerifCaps]        [Palatino-Caps]
\stoptypescript
\stoptyping

This block has mapped the standard symbolic names to names in the
\quote{Palatino} family, one of the standard font synonym actions as
explained in the beginning of this chapter.

\starttyping
\starttypescript [serif] [palatino] [texnansi,ec,8r,t5]
\definefontsynonym [Palatino]             
    [\typescriptthree-uplr8a]  [encoding=\typescriptthree]
\definefontsynonym [Palatino-Italic]      
    [\typescriptthree-uplri8a] [encoding=\typescriptthree]
\definefontsynonym [Palatino-Bold]        
    [\typescriptthree-uplb8a]  [encoding=\typescriptthree]
\definefontsynonym [Palatino-BoldItalic]  
    [\typescriptthree-uplbi8a] [encoding=\typescriptthree]
\definefontsynonym [Palatino-Slanted]     
    [\typescriptthree-uplr8a-slanted-167] [encoding=\typescriptthree]
\definefontsynonym [Palatino-BoldSlanted]
    [\typescriptthree-uplb8a-slanted-167] [encoding=\typescriptthree]
\definefontsynonym [Palatino-Caps]        
    [\typescriptthree-uplr8a-capitalized-800] [encoding=\typescriptthree]

\loadmapfile[\typescriptthree-urw-palatino.map]
\stoptypescript
\stoptyping

This maps the Palatino names onto the actual font files. Some further
processing is taking place here: the calling \type{\usetypescript} that
was called from within the \type{\definetypeface} knows that it wants
\type{ec} encoding. Because this is the third argument, it becomes the
replacement of \type{\typescriptthree}. The body of the typescript
therefore reduces to:

\begingroup
\hfuzz10pt
\starttyping
\definefontsynonym[Palatino]            [ec-uplr8a]                [encoding=ec]
\definefontsynonym[Palatino-Italic]     [ec-uplri8a]               [encoding=ec]
\definefontsynonym[Palatino-Bold]       [ec-uplb8a]                [encoding=ec]
\definefontsynonym[Palatino-BoldItalic] [ec-uplbi8a]               [encoding=ec]
\definefontsynonym[Palatino-Slanted]    [ec-uplr8a-slanted-167]    [encoding=ec]
\definefontsynonym[Palatino-BoldSlanted][ec-uplb8a-slanted-167]    [encoding=ec]
\definefontsynonym[Palatino-Caps]       [ec-uplr8a-capitalized-800][encoding=ec]

\loadmapfile[ec-urw-palatino.map]
\stoptyping
\endgroup

Incidentally, this also loads a font map file.  In earlier versions of \CONTEXT, this
was done by separate typescripts in the file \type{type-map.tex}, but nowadays all map
loading is combined with the definition of the synonyms that link to the true fonts on
the harddisk. This way, there is a smaller chance of errors creeping
in. See~\in{section}[sec:map files] for more details on font map files.

The third match is a block that sets sets up \quote{TeXPalladioL} font synonyms. These
will not actually be used, but it is a match so it will be executed anyway.

\starttyping
\starttypescript [serif] [palatino] [ec,texnansi,8r]
\definefontsynonym[TeXPalladioL-BoldItalicOsF]
    [\typescriptthree-fplbij8a][encoding=\typescriptthree]
...
\stoptypescript
\stoptyping

The next matched entry loads the font map files for the default fonts:

\starttyping
\starttypescript [map] [all]
    \loadmapfile[original-base.map]
    \loadmapfile[original-ams-base.map]
\stoptypescript
\stoptyping

this will not really be needed for the palatino \type{\rm} typescript, but it ensures
that even if there is something horribly wrong with the used typescripts, at least 
\PDFTEX\ will be able to find the Latin Modern (the default font set) on the
harddisk.

The last match is the missing piece of the font setup: 

\starttyping
\starttypescript [serif] [default] [size]
  \definebodyfont
    [4pt,5pt,6pt,7pt,8pt,9pt,10pt,11pt,12pt,14.4pt,17.3pt]
    [rm] [default]
\stoptypescript
\stoptyping

and now the typescript is complete.  

As explained earlier, that last block references a named
\type{\definebodyfont} that is defined in \type{type-unk.tex}:

\starttyping
\definebodyfont [default] [rm]
  [tf=Serif sa 1,
   bf=SerifBold sa 1,
   it=SerifItalic sa 1,
   sl=SerifSlanted sa 1,
   bi=SerifBoldItalic sa 1,
   bs=SerifBoldSlanted sa 1,
   sc=SerifCaps sa 1]
\stoptyping

similar \type{default} blocks are defined for the other five font styles also.

Looking back, you can see that the Palatino-specific typescripts did
actually do anything except definining font synonyms, loading a map file,
and calling a predefined \type{bodyfont}. 

\subsection{Some more information}

As we saw already, typescripts and its invocations have up to three specifiers.  An
invocation matches the script specification when the three arguments have common
keywords, and the special keyword \type {all} is equivalent to any match.

Although any keyword is permitted in any of the three arguments, the
current definitions (and macros like \type{\definetypeface}) make heavy
use of some keys in particular:

\starttabulate[|lT|p|]
\HL
\NC \bf pattern \NC \bf application \NC \NR
\HL
\NC [serif] [*] [*]   \NC serif fonts             \NC \NR
\NC [sans] [*] [*]    \NC sans serif fonts        \NC \NR
\NC [mono] [*] [*]    \NC mono spaced fonts       \NC \NR
\NC [math] [*] [*]    \NC math fonts              \NC \NR
\NC [*] [*] [size]    \NC size specifications     \NC \NR
\NC [*] [*] [name]    \NC symbolic name mapping   \NC \NR
\NC [*] [*] [special] \NC special settings        \NC \NR
\NC [*] [all] [*]     \NC default case(s)         \NC \NR
\NC [map] [*] [*]     \NC map file specifications \NC \NR
\HL
\stoptabulate

When you take a close look at the actual files in the distribution you
will notice a quite a few other keywords.  One in particular is worth
mentioning: instead of the predefined sizes in \type {default}, you can
use the \type {dtp} size scripts with their associated body font
environments by using

\starttyping
\usetypescript [all] [dtp] [size]
\stoptyping

or 

\starttyping
\definetypeface[palatino] [rm] [serif] [palatino] [dtp]
\stoptyping

\blank

In the top||level typescript for the palatino, we had a bunch of
\type{\definetypeface} commands, as follows:

\typebuffer[funny]

Once these commands are executed (wether or not as part of a typescript), \type
{\funny} will enable this specific collection of fonts. In a similar way we can 
define a collection \type {\joke}.

\typebuffer[joke]

And the familiar Computer Modern Roman as \type {\whow}:

\typebuffer[whow]


\startbuffer[sample]
Who is {\it fond} of fonts?
Who claims that $t+e+x+t=m+a+t+h$?
Who {\ss can see} {\tt the difference} here?
\stopbuffer

Now has become possible to switch between these three font collections at will.  
Here is a sample of some text and a little bit of math:

\startexample
\typebuffer[sample]
\stopexample

When typeset in \type {\funny}, \type {\joke}, and \type{whow}, the samples look like:

\startlines
{\funny \getbuffer[sample]}
\stoplines

\startlines
{\joke  \getbuffer[sample]}
\stoplines

\startlines
{\whow  \getbuffer[sample]}
\stoplines

With \type {\showbodyfont} you can get an overview of this font.

\placefigure
  {The \type {funny} typeface collection.}
  {\showbodyfont[funny]}

\placefigure
  {The \type {joke} typeface collection.}
  {\showbodyfont[joke]}

\placefigure
  {The \type {whow} typeface collection.}
  {\showbodyfont[whow]}

When defining the joke typeface collection, we used a scale
directive. The next sample demonstrates the difference
between the non scaled and the scaled alternatives.

\startlines
{\nojoke \getbuffer[sample]}
\stoplines

\startlines
{\joke   \getbuffer[sample]}
\stoplines


It may not be immediately clear from the previous examples, but a big
difference between using typeface definitions and the old method of
redefining over and over again, is that the new method uses more
resources. This is because each typeface gets its own name space
assigned. As an intentional side effect, the symbolic names also follow
the typeface. This means that for instance:

\startbuffer[big]
\definefont[MyBigFont][Serif sa 1.5] \MyBigFont A bit larger!
\stopbuffer

\typebuffer[big]

will adapt itself to the currently activated serif font
shape, here \type {\funny}, \type {\joke} and \type {\whow}.

\startlines
{\funny \getbuffer[big]}
{\joke  \getbuffer[big]}
{\whow  \getbuffer[big]}
\stoplines

\subsection{A bit more about math}

Math is kind of special in the sense that it has its own set
of fonts, either or not related to the main text font. By
default, a change in style, for instance bold, is applied to
text only.

\startbuffer[math]
$        \sqrt{625} =     5\alpha$
$\bf     \sqrt{625} =     5\alpha$
$        \sqrt{625} = \bf 5\alpha$
$\bfmath \sqrt{625} =     5\alpha$
\stopbuffer

\typebuffer[math]

The difference between these four lines is as follows:

\startlines
\funny \getbuffer[math]
\stoplines

In order to get a bold $\alpha$ symbol, we need to define bold math
fonts. \footnote {Bold math is already prepared in the core modules, so
normally one can do with less code} Assuming the font's typescripts
support bold math, the most convenient way of doing this is the following:

\startbuffer
\definetypeface [whow] [mm]
  [math,boldmath] [modern] [default] [encoding=texnansi]
\stopbuffer

\typebuffer \getbuffer

Bold math looks like this:

\startlines
\whow \getbuffer[math]
\stoplines

The definitions are given on the next page. Such definitions are normally collected in
the project bound file, for instance called \type {typeface.tex}, that is then manually
added to the list of typescript files:

\starttyping
\usetypescriptfile[typeface] % project scripts
\stoptyping

%An example of such a file is shown below:

%\start
%\switchtobodyfont[9pt] \typefile{typeface}
%\stop

It is also possible to avoid typescripts. When definitions are
used only once, it makes sense to use a more direct method.
We will illustrate this with a bit strange example.

Imagine that you want some math formulas to stand out, but
that you don't have bold fonts. In that case you can for
instance scale them. A rather direct method is the following.

\startbuffer
\definebodyfont
  [funny]
  [12pt,11pt,10pt,9pt,8pt,7pt] [mm]
  [mrbf=MathRoman     mo 2,
   exbf=MathExtension mo 2,
   mibf=MathItalic    mo 2,
   sybf=MathSymbol    mo 2]
\stopbuffer

\typebuffer \getbuffer

Our math sample will now look like:

\startlines
\funny \getbuffer[math]
\stoplines

We can also use an indirect method:

\startbuffer
\definebodyfont
  [smallmath] [mm]
  [mrbf=MathRoman     mo .5,
   exbf=MathExtension mo .5,
   mibf=MathItalic    mo .5,
   sybf=MathSymbol    mo .5]

\definebodyfont
  [funny]
  [12pt,11pt,10pt,9pt,8pt,7pt]
  [mm] [smallmath]
\stopbuffer

\typebuffer \getbuffer

This method is to be preferred when we have to define more
typefaces since it saves keystrokes.

\startlines
\funny \getbuffer[math]
\stoplines

For efficiency reasons, the font definitions (when part of
a typeface) are frozen the first time they are used. Until
that moment definitions will adapt themselves to changes in
for instance scaling and (mapped) names. Freezing
definitions is normally no problem because typefaces are
defined for a whole document and one can easily define
more instances. When you redefine it, a frozen font is
automatically unfrozen.

\section{Predefined font, style and alternative keywords}
\macro{\tex{definebodyfontswitch}}
\macro{\tex{definefontstyle}}
\macro{\tex{definealternativestyle}}

Some of the internal commands are worth mentioning because they define keywords and
you may want to add to the list.

Font size switching is done with keywords like \type{twelvepoint} and commands like
\type {\twelvepoint} or \type {\xii}, which is comparable to the way it is done in
plain \TEX. These commands are defined with:


\startbuffer[font-10]
\definebodyfontswitch [fourteenpointfour] [14.4pt]
\definebodyfontswitch [twelvepoint]       [12pt]
\definebodyfontswitch [elevenpoint]       [11pt]
\definebodyfontswitch [tenpoint]          [10pt]
\definebodyfontswitch [ninepoint]         [9pt]
\definebodyfontswitch [eightpoint]        [8pt]
\definebodyfontswitch [sevenpoint]        [7pt]
\definebodyfontswitch [sixpoint]          [6pt]
\definebodyfontswitch [fivepoint]         [5pt]
\definebodyfontswitch [fourpoint]         [4pt]
\definebodyfontswitch [xii]  [12pt]
\definebodyfontswitch [xi]   [11pt]
\definebodyfontswitch [x]    [10pt]
\definebodyfontswitch [ix]   [9pt]
\definebodyfontswitch [viii] [8pt]
\definebodyfontswitch [vii]  [7pt]
\definebodyfontswitch [vi]   [6pt]
\stopbuffer

\typebuffer[font-10]

But be warned that  \type{\xi} is later redefined as a greek symbol.

The keys in \type {\setupbodyfont} are defined in terms of:

\startbuffer[font-11]
\definefontstyle [rm,roman,serif,regular]    [rm]
\definefontstyle [ss,sansserif,sans,support] [ss]
\definefontstyle [tt,teletype,type,mono]     [tt]
\definefontstyle [hw,handwritten]            [hw]
\definefontstyle [cg,calligraphic]           [cg]
\stopbuffer

\typebuffer[font-11]

In many command setups we encounter the parameter \type {style}. In those situations
we can specify a key. These keys are defined with \type {\definealternativestyle}. The
third argument is only of importance in chapter and section titles, where, apart from
\type {\cap}, we want to obey the font used there.

\startbuffer[font-12]
\definealternativestyle [mediaeval]         [\os]               []
\definealternativestyle [normal]            [\tf]               []
\definealternativestyle [bold]              [\bf]               []
\definealternativestyle [type]              [\tt]               []
\definealternativestyle [mono]              [\tt]               []
\definealternativestyle [slanted]           [\sl]               []
\definealternativestyle [italic]            [\it]               []
\definealternativestyle [boldslanted,
                         slantedbold]       [\bs]               []
\definealternativestyle [bolditalic,
                         italicbold]        [\bi]               []
\definealternativestyle [small,
                         smallnormal]       [\tfx]              []
\definealternativestyle [smallbold]         [\bfx]              []
\definealternativestyle [smalltype]         [\ttx]              []
\definealternativestyle [smallslanted]      [\slx]              []
\definealternativestyle [smallboldslanted,
                         smallslantedbold]  [\bsx]              []
\definealternativestyle [smallbolditalic,
                         smallitalicbold]   [\bix]              []
\definealternativestyle [sans,
                         sansserif]         [\ss]               []
\definealternativestyle [sansbold]          [\ss\bf]            []
\definealternativestyle [smallbodyfont]     [\setsmallbodyfont] []
\definealternativestyle [bigbodyfont]       [\setbigbodyfont]   []
\definealternativestyle [cap,
                         capital]           [\smallcapped]      [\smallcapped]
\definealternativestyle [smallcaps]         [\sc]               [\sc]
\definealternativestyle [WORD]              [\WORD]             [\WORD]
\stopbuffer

\typebuffer[font-12]

In \in{section}[emphasize] we have already explained how
{\em emphasizing} is defined. With oldstyle digits this is
somewhat different. We cannot on the forehand in what font
these can be found. By default we have the setup:


\startbuffer[font-13]
\definefontsynonym [OldStyle] [MathItalic]
\stopbuffer

\typebuffer[font-13]

As we see they are obtained from the same font as the math italic characters. The
macro \type{\os} fetches the runtime setting by executing
\type{\symbolicfont{OldStyle}}, which is just a low-level version of
\type{\definedfont[OldStyle sa *]}. A few other macros behave just like that:

\starttabulate[|lT|l|l|]
\NC \rm\bf macro  \NC \bf synonym     \NC \bf default value   \NC \NR
\NC \tex{os}      \NC OldStyle        \NC MathItalic (lmmi10) \NC \NR
\NC \tex{frak}    \NC Fraktur         \NC eufm10              \NC \NR
\NC \tex{goth}    \NC Gothic          \NC eufm10              \NC \NR
\NC \tex{cal}     \NC Calligraphic    \NC cmsy10 (lmsy10)     \NC \NR
\NC \tex{bbd}     \NC Blackboard      \NC msbm10              \NC \NR
\stoptabulate

In addition to all the alrady mentioned commands there are others, for example macros
for manipulating accents. These commands are discussed in the file \type
{font-ini}. More information can also be found in the file \type {core-fnt} and
specific gimmicks in the file \type {supp-fun}. So enjoy yourself.

\section {Symbols and glyphs}

Some day you may want to define your own symbols, if
possible in such a way that they nicely adapt themselves to
changes in style and size. A good example are the \symbol
[euro] symbols. You can take a look in \type {symb-eur.tex}
to see how such a glyph is defined.

\starttyping
\definefontsynonym [EuroSerif]     [eurose]
\definefontsynonym [EuroSerifBold] [euroseb]
...
\definefontsynonym [EuroSans]      [eurosa]
\definefontsynonym [EuroSansBold]  [eurosab]
...
\definefontsynonym [EuroMono]      [euromo]
\definefontsynonym [EuroMonoBold]  [euromob]
\stoptyping

Here we use the free Adobe euro fonts, but there are
alternatives available. The symbol itself is defined as:

\starttyping
\definesymbol [euro] [\getglyph{Euro}{\char160}]
\stoptyping

You may notice that we only use the first part of the
symbolic name. \CONTEXT\ will complete this name according
to the current style. You can now access this symbol with
\typ {\symbol [euro]}

\starttabulate[|l|c|c|c|c|c|c|]
\NC           \NC \tex{tf}    \NC \tex{bf}    \NC \tex{sl}
              \NC \tex{it}    \NC \tex{bs}    \NC \tex{bi}    \NC\NR
\NC \rm Serif \NC \rm\tf\euro \NC \rm\bf\euro \NC \rm\sl\euro
              \NC \rm\it\euro \NC \rm\bs\euro \NC \rm\bi\euro \NC\NR
\NC \ss Sans  \NC \ss\tf\euro \NC \ss\bf\euro \NC \ss\sl\euro
              \NC \ss\it\euro \NC \ss\bs\euro \NC \ss\bi\euro \NC\NR
\NC \tt Mono  \NC \tt\tf\euro \NC \tt\bf\euro \NC \tt\sl\euro
              \NC \tt\it\euro \NC \tt\bs\euro \NC \tt\bi\euro \NC\NR
\stoptabulate

More details on defining symbols and symbol sets can be
found in the documentation of the symbol modules.

\section{Encodings}
\macro{\tex{startencoding}}
\macro{\tex{startmapping}}
\macro{\tex{definecharacter}}
\macro{\tex{defineaccent}}
\macro{\tex{definecommand}}
\macro{\tex{definecasemap}}

\todo{Add macro syntax definition blocks}

Until now we assumed that an~\type {a} will become an~a
during type setting. However, this is not always the case.
Take for example~\"a or~\ae. This character is not available
in every font and certainly not in the Computer Modern
Typefaces. Often a combination of characters \type {\"a} or a
command \type {\ae} will be used to produce such a character.
In some situation \TEX\ will combine characters
automatically, like in \type {fl} that is combined to fl and
not \hbox{f}\hbox{l}. Another problem occurs in converting
small print to capital print and vice versa.

Below you see an example of the \type {texnansi} mapping:


\startbuffer[enco-1]
\startmapping[texnansi]
  \definecasemap 228 228 196  \definecasemap 196 228 196
  \definecasemap 235 235 203  \definecasemap 203 235 203
  \definecasemap 239 239 207  \definecasemap 207 239 207
  \definecasemap 246 246 214  \definecasemap 214 246 214
  \definecasemap 252 252 220  \definecasemap 220 252 220
  \definecasemap 255 255 159  \definecasemap 159 255 159
\stopmapping
\stopbuffer

\typebuffer[enco-1]

This means so much as: in case of a capital the character
with code 228 becomes character 228 and in case of small
print the character becomes character 196.

These definitions can be found in \type {enco-ans}. In this
file we can also see:


\startbuffer[enco-2]
\startencoding[texnansi]
  \defineaccent " a 228
  \defineaccent " e 235
  \defineaccent " i 239
  \defineaccent " o 246
  \defineaccent " u 252
  \defineaccent " y 255
\stopencoding
\stopbuffer

\startbuffer[enco-3]
\startencoding[texnansi]
  \definecharacter ae 230
  \definecharacter oe 156
  \definecharacter o  248
  \definecharacter AE 198
\stopencoding
\stopbuffer

\typebuffer[enco-2]

and

\typebuffer[enco-3]

As a result of the way accents are placed over characters we
have to approach accented characters different from normal
characters. There are two methods: \TEX\ does the accenting
itself {\em or} prebuild accentd glyphs are used. The
definitions above take care of both methods. Other
definitions are sometimes needed. In the documentation of
the file \type {enco-ini} more information on this can be
found.

\section[sec:map files]{Map files}
\macro{\tex{loadmapfile}}
\macro{\tex{setupencoding}}

\todo{This section is too informal}

If you're already sick of reading about fonts, you probably
don't want read this section. But alas, \DVI\ post processors
and \PDFTEX\ will not work well if you don't provide them
\type {map} files that tell them how to handle the files
that contain the glyphs.

In its simplest form, a definition looks as follows:

\starttyping
usedname < texnansi.enc < realname.pfb
\stoptyping

This means as much as: when you want to include a file that
has the \type {tfm} file \type {usedname}, take the outline
file \type {realname.pfb} and embed it with the \type
{texnansi} encoding vector. Sometimes you need more
complicated directives and you can leave that to the
experts. We try to keep up with changes in the map file
syntax, the names of fonts, encodings, locations in the
\TEX\ tree, etc. However, it remains a troublesome area.

It makes sense to take a look at the \type {cont-sys.rme} file
to see what preferences make sense. If you want to speed up
the typescript processing, say (in \type {cont-sys.tex}:

\starttyping
\preloadtypescripts
\stoptyping

If you want to change the default encoding, you should add
something:

\starttyping
\setupencoding [default=texnansi]
\stoptyping

You can let \CONTEXT\ load the map files for \PDFTEX:

\starttyping
\autoloadmapfilestrue
\stoptyping

The following lines will remove existing references to map
files and load a few defaults.

\starttyping
\resetmapfiles
\loadmapfile[original-base.map]
\loadmapfile[original-ams-base.map]
\loadmapfile[original-public-lm.map]
\stoptyping

As said, map files are a delicate matter.

\section{Installing fonts}

\todo{Document use of \MKIV and \XETEX\ and in particular OSFONTDIR}

Most \TEX\ distributions come with a couple of fonts, most
noticeably the Computer Modern Roman typefaces. In order to
use a font, \TEX\ has to know its characteristics. These are
defined in \type {tfm} and \type {vf} files. In addition to
these files, on your system you can find a couple of more
file types.

\starttabulate[|cT|lp|]
\HL
\NC \bf suffix \NC \bf content \NC \NR
\HL
\NC tfm \NC \TEX\ specific font metric files that, in
            many cases, can be generated from \type {afm}
            files \NC \NR
\NC vf  \NC virtual font files, used for building glyph
            collections from other ones \NC \NR
\NC afm \NC Adobe font metric files that are more limited
            than \type {tfm} files (especially for math
            fonts) \NC \NR
\NC pfm \NC Windows specific font metric files, not used
            by \TEX\ applications \NC \NR
\NC pfb \NC files that contain the outline specification of
            the glyphs fonts, also called Type 1 \NC \NR
\NC enc \NC files with encoding vector specifications \NC \NR
\NC map \NC files that specify how and what font files
            are to be included \NC \NR
\HL
\stoptabulate

On your disk (or cdrom) these files are organized in such a
way that they can be located fast. \footnote {If you have
installed \TETEX\ or \FPTEX\ (possibly from the \TEX live
\CDROM) you will have many thousands of font files on your
system.} The directory structure normally is as follows:

\starttyping
texmf / fonts  / tfm    / vendor   / name / *.tfm
               / afm    / vendor   / name / *.afm
               / pfm    / vendor   / name / *.pfm
               / vf     / vendor   / name / *.vf
               / type1  / vendor   / name / *.pfb
      / pdftex / config /                   *.cfg
               / config /                   *.map
               / config / encoding /        *.enc
\stoptyping

The \type {texmf-local} or even better \type {texmf-fonts}
tree normally contains your own fonts, so that you don't
have to reinstall them when you reinstall the main tree.
The \type {pdftex} directory contains the files that
\PDFTEX\ needs in order to make decisions about the fonts
to include. The \type {enc} files are often part of
distributions, as is the configuration \type {cfg} file.
When you install new fonts, you often also have to add or
edit \type {map} files.

\CONTEXT\ comes with a \PERL\ script \type {texfont.pl}
that you can use to install new fonts. Since its usage is
covered by a separate manual, we limit ourselves to a short
overview.

Say that you have just bought a new font. A close look at
the files will reveal that you got at least a bunch of \type
{afm} and \type {pfb} files and if you're lucky \type {tfm}
files.

Installing such a font can be handled by this script. For
this you need to know (or invent) the name of the font
vendor, as well as the name of the font. The full set of
command line switches is given below: \footnote {there are a
couple of more switches described in the manual \type
{mtexfonts}.}

\starttabulate[|lT|lp|]
\HL
\NC \bf switch \NC \bf meaning \NC \NR
\HL
\NC fontroot   \NC texmf font root (automatically determined) \NC \NR
\NC vendor     \NC vendor name (first level directory) \NC \NR
\NC collection \NC font collection (second level directory)\NC \NR
\NC encoding   \NC encoding vector (default: texnansi) \NC \NR
\NC sourcepath \NC when installing, copy from this path \NC \NR
\NC install    \NC copy files from source to font tree \NC \NR
\NC makepath   \NC when needed, create the paths \NC \NR
\NC show       \NC run tex on \type{*.tex} afterwards \NC \NR
\HL
\stoptabulate

You seldom need to use them all. In any case it helps if you
have a local path defined already. The next sequence does
the trick:

\starttyping
texfont --ve=FontFun --co=FirstFont --en=texnansi --ma --in
\stoptyping

This will generate the \type {tfm} files from the \type
{afm} files, and copy them to the right place. The Type~1
files (\type {pfb}) will be copied too. The script also
generates a \type {map} file. When this is done successfully,
a \TEX\ file is generated and processed that shows the font
maps. If this file looks right, you can start using the
fonts. The \TEX\ file also show you how to define the fonts.

This script can also do a couple of more advanced tricks.
Let us assume that we have bought (or downloaded) a new
font package in the files \type {demofont.afm} and \type
{demofont.pfb} which are available on the current (probably
scratch) directory. First we make sure that this font is
installed (in our case we use a copy of the public Iwona
Regular):

\starttyping
texfont --ve=test --co=test --ma --in demofont
\stoptyping

We can now say:

% \loadmapfile[demofont.map] % in case we forgot to generate

\startbuffer
\loadmapfile[texnansi-test-test.map]
\definefontsynonym[DemoFont][texnansi-demofont]
\ruledhbox{\definedfont[DemoFont at 50pt]Interesting}
\stopbuffer

\typebuffer \startlinecorrection \getbuffer \stoplinecorrection

From this font, we can derive a slanted alternative by
saying:

\starttyping
texfont --ve=test --co=test --ma --in --sla=.167 demofont
\stoptyping

The map file is automatically extended with the entry needed.

\startbuffer
\definefontsynonym[DemoFont-Slanted][texnansi-demofont-slanted-167]
\ruledhbox{\definedfont[DemoFont-Slanted at 50pt]Interesting}
\stopbuffer

\typebuffer \startlinecorrection \getbuffer \stoplinecorrection

We can also create a wider version:

\starttyping
texfont --ve=test --co=test --ma --in --ext=1.50 demofont
\stoptyping

When you use the \type {--make} and \type {--install} switch,
the directories are made, fonts installed, and entries
appended to the map file if needed.

\startbuffer
\definefontsynonym[DemoFont-Extended][texnansi-demofont-extended-1500]
\ruledhbox{\definedfont[DemoFont-Extended at 50pt]Interesting}
\stopbuffer

\typebuffer \startlinecorrection \getbuffer \stoplinecorrection

Instead of using pseudo caps in \TEX\ by using \type
{\kap}, you can also create a pseudo small caps font.

\starttyping
texfont --ve=test --co=test --ma --in --cap=0.75 demofont
\stoptyping

This method is much more robust but at the cost of an extra
font.

\startbuffer
\definefontsynonym[DemoFont-Caps][texnansi-demofont-capitalized-750]
\ruledhbox{\definedfont[DemoFont-Caps at 50pt]Interesting}
\stopbuffer

\typebuffer \startlinecorrection \getbuffer \stoplinecorrection

\starttabulate[|lT|lp|]
\HL
\NC \bf switch \NC \bf meaning \NC \NR
\HL
\NC extend=factor \NC stretch the font to the given factor \NC \NR
\NC narrow=factor \NC shrink the font to the given factor \NC \NR
\NC slant=factor  \NC create a slanted font \NC \NR
\NC caps=factor   \NC replace lowercase characters by small uppercase ones \NC \NR
\NC test          \NC use test/test as vendor/collection \NC \NR
\HL
\stoptabulate

When manipulating a font this way, you need to provide a
file name. Instead of a factor you can give the keyword
\type {default} or a \type {*}.

\starttyping
texfont --test --auto --caps=default demofont
\stoptyping

The previous example runs create fonts with the rather
verbose names:

\starttyping
demofont
demofont-slanted-167
demofont-extended-150
demofont-capitalized-750
\stoptyping

This naming scheme makes it possible to use more instances
without the risk of conflicts.

In the distribution you will find an example batch file
\type {type-tmf.dat} which creates metrics for some free
fonts for the encoding specified. When you create the
default font metrics this way, preferably \type
{texmf-fonts}, you have a minimal font system tuned for you
prefered encoding without the risk for name clashes. When
you also supply \type {--install}, the font outlines will be
copied from the main tree to the fonts tree, which sometimes
is handy from the perspective of consistency.

\section {Getting started}

\todo{This section needs to be modernized}

The way \TEX\ searches for files (we're talking \WEBC\ now)
is determined by the configuration file to which the \type
{TEXMFCNF} environment variable points (the following
examples are from my own system):

\starttyping
set TEXMFCNF=T:/TEXMF/WEB2C
\stoptyping

When searching for files, a list of directories is used:

\starttyping
set TEXMF={$TEXMFFONTS,$TEXMFPROJECT,$TEXMFLOCAL,!!$TEXMFMAIN}
\stoptyping

Here we've added a font path, which itself is set with:

\starttyping
set TEXMFMAIN=E:/TEX/TEXMF
set TEXMFLOCAL=E:/TEX/TEXMF-LOCAL
set TEXMFFONTS=E:/TEX/TEXMF-FONTS
\stoptyping

Now you can generate metrics and map files. The batch file is
searched for at the \CONTEXT\ data path in the \TEXMF\ tree
or on the local path.

\starttyping
texfont --encoding=ec --batch type-tmf.dat
\stoptyping

If you want to play with encoding, you can also generate
more encodings, like \type {8r} or \type {texnansi}.

\starttyping
texfont --encoding=texnansi --batch type-tmf.dat
texfont --encoding=8r       --batch type-tmf.dat
\stoptyping

After a while, there will be generated \type {tfm}, \type
{vf}, and \type {map} files. If you let \CONTEXT\ pass
the map file directives to \PDFTEX, you're ready now.
Otherwise you need to add the names of the mapfiles to the
file \type {pdftex.cfg}. You can best add them in front of
the list, and, if you use \CONTEXT\ exclusively, you can
best remove the other ones.

As a test you can process the \TEX\ files that are generated
in the process. These also give you an idea of how well the
encoding vectors match your expectations.

Now, the worst that can happen to you when you process your
files, is that you get messages concerning unknown \type
{tfm} files or reports on missing fonts when \PDFTEX\
writes the file. In that case, make sure that you indeed
{\em have} the right fonts (generated) and|/|or that the map
files are loaded. As a last resort you can load all map
files by saying:

\starttyping
\usetypescript [map] [all]
\stoptyping

and take a look at the log file and see what is reported.

In due time we will provide font generation scripts for
installation of other fonts as well as extend the
typescript collection.

\section {Remarks}

It really makes sense to take a look at the font and type
definition files (\type {font-*.tex} and \type {type-*.tex}).
There are fallbacks defined, as well as generic definitions.
Studying styles and manual source code may also teach you a
few tricks.

\stopcomponent