font-pre.mkiv /size: 28 Kb    last modification: 2021-10-28 13:50
1%D \module
2%D   [       file=font-pre,
3%D        version=2012.01.04, % moved from font-ini
4%D          title=\CONTEXT\ Font Macros,
5%D       subtitle=Predefined,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\writestatus{loading}{ConTeXt Font Macros / Predefined}
15
16\unprotect
17
18%D A basic set of features is defined here.
19
20% beware, base mode + dynamics can give weird effects
21
22% frac : with numr dnom
23%
24% vkrn valt vert vrt2 vpal : when vertical
25%
26% rtlm rtla : in r2l runs
27% ltrm ltra : in l2r runs
28%
29% rvrn : variable fonts
30%
31% rtbd lfbd : opbd
32%
33% rkrf rphf vatu vjmo tjmo rclt psts pstf ljmo haln
34% pres pref nukt
35% abvs abvm blwm blws cjct blwf akhn (indic)
36% half
37% abvf cfar (khmer)
38%
39% ccmp locl calt clig liga rlig
40%
41% mkmk mark kern (palt pwid) curs (by choice but some fonts need it)
42%
43% init medi isol fina (unicode)
44% fin3 fin2 med2 : syriac
45%
46% cpsp : percentage spacing (todo)
47%
48% dtls flac :math
49
50\definefontfeature
51  [always]
52  [mode=node,    % we had 'auto', but let's try 'node' for a while and see what the impact is
53   script=auto,  % on speed; 'base' just doesn't play well with dynamics; some day we can even
54   autoscript=position,
55   autolanguage=position,
56   kern=yes,     % consider skipping the base passes when no base mode is used
57   mark=yes,
58   mkmk=yes,
59   curs=yes]
60
61\definefontfeature
62  [default]
63  [always]
64  [liga=yes,
65% ccmp=yes, % maybe too
66% locl=yes, % maybe too
67% calt=yes, % maybe too
68% clig=yes, % maybe too
69% rlig=yes, % maybe too
70   tlig=yes,
71   trep=yes] % texligatures=yes,texquotes=yes
72
73\definefontfeature
74  [original] % a clone of default so we can revert
75  [default]
76
77\definefontfeature
78  [smallcaps]
79  [always]
80  [smcp=yes,
81   tlig=yes,
82   trep=yes] % texligatures=yes,texquotes=yes
83
84\definefontfeature
85  [oldstyle]
86  [always]
87  [onum=yes,
88   liga=yes,
89   tlig=yes,
90   trep=yes] % texligatures=yes,texquotes=yes
91
92\definefontfeature
93  [inlinenumbers]
94  [pnum=yes,
95   tnum=no]
96
97\definefontfeature
98  [tabularnumbers]
99  [tnum=yes,
100   pnum=no]
101
102\definefontfeature
103  [oldstylenumbers]
104  [onum=yes]
105
106\definefontfeature
107  [zero]
108  [zero=yes]
109
110% \definefontfeature
111%   [newstyle]
112%   [onum=no]
113
114\definefontfeature % == default unless redefined
115  [ligatures]
116  [always]
117  [liga=yes,
118   tlig=yes,
119   trep=yes]
120
121\definefontfeature
122  [letterspacing]
123  [liga=no,
124   rlig=no,
125   clig=no,
126   dlig=no,
127   ccmp=yes,
128   keepligatures=auto]
129
130\definefontfeature % can be used for type1 fonts
131  [complete]
132  [always]
133  [compose=yes,
134   liga=yes,
135% ccmp=yes,
136% locl=yes,
137% calt=yes,
138% clig=yes,
139% rlig=yes,
140   tlig=yes,
141   trep=yes]
142
143\definefontfeature
144  [none]
145  [mode=none,
146   features=no]
147
148\definefontfeature
149  [semitic-complete]
150  [mode=node,analyze=yes,language=dflt,ccmp=yes,
151   autoscript=position,autolanguage=position,
152   init=yes,medi=yes,fina=yes,isol=yes,
153 % fin2=yes,fin3=yes,med2=yes,
154   mark=yes,mkmk=yes,kern=yes,curs=yes,
155   liga=yes,dlig=yes,rlig=yes,clig=yes,calt=yes]
156
157\definefontfeature
158  [semitic-simple]
159  [mode=node,analyze=yes,language=dflt,ccmp=yes,
160   autoscript=position,autolanguage=position,
161   init=yes,medi=yes,fina=yes,isol=yes,
162 % fin2=yes,fin3=yes,med2=yes,
163   mark=yes,mkmk=yes,kern=yes,curs=yes,
164   rlig=yes,calt=yes]
165
166\definefontfeature
167  [arabic]
168  [semitic-complete]
169  [script=arab]
170
171\definefontfeature
172  [syriac]
173  [arabic]
174  [fin2=yes,fin3=yes,med2=yes]
175
176\definefontfeature
177  [reordercombining]
178  [reordercombining=yes]
179
180\definefontfeature
181  [hebrew]
182  [semitic-complete]
183  [script=hebr,
184   reordercombining=yes] % seems to work best with reasonable fonts
185
186\definefontfeature
187  [simplearabic]
188  [semitic-simple]
189  [script=arab]
190
191\definefontfeature
192  [simplehebrew]
193  [semitic-simple]
194  [script=hebr]
195
196% indic
197
198\definefontfeature
199  [indic-common]
200  [mode=node,
201   language=dflt,
202   % localized
203   locl=yes,
204   % positioning
205   kern=yes,
206   dist=yes,
207   % above/below base marks
208   abvm=yes,
209   blwm=yes,
210   % basic shaping
211   nukt=yes,
212   akhn=yes,
213   rphf=yes,
214   % presentation
215   pres=yes,
216   abvs=yes,
217   blws=yes,
218   psts=yes,
219   haln=yes,
220   calt=yes]
221
222\definefontfeature
223  [devanagari-one]
224  [indic-common]
225  [script=deva,
226   % basic shaping
227   rkrf=yes,
228   blwf=yes,
229   half=yes,
230   vatu=yes,
231   cjct=yes]
232
233\definefontfeature
234  [bengali-one]
235  [indic-common]
236  [script=beng,
237   % basic shaping
238   blwf=yes,
239   half=yes,
240   pstf=yes,
241   vatu=yes,
242   cjct=yes,
243   % presentation
244   init=yes]
245
246\definefontfeature
247  [gujarati-one]
248  [indic-common]
249  [script=gujr,
250   % basic shaping
251   rkrf=yes,
252   blwf=yes,
253   half=yes,
254   vatu=yes,
255   cjct=yes]
256
257\definefontfeature
258  [gurmukhi-one]
259  [indic-common]
260  [script=guru,
261   % basic shaping
262   blwf=yes,
263   half=yes,
264   pstf=yes,
265   vatu=yes,
266   cjct=yes]
267
268\definefontfeature
269  [kannada-one]
270  [indic-common]
271  [script=knda,
272   % basic shaping
273   pref=yes,
274   blwf=yes,
275   half=yes,
276   pstf=yes,
277   cjct=yes]
278
279\definefontfeature
280  [malayalam-one]
281  [indic-common]
282  [script=mlym,
283   % basic shaping
284   pref=yes,
285   blwf=yes,
286   half=yes,
287   pstf=yes,
288   cjct=yes]
289
290\definefontfeature
291  [oriya-one]
292  [indic-common]
293  [script=orya,
294   % basic shaping
295   blwf=yes,
296   pstf=yes,
297   cjct=yes]
298
299\definefontfeature
300  [tamil-one]
301  [indic-common]
302  [script=taml,
303   % basic shaping
304   pref=yes,
305   half=yes]
306
307\definefontfeature
308  [telugu-one]
309  [indic-common]
310  [script=telu,
311   % basic shaping
312   pref=yes,
313   blwf=yes,
314   half=yes,
315   pstf=yes,
316   cjct=yes]
317
318\definefontfeature [devanagari-two] [devanagari-one] [script=dev2]
319\definefontfeature [bengali-two]    [bengali-one]    [script=bng2]
320\definefontfeature [gujarati-two]   [gujarati-one]   [script=gjr2]
321\definefontfeature [gurmukhi-two]   [gurmukhi-one]   [script=gur2]
322\definefontfeature [kannada-two]    [kannada-one]    [script=knd2]
323\definefontfeature [malayalam-two]  [malayalam-one]  [script=mlm2]
324\definefontfeature [oriya-two]      [oriya-one]      [script=ory2]
325\definefontfeature [tamil-two]      [tamil-one]      [script=tml2]
326\definefontfeature [telugu-two]     [telugu-one]     [script=tel2]
327
328% mongolian
329
330\definefontfeature
331  [mongolian]
332  [default]
333  [script=mong,
334   init=yes,medi=yes,fina=yes,isol=yes,
335   rlig=yes,rclt=yes,calt=yes,
336  %dlig=yes,cswh=yes, % optional
337   mset]
338
339% tibetan
340
341\definefontfeature
342  [tibetan]
343  [always]
344  [script=tibt,
345   language=dflt,
346   locl=yes,
347   ccmp=yes,
348   abvs=yes,
349   blws=yes,
350   calt=yes,
351   liga=yes,
352   abvm=yes,
353   blwm=yes]
354
355% cjk
356
357\definefontfeature
358  [jamoforms]
359  [ljmo=yes,
360   tjmo=yes,
361   vjmo=yes]
362
363% \definefontfeature
364%   [japanese]
365%   [default]
366%   [language=jan]
367
368% \definefontfeature
369%   [simplified-chinese]
370%   [default]
371%   [language=zhs]
372
373% \definefontfeature
374%   [traditional-chinese]
375%   [default]
376%   [language=zht]
377
378% \definefontfeature
379%   [chinese]
380%   [simplified-chinese]
381
382% \definefontfeature
383%   [korean]
384%   [default]
385%   [language=kor]
386
387% symbols:
388
389\definefontfeature
390  [dingbats]
391  [mode=base,
392   goodies=dingbats,
393   unicoding=yes]
394
395% math:
396
397\definefontfeature
398  [mathematics]
399  [mode=base,
400   kern=yes,
401 % liga=yes, % makes no sense
402 % tlig=yes, % makes no sense
403 % trep=yes, % makes no sense
404   mathnolimitsmode={0,800}, % this looks okay on the average font
405   mathalternates=yes,
406   mathitalics=yes, % we pass them
407   mathdimensions=all,
408 % mathkerns=yes,
409 % mathgaps=yes,
410   language=dflt,
411   script=math]
412
413% Users can define this:
414%
415% \definefontfeature
416%   [oldmath]
417%   [oldmath=yes]
418
419\ifdefined\mathnolimitsmode
420    \mathnolimitsmode\plusone % font driven (only opentype)
421\fi
422
423\ifdefined\mathitalicsmode
424     \mathitalicsmode\plusone   % simple noads become zero
425   % \mathitalicsmode\plustwo   % idem but inner is kept (for testing)
426\fi
427
428% \adaptfontfeature[*math*][mathnolimitsmode=1000] % only subscript
429
430\definefontfeature
431  [mathematics-l2r]
432  [mathematics]
433  []
434
435% \definefontfeature
436%   [mathematics-r2l]
437%   [mathematics]
438%   [language=ara,
439%    rtlm=yes,
440%    locl=yes]
441
442\definefontfeature
443  [mathematics-r2l]
444  [mathematics]
445  [rtlm=yes,
446   locl=yes]
447
448\definefontfeature[virtualmath]              [mathematics]      % downward compatibility
449\definefontfeature[virtualmath-l2r]          [mathematics-l2r]  % downward compatibility
450\definefontfeature[virtualmath-r2l]          [mathematics-r2l]  % downward compatibility
451
452\definefontfeature[math-text]                [mathematics]      [ssty=no]
453\definefontfeature[math-script]              [mathematics]      [ssty=1,mathsize=yes]
454\definefontfeature[math-scriptscript]        [mathematics]      [ssty=2,mathsize=yes]
455
456\definefontfeature[math-text-l2r]            [mathematics-l2r]  [ssty=no]
457\definefontfeature[math-script-l2r]          [mathematics-l2r]  [ssty=1,mathsize=yes]
458\definefontfeature[math-scriptscript-l2r]    [mathematics-l2r]  [ssty=2,mathsize=yes]
459
460\definefontfeature[math-text-r2l]            [mathematics-r2l]  [ssty=no]
461\definefontfeature[math-script-r2l]          [mathematics-r2l]  [ssty=1,mathsize=yes]
462\definefontfeature[math-scriptscript-r2l]    [mathematics-r2l]  [ssty=2,mathsize=yes]
463
464\definefontfeature[math-nostack-text]        [math-text]        [nostackmath=yes]
465\definefontfeature[math-nostack-script]      [math-script]      [nostackmath=yes]
466\definefontfeature[math-nostack-scriptscript][math-scriptscript][nostackmath=yes]
467
468% \definefontfeature[mathtext]         [math-text]
469% \definefontfeature[mathscript]       [math-script]
470% \definefontfeature[mathscriptscript] [math-scriptscript]
471
472\definefontfeature
473  [missing]
474  [missing=yes]
475
476%D Nice to have too:
477
478\definefontfeature
479  [quality]
480  [expansion=quality,
481   protrusion=quality]
482
483\definefontfeature
484  [fullprotrusion]
485  [protrusion=pure]
486
487\definefontfeature
488  [slanted]
489  [slant=.2]
490
491% \definefontfeature
492%   [boldened]
493%   [extend=1.2]
494
495%D Neat:
496
497% By eye:
498%
499% \definefontfeature[boldened-10][effect={width=0.10,delta=1.0,hdelta=0.500,ddelta=0.150,vshift=0.125,extend=1.025,squeeze=0.99250}]
500% \definefontfeature[boldened-15][effect={width=0.15,delta=1.0,hdelta=0.500,ddelta=0.150,vshift=0.250,extend=1.050,squeeze=0.98750}]
501% \definefontfeature[boldened-20][effect={width=0.20,delta=1.0,hdelta=0.500,ddelta=0.150,vshift=0.375,extend=1.075,squeeze=0.98125}]
502% \definefontfeature[boldened-30][effect={width=0.30,delta=1.0,hdelta=0.500,ddelta=0.150,vshift=0.500,extend=1.100,squeeze=0.97500}]
503%
504% By calculation:
505%
506% \definefontfeature[boldened-10][effect={width=0.10,delta=1.0,hdelta=0.02500,ddelta=0.02500,vshift=0.02500,extend=1.050,squeeze=0.99500}]
507% \definefontfeature[boldened-15][effect={width=0.15,delta=1.0,hdelta=0.05625,ddelta=0.05625,vshift=0.05625,extend=1.075,squeeze=0.99250}]
508% \definefontfeature[boldened-20][effect={width=0.20,delta=1.0,hdelta=0.10000,ddelta=0.10000,vshift=0.10000,extend=1.100,squeeze=0.99000}]
509% \definefontfeature[boldened-30][effect={width=0.30,delta=1.0,hdelta=0.22500,ddelta=0.22500,vshift=0.22500,extend=1.150,squeeze=0.98500}]
510%
511% So we can do this:
512
513\definefontfeature[boldened-10][effect={width=0.10,auto=yes}]
514\definefontfeature[boldened-15][effect={width=0.15,auto=yes}]
515\definefontfeature[boldened-20][effect={width=0.20,auto=yes}]
516\definefontfeature[boldened-25][effect={width=0.25,auto=yes}]
517\definefontfeature[boldened-30][effect={width=0.30,auto=yes}]
518
519\definefontfeature
520  [boldened]
521  [boldened-30]
522
523%D Emoji etc:
524
525\definefontfeature[bandw:overlay][ccmp=yes,dist=yes]
526\definefontfeature[color:overlay][ccmp=yes,dist=yes,colr=yes]
527%definefontfeature[bandw:svg]    [ccmp=yes,dist=yes]
528\definefontfeature[color:svg]    [ccmp=yes,dist=yes,svg=yes]
529%definefontfeature[bandw:bitmap] [ccmp=yes,dist=yes,sbix=yes]
530\definefontfeature[color:bitmap] [ccmp=yes,dist=yes,sbix=yes] % also cblc
531
532% Plus an automatic one:
533
534\definefontfeature[color]        [ccmp=yes,dist=yes,color=auto]
535
536%D We define some colors that are used in tracing (for instance \OPENTYPE\
537%D features). We cannot yet inherit because no colors are predefined.
538
539\definecolor[font:init][r=.75]
540\definecolor[font:medi][g=.75]
541\definecolor[font:fina][b=.75]
542\definecolor[font:isol][r=.75,g=.75] % [y=.75]
543\definecolor[font:mark][r=.75,b=.75] % [m=.75]
544\definecolor[font:rest][b=.75,g=.75] % [c=.75]
545
546\definecolor[font:0] [s=1]
547\definecolor[font:1] [r=.75]
548\definecolor[font:2] [g=.75]
549\definecolor[font:3] [b=.75]
550\definecolor[font:4] [r=.75,g=.75]
551\definecolor[font:5] [r=.75,b=.75]
552\definecolor[font:6] [b=.75,g=.75]
553\definecolor[font:7] [r=.75]
554\definecolor[font:8] [g=.75]
555\definecolor[font:9] [b=.75]
556
557\definecolor[f:r:t][a=1,t=.25,r=1]
558\definecolor[f:g:t][a=1,t=.25,g=1]
559\definecolor[f:b:t][a=1,t=.25,b=1]
560\definecolor[f:c:t][a=1,t=.25,c=1]
561\definecolor[f:m:t][a=1,t=.25,m=1]
562\definecolor[f:y:t][a=1,t=.25,y=1]
563\definecolor[f:k:t][a=1,t=.25,s=0]
564\definecolor[f:s:t][a=1,t=.25,s=0]
565
566\definepalet % weird place
567  [layout]
568  [grid=trace:dr,
569   page=trace:dg,
570   profile=f:s:t,
571   one=f:y:t,
572   mix=f:b:t]
573
574%D Now we're up to some definitions.
575
576\definebodyfontenvironment
577  [\s!default]
578  [        \s!text=1.0,
579         \s!script=0.7,
580   \s!scriptscript=0.5,
581              \s!a=1.200,
582              \s!b=1.440,
583              \s!c=1.728,
584              \s!d=2.074,
585                 *=\font_currentfontscale, % wildcard
586              \s!x=0.8,
587             \s!xx=0.6,
588            \v!big=1.2,
589          \v!small=0.8,
590 \c!interlinespace=,
591             \s!em=\v!slanted]
592
593\definebodyfontenvironment
594  [20.7pt]
595  [        \s!text=20.7pt,
596         \s!script=\!!fourteenpointfour,
597   \s!scriptscript=\!!twelvepoint,
598              \s!x=17.3pt,
599             \s!xx=\!!fourteenpointfour,
600            \v!big=20.7pt,    % !!!!
601          \v!small=17.3pt]
602
603\definebodyfontenvironment
604  [17.3pt]
605  [        \s!text=17.3pt,
606         \s!script=\!!twelvepoint,
607   \s!scriptscript=\!!tenpoint,
608              \s!x=\!!fourteenpointfour,
609             \s!xx=\!!twelvepoint,
610            \v!big=20.7pt,
611          \v!small=\!!fourteenpointfour]
612
613\definebodyfontenvironment
614  [\!!fourteenpointfour]
615  [        \s!text=\!!fourteenpointfour,
616         \s!script=\!!elevenpoint,
617   \s!scriptscript=\!!ninepoint,
618              \s!x=\!!twelvepoint,
619             \s!xx=\!!tenpoint,
620            \v!big=17.3pt,
621          \v!small=\!!twelvepoint]
622
623\definebodyfontenvironment
624  [\!!twelvepoint]
625  [        \s!text=\!!twelvepoint,
626         \s!script=\!!ninepoint,
627   \s!scriptscript=\!!sevenpoint,
628              \s!x=\!!tenpoint,
629             \s!xx=\!!eightpoint,
630            \v!big=\!!fourteenpointfour,
631          \v!small=\!!tenpoint]
632
633\definebodyfontenvironment
634  [\!!elevenpoint]
635  [        \s!text=\!!elevenpoint,
636         \s!script=\!!eightpoint,
637   \s!scriptscript=\!!sixpoint,
638              \s!x=\!!ninepoint,
639             \s!xx=\!!sevenpoint,
640            \v!big=\!!twelvepoint,
641          \v!small=\!!ninepoint]
642
643\definebodyfontenvironment
644  [\!!tenpoint]
645  [        \s!text=\!!tenpoint,
646         \s!script=\!!sevenpoint,
647   \s!scriptscript=\!!fivepoint,
648              \s!x=\!!eightpoint,
649             \s!xx=\!!sixpoint,
650            \v!big=\!!twelvepoint,
651          \v!small=\!!eightpoint]
652
653\definebodyfontenvironment
654  [\!!ninepoint]
655  [        \s!text=\!!ninepoint,
656         \s!script=\!!sevenpoint,
657   \s!scriptscript=\!!fivepoint,
658              \s!x=\!!sevenpoint,
659             \s!xx=\!!fivepoint,
660            \v!big=\!!elevenpoint,
661          \v!small=\!!sevenpoint]
662
663\definebodyfontenvironment
664  [\!!eightpoint]
665  [        \s!text=\!!eightpoint,
666         \s!script=\!!sixpoint,
667   \s!scriptscript=\!!fivepoint,
668              \s!x=\!!sixpoint,
669             \s!xx=\!!fivepoint,
670            \v!big=\!!tenpoint,
671          \v!small=\!!sixpoint]
672
673\definebodyfontenvironment
674  [\!!sevenpoint]
675  [        \s!text=\!!sevenpoint,
676         \s!script=\!!sixpoint,
677   \s!scriptscript=\!!fivepoint,
678              \s!x=\!!sixpoint,
679             \s!xx=\!!fivepoint,
680            \v!big=\!!ninepoint,
681          \v!small=\!!fivepoint]
682
683\definebodyfontenvironment
684  [\!!sixpoint]
685  [        \s!text=\!!sixpoint,
686         \s!script=\!!fivepoint,
687   \s!scriptscript=\!!fivepoint,
688              \s!x=\!!fivepoint,
689             \s!xx=\!!fivepoint,
690            \v!big=\!!eightpoint,
691          \v!small=\!!fivepoint]
692
693\definebodyfontenvironment
694  [\!!fivepoint]
695  [        \s!text=\!!fivepoint,
696         \s!script=\!!fivepoint,
697   \s!scriptscript=\!!fivepoint,
698              \s!x=\!!fivepoint,
699             \s!xx=\!!fivepoint,
700            \v!big=\!!sevenpoint,
701          \v!small=\!!fivepoint]
702
703\definebodyfontenvironment
704  [\!!fourpoint]
705  [        \s!text=\!!fourpoint,
706         \s!script=\!!fourpoint,
707   \s!scriptscript=\!!fourpoint,
708              \s!x=\!!fourpoint,
709             \s!xx=\!!fourpoint,
710            \v!big=\!!sixpoint,
711          \v!small=\!!fourpoint]
712
713\definebodyfontswitch [fourteenpointfour] [\!!fourteenpointfour]
714\definebodyfontswitch [twelvepoint]       [\!!twelvepoint]
715\definebodyfontswitch [elevenpoint]       [\!!elevenpoint]
716\definebodyfontswitch [tenpoint]          [\!!tenpoint]
717\definebodyfontswitch [ninepoint]         [\!!ninepoint]
718\definebodyfontswitch [eightpoint]        [\!!eightpoint]
719\definebodyfontswitch [sevenpoint]        [\!!sevenpoint]
720\definebodyfontswitch [sixpoint]          [\!!sixpoint]
721\definebodyfontswitch [fivepoint]         [\!!fivepoint]
722\definebodyfontswitch [fourpoint]         [\!!fourpoint]
723
724%D So far.
725
726\definefontstyle [\s!hw] [\s!hw]
727\definefontstyle [\s!cg] [\s!cg]
728
729\definefontstyle [\v!roman,\v!serif,\v!regular]    [\s!rm]
730\definefontstyle [\v!sansserif,\v!sans,\v!support] [\s!ss]
731\definefontstyle [\v!teletype,\v!type,\v!mono]     [\s!tt]
732\definefontstyle [\v!handwritten]                  [\s!hw]
733\definefontstyle [\v!calligraphic]                 [\s!cg]
734\definefontstyle [\v!math,\v!mathematics]          [\s!mm]
735
736\definefontalternative[\s!tf]
737\definefontalternative[\s!bf]
738\definefontalternative[\s!it]
739\definefontalternative[\s!sl]
740\definefontalternative[\s!bs]
741\definefontalternative[\s!bi]
742\definefontalternative[\s!sc]
743
744\definefontsize[\s!a] \definefontsize[\s!b]
745\definefontsize[\s!c] \definefontsize[\s!d]
746
747\definealternativestyle [\v!mediaeval]                              [\os]    []
748\definealternativestyle [\v!normal]                                 [\tf]    []
749\definealternativestyle [\v!bold]                                   [\bf]    []
750\definealternativestyle [\v!type]                                   [\tt]    []
751\definealternativestyle [\v!mono]                                   [\tt]    []
752\definealternativestyle [\v!slanted]                                [\sl]    []
753\definealternativestyle [\v!italic]                                 [\it]    []
754\definealternativestyle [\v!boldslanted,\v!slantedbold]             [\bs]    []
755\definealternativestyle [\v!bolditalic,\v!italicbold]               [\bi]    []
756
757\definealternativestyle [\v!small,\v!smallnormal]                   [\setsmallbodyfont\tf] []
758\definealternativestyle [\v!smallbold]                              [\setsmallbodyfont\bf] []
759\definealternativestyle [\v!smalltype]                              [\setsmallbodyfont\tt] []
760\definealternativestyle [\v!smallitalic,\v!smallslanted]            [\setsmallbodyfont\sl] []
761\definealternativestyle [\v!smallboldslanted,\v!smallslantedbold]   [\setsmallbodyfont\bs] []
762\definealternativestyle [\v!smallbolditalic,\v!smallitalicbold]     [\setsmallbodyfont\bi] []
763
764\definealternativestyle [\v!bigger]                                 [\setbigbodyfont  \tf] []
765\definealternativestyle [\v!smaller]                                [\setsmallbodyfont\tf] []
766
767\definealternativestyle [\v!sans,\v!sansserif]                      [\ss]
768\definealternativestyle [\v!roman,\v!serif,\v!regular]              [\rm]
769\definealternativestyle [\v!handwritten]                            [\hw]
770\definealternativestyle [\v!calligraphic]                           [\cg]
771
772\definealternativestyle [\v!sansnormal]  [\ss\tf] []
773\definealternativestyle [\v!sansbold]    [\ss\bf] []
774\definealternativestyle [\v!serifnormal] [\rm\tf] []
775\definealternativestyle [\v!serifbold]   [\rm\bf] []
776\definealternativestyle [\v!mononormal]  [\tt\tf] []
777\definealternativestyle [\v!monobold]    [\tt\bf] []
778
779\definealternativestyle [typeface]    [\typeface]    [] % no translation here (quite basic)
780\definealternativestyle [boldface]    [\boldface]    []
781\definealternativestyle [slantedface] [\slantedface] []
782\definealternativestyle [italicface]  [\italicface]  []
783\definealternativestyle [swapface]    [\swapface]    []
784
785\definealternativestyle [emphasize]   [\em]          [\em] % new
786
787% For Alan:
788
789\definealternativestyle
790  [\v!camel]
791  [{\setcharactercasing[\v!camel]}]
792  [{\setcharactercasing[\v!camel]}]
793
794% % maybe we need interface neutral as well (for use in cld):
795%
796% \letcscsname\mediaeval       \csname\v!mediaeval       \endcsname
797% \letcscsname\normal          \csname\v!normal          \endcsname
798% \letcscsname\bold            \csname\v!bold            \endcsname
799% \letcscsname\mono            \csname\v!mono            \endcsname
800% \letcscsname\slanted         \csname\v!slanted         \endcsname
801% \letcscsname\italic          \csname\v!italic          \endcsname
802% \letcscsname\boldslanted     \csname\v!boldslanted     \endcsname
803% \letcscsname\slantedbold     \csname\v!slantedbold     \endcsname
804% \letcscsname\bolditalic      \csname\v!bolditalic      \endcsname
805% \letcscsname\italicbold      \csname\v!italicbold      \endcsname
806%
807% \letcscsname\small           \csname\v!small           \endcsname
808% \letcscsname\smallnormal     \csname\v!smallnormal     \endcsname
809% \letcscsname\smallbold       \csname\v!smallbold       \endcsname
810% \letcscsname\smalltype       \csname\v!smalltype       \endcsname
811% \letcscsname\smallslanted    \csname\v!smallslanted    \endcsname
812% \letcscsname\smallboldslanted\csname\v!smallboldslanted\endcsname
813% \letcscsname\smallslantedbold\csname\v!smallslantedbold\endcsname
814% \letcscsname\smallbolditalic \csname\v!smallbolditalic \endcsname
815% \letcscsname\smallitalicbold \csname\v!smallitalicbold \endcsname
816%
817% \letcscsname\bigger          \csname\v!bigger          \endcsname
818% \letcscsname\smaller         \csname\v!smaller         \endcsname
819%
820% \letcscsname\sans            \csname\v!sans            \endcsname
821% \letcscsname\sansserif       \csname\v!sansserif       \endcsname
822% \letcscsname\sansbold        \csname\v!sansbold        \endcsname
823
824%D We can go on and on and on:
825%D
826%D \starttyping
827%D \setupbodyfontenvironment[default][p=0.8,q=0.6]
828%D \definefontsize[p]
829%D \definefontsize[q]
830%D \stoptyping
831
832%D Slow but handy:
833
834\definealternativestyle [\v!smallbodyfont] [\setsmallbodyfont] []
835\definealternativestyle [\v!bigbodyfont]   [\setbigbodyfont]   []
836
837%D We treat {\sc Small Caps} and \cap {Pseudo Caps} a bit
838%D different. We also provide an \WORD {uppercase} style.
839
840\definealternativestyle [\v!WORD]    [{\setcharactercasing[\v!WORD   ]}] [{\setcharactercasing[\v!WORD   ]}]
841\definealternativestyle [\v!word]    [{\setcharactercasing[\v!word   ]}] [{\setcharactercasing[\v!word   ]}]
842\definealternativestyle [\v!Word]    [{\setcharactercasing[\v!Word   ]}] [{\setcharactercasing[\v!Word   ]}]
843\definealternativestyle [\v!Words]   [{\setcharactercasing[\v!Words  ]}] [{\setcharactercasing[\v!Words  ]}]
844\definealternativestyle [\v!capital] [{\setcharactercasing[\v!capital]}] [{\setcharactercasing[\v!capital]}]
845\definealternativestyle [\v!Capital] [{\setcharactercasing[\v!Capital]}] [{\setcharactercasing[\v!Capital]}]
846\definealternativestyle [\v!mixed]   [{\setcharactercasing[\v!mixed  ]}] [{\setcharactercasing[\v!mixed  ]}]
847
848\definealternativestyle [\v!cap]     [{\setcharactercasing[\v!cap    ]}] [{\setcharactercasing[\v!cap    ]}]
849\definealternativestyle [\v!Cap]     [{\setcharactercasing[\v!Cap    ]}] [{\setcharactercasing[\v!Cap    ]}]
850
851%D From now (2013-03-17) on we have:
852
853\definefontfeature[f:smallcaps][smcp=yes]
854\definefontfeature[f:oldstyle] [onum=yes]
855\definefontfeature[f:tabular]  [tnum=yes]
856\definefontfeature[f:superiors][sups=yes]
857\definefontfeature[f:inferiors][subs=yes]
858\definefontfeature[f:fractions][frac=yes]
859\definefontfeature[f:kern]     [kern=yes]
860\definefontfeature[f:kerns]    [kern=yes]
861
862\definealternativestyle [\v!smallcaps] [\setsmallcaps] [\setsmallcaps]
863\definealternativestyle [\v!oldstyle]  [\setoldstyle ] [\setoldstyle ]
864\definealternativestyle [\v!fractions] [\setfractions\resetbreakpoints] [\setfractions\resetbreakpoints]
865
866\unexpanded\def\setsmallcaps{\doaddfeature{f:smallcaps}}
867\unexpanded\def\setoldstyle {\doaddfeature{f:oldstyle}}
868\unexpanded\def\settabular  {\doaddfeature{f:tabular}}
869\unexpanded\def\setsuperiors{\doaddfeature{f:superiors}}
870\unexpanded\def\setfractions{\doaddfeature{f:fractions}}
871
872% \unexpanded\def\frc#1#2%
873%   {\dontleavehmode
874%    \begingroup
875%    \addff{frac}%
876%    \resetbreakpoints
877%    #1/#2%
878%    \endgroup}
879
880%D \macros
881%D   {uppercasing, lowercasing}
882
883\definefontfeature[lowercasing][lowercasing=yes]
884\definefontfeature[uppercasing][uppercasing=yes]
885
886\unexpanded\def\uppercasing{\addff{uppercasing}}
887\unexpanded\def\lowercasing{\addff{lowercasing}}
888
889%D \macros
890%D   {tinyfont}
891%D
892%D By default we load the Computer Modern Roman fonts (but
893%D not yet at this moment) and activate the 12pt roman
894%D bodyfont. Sans serif and teletype are also available and
895%D can be called for by \type{\ss} and \type{\tt}. Loading
896%D takes place elsewhere.
897%D
898%D For tracing purposes we define:
899
900\definefont[tinyfont][file:dejavusansmono at 1ex]
901
902%D \macros
903%D   {infofont}
904%D
905%D The second situation occurs when we enable the info mode,
906%D and put all kind of status information in the margin. We
907%D don't want huge switches to the main bodyfont and style, so
908%D here too we use a direct method.
909
910\let\infofont         \relax
911\let\infofontbold     \relax
912\let\smallinfofont    \relax
913\let\smallinfofontbold\relax
914
915\definefont[infofont]         [file:dejavusansmono*none      at 6pt]
916\definefont[infofontbold]     [file:dejavusansmono-bold*none at 6pt]
917\definefont[smallinfofont]    [file:dejavusansmono*none      at 3pt]
918\definefont[smallinfofontbold][file:dejavusansmono-bold*none at 3pt]
919
920%D Optimization (later we overload in math). Also needed in order to get \type {\ss}
921%D properly defined.
922
923\unexpanded\def\normaltf{\let\fontalternative\s!tf\font_helpers_synchronize_font}
924\unexpanded\def\normalbf{\let\fontalternative\s!bf\font_helpers_synchronize_font}
925\unexpanded\def\normalit{\let\fontalternative\s!it\font_helpers_synchronize_font}
926\unexpanded\def\normalsl{\let\fontalternative\s!sl\font_helpers_synchronize_font}
927\unexpanded\def\normalbi{\let\fontalternative\s!bi\font_helpers_synchronize_font}
928\unexpanded\def\normalbs{\let\fontalternative\s!bs\font_helpers_synchronize_font}
929
930\let\tf\normaltf
931\let\bf\normalbf
932\let\it\normalit
933\let\sl\normalsl
934\let\bi\normalbi
935\let\bs\normalbs
936
937\unexpanded\def\normalrm{\font_helpers_set_current_font_style{\s!rm}}
938\unexpanded\def\normalss{\font_helpers_set_current_font_style{\s!ss}}
939\unexpanded\def\normaltt{\font_helpers_set_current_font_style{\s!tt}}
940
941\pushoverloadmode
942
943\let\rm\normalrm
944\let\ss\normalss
945\let\tt\normaltt
946
947\popoverloadmode
948
949\protect \endinput
950
951% LM math vs CM math (analysis by Taco):
952%
953% Computer Modern Roman : Donald Knuth
954% Latin Modern          : LM Font Revision Team
955%
956% lmex10.tfm  % identical
957% lmmi5.tfm   % identical
958% lmmi6.tfm   % identical
959% lmmi7.tfm   % identical
960% lmmi8.tfm   % identical
961% lmmi9.tfm   % identical
962% lmmi10.tfm  % identical
963% lmmi12.tfm  % identical
964% lmmib10.tfm % identical
965% lmsy5.tfm   % extra chars: 254,255 (octal)
966% lmsy6.tfm   % extra chars: 254,255 (octal)
967% lmsy7.tfm   % extra chars: 254,255 (octal)
968% lmsy8.tfm   % extra chars: 254,255 (octal)
969% lmsy9.tfm   % extra chars: 254,255 (octal)
970% lmsy10.tfm  % extra chars: 254,255 (octal)
971% lmbsy10.tfm % extra chars: 254,255 (octal)
972%
973% From the 'AMS' set:
974%
975% lmmib5.tfm  % identical
976% lmmib7.tfm  % identical
977% lmbsy5.tfm  % extra chars: 254,255 (octal)
978% lmbsy7.tfm  % extra chars: 254,255 (octal)
979%
980% The two extra characters are:
981%
982%   /lessorequalslant
983%   /greaterorequalslant
984
985% \unprotect
986%
987% \definehighlight[\v!italic    ][\c!command=\v!no,\c!style=\v!italic]
988% \definehighlight[\v!bold      ][\c!command=\v!no,\c!style=\v!bold]
989% \definehighlight[\v!bolditalic][\c!command=\v!no,\c!style=\v!bolditalic]
990% \definehighlight[\v!mono]      [\c!command=\v!no,\c!style=\v!mono]
991% \definehighlight[\v!monobold]  [\c!command=\v!no,\c!style=\v!monobold]
992%
993% \definehighlight[important]    [\c!command=\v!no,\c!style=\v!bold]
994% \definehighlight[unimportant]  [\c!command=\v!no,\c!color=darkgray]
995% \definehighlight[warning]      [\c!command=\v!no,\c!style=\v!bold,\c!color=darkblue]
996% \definehighlight[error]        [\c!command=\v!no,\c!style=\v!bold,\c!color=darkred]
997%
998% \protect
999%
1000% \starttext
1001%     \highlight[italic]     {italic}
1002%     \highlight[bolditalic] {bolditalic}
1003%     \highlight[bold]       {bold}
1004%     \highlight[mono]       {mono}
1005%     \highlight[monobold]   {monobold}
1006%     \highlight[important]  {important}
1007%     \highlight[unimportant]{unimportant}
1008%     \highlight[warning]    {warning}
1009%     \highlight[error]      {error}
1010% \stoptext
1011