font-pre.mkiv /size: 28 Kb    last modification: 2023-12-21 09:44
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   emulatelmtx=yes,
407 % mathitalics=yes, % we pass them
408 % mathdimensions=all,
409 % mathkerns=yes,
410 % mathgaps=yes,
411   language=dflt,
412   script=math]
413
414% Users can define this:
415%
416% \definefontfeature
417%   [oldmath]
418%   [oldmath=yes]
419
420\ifdefined\variablefam
421    \variablefam\pluscclv
422\fi
423
424% \ifdefined\mathnolimitsmode
425%     \mathnolimitsmode\plusone % font driven (only opentype)
426% \fi
427
428\ifdefined\mathitalicsmode
429     \mathitalicsmode\plusone   % simple noads become zero
430   % \mathitalicsmode\plustwo   % idem but inner is kept (for testing)
431\fi
432
433% \adaptfontfeature[*math*][mathnolimitsmode=1000] % only subscript
434
435\definefontfeature
436  [mathematics-l2r]
437  [mathematics]
438  []
439
440% \definefontfeature
441%   [mathematics-r2l]
442%   [mathematics]
443%   [language=ara,
444%    rtlm=yes,
445%    locl=yes]
446
447\definefontfeature
448  [mathematics-r2l]
449  [mathematics]
450  [rtlm=yes,
451   locl=yes]
452
453\definefontfeature[virtualmath]              [mathematics]      % downward compatibility
454\definefontfeature[virtualmath-l2r]          [mathematics-l2r]  % downward compatibility
455\definefontfeature[virtualmath-r2l]          [mathematics-r2l]  % downward compatibility
456
457\definefontfeature[math-text]                [mathematics]      [ssty=no]
458\definefontfeature[math-script]              [mathematics]      [ssty=1,mathsize=yes]
459\definefontfeature[math-scriptscript]        [mathematics]      [ssty=2,mathsize=yes]
460
461\definefontfeature[math-text-l2r]            [mathematics-l2r]  [ssty=no]
462\definefontfeature[math-script-l2r]          [mathematics-l2r]  [ssty=1,mathsize=yes]
463\definefontfeature[math-scriptscript-l2r]    [mathematics-l2r]  [ssty=2,mathsize=yes]
464
465\definefontfeature[math-text-r2l]            [mathematics-r2l]  [ssty=no]
466\definefontfeature[math-script-r2l]          [mathematics-r2l]  [ssty=1,mathsize=yes]
467\definefontfeature[math-scriptscript-r2l]    [mathematics-r2l]  [ssty=2,mathsize=yes]
468
469\definefontfeature[math-nostack-text]        [math-text]        [nostackmath=yes]
470\definefontfeature[math-nostack-script]      [math-script]      [nostackmath=yes]
471\definefontfeature[math-nostack-scriptscript][math-scriptscript][nostackmath=yes]
472
473% \definefontfeature[mathtext]         [math-text]
474% \definefontfeature[mathscript]       [math-script]
475% \definefontfeature[mathscriptscript] [math-scriptscript]
476
477\definefontfeature
478  [missing]
479  [missing=yes]
480
481%D Nice to have too:
482
483\definefontfeature
484  [quality]
485  [expansion=quality,
486   protrusion=quality]
487
488\definefontfeature
489  [fullprotrusion]
490  [protrusion=pure]
491
492\definefontfeature
493  [slanted]
494  [slant=.2]
495
496% \definefontfeature
497%   [boldened]
498%   [extend=1.2]
499
500%D Neat:
501
502% By eye:
503%
504% \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}]
505% \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}]
506% \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}]
507% \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}]
508%
509% By calculation:
510%
511% \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}]
512% \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}]
513% \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}]
514% \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}]
515%
516% So we can do this:
517
518\definefontfeature[boldened-10][effect={width=0.10,auto=yes}]
519\definefontfeature[boldened-15][effect={width=0.15,auto=yes}]
520\definefontfeature[boldened-20][effect={width=0.20,auto=yes}]
521\definefontfeature[boldened-25][effect={width=0.25,auto=yes}]
522\definefontfeature[boldened-30][effect={width=0.30,auto=yes}]
523
524\definefontfeature
525  [boldened]
526  [boldened-30]
527
528%D Emoji etc:
529
530\definefontfeature[bandw:overlay][ccmp=yes,dist=yes]
531\definefontfeature[color:overlay][ccmp=yes,dist=yes,colr=yes]
532%definefontfeature[bandw:svg]    [ccmp=yes,dist=yes]
533\definefontfeature[color:svg]    [ccmp=yes,dist=yes,svg=yes]
534%definefontfeature[bandw:bitmap] [ccmp=yes,dist=yes,sbix=yes]
535\definefontfeature[color:bitmap] [ccmp=yes,dist=yes,sbix=yes] % also cblc
536
537% Plus an automatic one:
538
539\definefontfeature[color]        [ccmp=yes,dist=yes,color=auto]
540
541%D We define some colors that are used in tracing (for instance \OPENTYPE\
542%D features). We cannot yet inherit because no colors are predefined.
543
544\definecolor[font:init][r=.75]
545\definecolor[font:medi][g=.75]
546\definecolor[font:fina][b=.75]
547\definecolor[font:isol][r=.75,g=.75] % [y=.75]
548\definecolor[font:mark][r=.75,b=.75] % [m=.75]
549\definecolor[font:rest][b=.75,g=.75] % [c=.75]
550
551\definecolor[font:0] [s=1]
552\definecolor[font:1] [r=.75]
553\definecolor[font:2] [g=.75]
554\definecolor[font:3] [b=.75]
555\definecolor[font:4] [r=.75,g=.75]
556\definecolor[font:5] [r=.75,b=.75]
557\definecolor[font:6] [b=.75,g=.75]
558\definecolor[font:7] [r=.75]
559\definecolor[font:8] [g=.75]
560\definecolor[font:9] [b=.75]
561
562\definecolor[f:r:t][a=1,t=.25,r=1]
563\definecolor[f:g:t][a=1,t=.25,g=1]
564\definecolor[f:b:t][a=1,t=.25,b=1]
565\definecolor[f:c:t][a=1,t=.25,c=1]
566\definecolor[f:m:t][a=1,t=.25,m=1]
567\definecolor[f:y:t][a=1,t=.25,y=1]
568\definecolor[f:k:t][a=1,t=.25,s=0]
569\definecolor[f:s:t][a=1,t=.25,s=0]
570
571\definepalet % weird place
572  [layout]
573  [grid=trace:dr,
574   page=trace:dg,
575   profile=f:s:t,
576   one=f:y:t,
577   mix=f:b:t]
578
579%D Now we're up to some definitions.
580
581\definebodyfontenvironment
582  [\s!default]
583  [        \s!text=1.0,
584         \s!script=0.7,
585   \s!scriptscript=0.5,
586              \s!a=1.200,
587              \s!b=1.440,
588              \s!c=1.728,
589              \s!d=2.074,
590                 *=\font_currentfontscale, % wildcard
591              \s!x=0.8,
592             \s!xx=0.6,
593            \v!big=1.2,
594          \v!small=0.8,
595 \c!interlinespace=,
596             \s!em=\v!slanted]
597
598\definebodyfontenvironment
599  [20.7pt]
600  [        \s!text=20.7pt,
601         \s!script=\!!fourteenpointfour,
602   \s!scriptscript=\!!twelvepoint,
603              \s!x=17.3pt,
604             \s!xx=\!!fourteenpointfour,
605            \v!big=20.7pt,    % !!!!
606          \v!small=17.3pt]
607
608\definebodyfontenvironment
609  [17.3pt]
610  [        \s!text=17.3pt,
611         \s!script=\!!twelvepoint,
612   \s!scriptscript=\!!tenpoint,
613              \s!x=\!!fourteenpointfour,
614             \s!xx=\!!twelvepoint,
615            \v!big=20.7pt,
616          \v!small=\!!fourteenpointfour]
617
618\definebodyfontenvironment
619  [\!!fourteenpointfour]
620  [        \s!text=\!!fourteenpointfour,
621         \s!script=\!!elevenpoint,
622   \s!scriptscript=\!!ninepoint,
623              \s!x=\!!twelvepoint,
624             \s!xx=\!!tenpoint,
625            \v!big=17.3pt,
626          \v!small=\!!twelvepoint]
627
628\definebodyfontenvironment
629  [\!!twelvepoint]
630  [        \s!text=\!!twelvepoint,
631         \s!script=\!!ninepoint,
632   \s!scriptscript=\!!sevenpoint,
633              \s!x=\!!tenpoint,
634             \s!xx=\!!eightpoint,
635            \v!big=\!!fourteenpointfour,
636          \v!small=\!!tenpoint]
637
638\definebodyfontenvironment
639  [\!!elevenpoint]
640  [        \s!text=\!!elevenpoint,
641         \s!script=\!!eightpoint,
642   \s!scriptscript=\!!sixpoint,
643              \s!x=\!!ninepoint,
644             \s!xx=\!!sevenpoint,
645            \v!big=\!!twelvepoint,
646          \v!small=\!!ninepoint]
647
648\definebodyfontenvironment
649  [\!!tenpoint]
650  [        \s!text=\!!tenpoint,
651         \s!script=\!!sevenpoint,
652   \s!scriptscript=\!!fivepoint,
653              \s!x=\!!eightpoint,
654             \s!xx=\!!sixpoint,
655            \v!big=\!!twelvepoint,
656          \v!small=\!!eightpoint]
657
658\definebodyfontenvironment
659  [\!!ninepoint]
660  [        \s!text=\!!ninepoint,
661         \s!script=\!!sevenpoint,
662   \s!scriptscript=\!!fivepoint,
663              \s!x=\!!sevenpoint,
664             \s!xx=\!!fivepoint,
665            \v!big=\!!elevenpoint,
666          \v!small=\!!sevenpoint]
667
668\definebodyfontenvironment
669  [\!!eightpoint]
670  [        \s!text=\!!eightpoint,
671         \s!script=\!!sixpoint,
672   \s!scriptscript=\!!fivepoint,
673              \s!x=\!!sixpoint,
674             \s!xx=\!!fivepoint,
675            \v!big=\!!tenpoint,
676          \v!small=\!!sixpoint]
677
678\definebodyfontenvironment
679  [\!!sevenpoint]
680  [        \s!text=\!!sevenpoint,
681         \s!script=\!!sixpoint,
682   \s!scriptscript=\!!fivepoint,
683              \s!x=\!!sixpoint,
684             \s!xx=\!!fivepoint,
685            \v!big=\!!ninepoint,
686          \v!small=\!!fivepoint]
687
688\definebodyfontenvironment
689  [\!!sixpoint]
690  [        \s!text=\!!sixpoint,
691         \s!script=\!!fivepoint,
692   \s!scriptscript=\!!fivepoint,
693              \s!x=\!!fivepoint,
694             \s!xx=\!!fivepoint,
695            \v!big=\!!eightpoint,
696          \v!small=\!!fivepoint]
697
698\definebodyfontenvironment
699  [\!!fivepoint]
700  [        \s!text=\!!fivepoint,
701         \s!script=\!!fivepoint,
702   \s!scriptscript=\!!fivepoint,
703              \s!x=\!!fivepoint,
704             \s!xx=\!!fivepoint,
705            \v!big=\!!sevenpoint,
706          \v!small=\!!fivepoint]
707
708\definebodyfontenvironment
709  [\!!fourpoint]
710  [        \s!text=\!!fourpoint,
711         \s!script=\!!fourpoint,
712   \s!scriptscript=\!!fourpoint,
713              \s!x=\!!fourpoint,
714             \s!xx=\!!fourpoint,
715            \v!big=\!!sixpoint,
716          \v!small=\!!fourpoint]
717
718\definebodyfontswitch [fourteenpointfour] [\!!fourteenpointfour]
719\definebodyfontswitch [twelvepoint]       [\!!twelvepoint]
720\definebodyfontswitch [elevenpoint]       [\!!elevenpoint]
721\definebodyfontswitch [tenpoint]          [\!!tenpoint]
722\definebodyfontswitch [ninepoint]         [\!!ninepoint]
723\definebodyfontswitch [eightpoint]        [\!!eightpoint]
724\definebodyfontswitch [sevenpoint]        [\!!sevenpoint]
725\definebodyfontswitch [sixpoint]          [\!!sixpoint]
726\definebodyfontswitch [fivepoint]         [\!!fivepoint]
727\definebodyfontswitch [fourpoint]         [\!!fourpoint]
728
729%D So far.
730
731\definefontstyle [\s!hw] [\s!hw]
732\definefontstyle [\s!cg] [\s!cg]
733
734\definefontstyle [\v!roman,\v!serif,\v!regular]    [\s!rm]
735\definefontstyle [\v!sansserif,\v!sans,\v!support] [\s!ss]
736\definefontstyle [\v!teletype,\v!type,\v!mono]     [\s!tt]
737\definefontstyle [\v!handwritten]                  [\s!hw]
738\definefontstyle [\v!calligraphic]                 [\s!cg]
739\definefontstyle [\v!math,\v!mathematics]          [\s!mm]
740
741\definefontalternative[\s!tf]
742\definefontalternative[\s!bf]
743\definefontalternative[\s!it]
744\definefontalternative[\s!sl]
745\definefontalternative[\s!bs]
746\definefontalternative[\s!bi]
747\definefontalternative[\s!sc]
748
749\definefontsize[\s!a] \definefontsize[\s!b]
750\definefontsize[\s!c] \definefontsize[\s!d]
751
752\definealternativestyle [\v!mediaeval]                              [\os]    []
753\definealternativestyle [\v!normal]                                 [\tf]    []
754\definealternativestyle [\v!bold]                                   [\bf]    []
755\definealternativestyle [\v!type]                                   [\tt]    []
756\definealternativestyle [\v!mono]                                   [\tt]    []
757\definealternativestyle [\v!slanted]                                [\sl]    []
758\definealternativestyle [\v!italic]                                 [\it]    []
759\definealternativestyle [\v!boldslanted,\v!slantedbold]             [\bs]    []
760\definealternativestyle [\v!bolditalic,\v!italicbold]               [\bi]    []
761
762\definealternativestyle [\v!small,\v!smallnormal]                   [\setsmallbodyfont\tf] []
763\definealternativestyle [\v!smallbold]                              [\setsmallbodyfont\bf] []
764\definealternativestyle [\v!smalltype]                              [\setsmallbodyfont\tt] []
765\definealternativestyle [\v!smallitalic,\v!smallslanted]            [\setsmallbodyfont\sl] []
766\definealternativestyle [\v!smallboldslanted,\v!smallslantedbold]   [\setsmallbodyfont\bs] []
767\definealternativestyle [\v!smallbolditalic,\v!smallitalicbold]     [\setsmallbodyfont\bi] []
768
769\definealternativestyle [\v!bigger]                                 [\setbigbodyfont  \tf] []
770\definealternativestyle [\v!smaller]                                [\setsmallbodyfont\tf] []
771
772\definealternativestyle [\v!sans,\v!sansserif]                      [\ss]
773\definealternativestyle [\v!roman,\v!serif,\v!regular]              [\rm]
774\definealternativestyle [\v!handwritten]                            [\hw]
775\definealternativestyle [\v!calligraphic]                           [\cg]
776
777\definealternativestyle [\v!sansnormal]  [\ss\tf] []
778\definealternativestyle [\v!sansbold]    [\ss\bf] []
779\definealternativestyle [\v!serifnormal] [\rm\tf] []
780\definealternativestyle [\v!serifbold]   [\rm\bf] []
781\definealternativestyle [\v!mononormal]  [\tt\tf] []
782\definealternativestyle [\v!monobold]    [\tt\bf] []
783
784\definealternativestyle [typeface]    [\typeface]    [] % no translation here (quite basic)
785\definealternativestyle [boldface]    [\boldface]    []
786\definealternativestyle [slantedface] [\slantedface] []
787\definealternativestyle [italicface]  [\italicface]  []
788\definealternativestyle [swapface]    [\swapface]    []
789
790\definealternativestyle [emphasize]   [\em]          [\em] % new
791
792% For Alan:
793
794\definealternativestyle
795  [\v!camel]
796  [{\setcharactercasing[\v!camel]}]
797  [{\setcharactercasing[\v!camel]}]
798
799% % maybe we need interface neutral as well (for use in cld):
800%
801% \letcscsname\mediaeval       \csname\v!mediaeval       \endcsname
802% \letcscsname\normal          \csname\v!normal          \endcsname
803% \letcscsname\bold            \csname\v!bold            \endcsname
804% \letcscsname\mono            \csname\v!mono            \endcsname
805% \letcscsname\slanted         \csname\v!slanted         \endcsname
806% \letcscsname\italic          \csname\v!italic          \endcsname
807% \letcscsname\boldslanted     \csname\v!boldslanted     \endcsname
808% \letcscsname\slantedbold     \csname\v!slantedbold     \endcsname
809% \letcscsname\bolditalic      \csname\v!bolditalic      \endcsname
810% \letcscsname\italicbold      \csname\v!italicbold      \endcsname
811%
812% \letcscsname\small           \csname\v!small           \endcsname
813% \letcscsname\smallnormal     \csname\v!smallnormal     \endcsname
814% \letcscsname\smallbold       \csname\v!smallbold       \endcsname
815% \letcscsname\smalltype       \csname\v!smalltype       \endcsname
816% \letcscsname\smallslanted    \csname\v!smallslanted    \endcsname
817% \letcscsname\smallboldslanted\csname\v!smallboldslanted\endcsname
818% \letcscsname\smallslantedbold\csname\v!smallslantedbold\endcsname
819% \letcscsname\smallbolditalic \csname\v!smallbolditalic \endcsname
820% \letcscsname\smallitalicbold \csname\v!smallitalicbold \endcsname
821%
822% \letcscsname\bigger          \csname\v!bigger          \endcsname
823% \letcscsname\smaller         \csname\v!smaller         \endcsname
824%
825% \letcscsname\sans            \csname\v!sans            \endcsname
826% \letcscsname\sansserif       \csname\v!sansserif       \endcsname
827% \letcscsname\sansbold        \csname\v!sansbold        \endcsname
828
829%D We can go on and on and on:
830%D
831%D \starttyping
832%D \setupbodyfontenvironment[default][p=0.8,q=0.6]
833%D \definefontsize[p]
834%D \definefontsize[q]
835%D \stoptyping
836
837%D Slow but handy:
838
839\definealternativestyle [\v!smallbodyfont] [\setsmallbodyfont] []
840\definealternativestyle [\v!bigbodyfont]   [\setbigbodyfont]   []
841
842%D We treat {\sc Small Caps} and \cap {Pseudo Caps} a bit
843%D different. We also provide an \WORD {uppercase} style.
844
845\definealternativestyle [\v!WORD]    [{\setcharactercasing[\v!WORD   ]}] [{\setcharactercasing[\v!WORD   ]}]
846\definealternativestyle [\v!word]    [{\setcharactercasing[\v!word   ]}] [{\setcharactercasing[\v!word   ]}]
847\definealternativestyle [\v!Word]    [{\setcharactercasing[\v!Word   ]}] [{\setcharactercasing[\v!Word   ]}]
848\definealternativestyle [\v!Words]   [{\setcharactercasing[\v!Words  ]}] [{\setcharactercasing[\v!Words  ]}]
849\definealternativestyle [\v!capital] [{\setcharactercasing[\v!capital]}] [{\setcharactercasing[\v!capital]}]
850\definealternativestyle [\v!Capital] [{\setcharactercasing[\v!Capital]}] [{\setcharactercasing[\v!Capital]}]
851\definealternativestyle [\v!mixed]   [{\setcharactercasing[\v!mixed  ]}] [{\setcharactercasing[\v!mixed  ]}]
852
853\definealternativestyle [\v!cap]     [{\setcharactercasing[\v!cap    ]}] [{\setcharactercasing[\v!cap    ]}]
854\definealternativestyle [\v!Cap]     [{\setcharactercasing[\v!Cap    ]}] [{\setcharactercasing[\v!Cap    ]}]
855
856%D From now (2013-03-17) on we have:
857
858\definefontfeature[f:smallcaps][smcp=yes]
859\definefontfeature[f:oldstyle] [onum=yes]
860\definefontfeature[f:tabular]  [tnum=yes]
861\definefontfeature[f:superiors][sups=yes]
862\definefontfeature[f:inferiors][subs=yes]
863\definefontfeature[f:fractions][frac=yes]
864\definefontfeature[f:kern]     [kern=yes]
865\definefontfeature[f:kerns]    [kern=yes]
866
867\definealternativestyle [\v!smallcaps] [\setsmallcaps] [\setsmallcaps]
868\definealternativestyle [\v!oldstyle]  [\setoldstyle ] [\setoldstyle ]
869\definealternativestyle [\v!fractions] [\setfractions\resetbreakpoints] [\setfractions\resetbreakpoints]
870
871\unexpanded\def\setsmallcaps{\doaddfeature{f:smallcaps}}
872\unexpanded\def\setoldstyle {\doaddfeature{f:oldstyle}}
873\unexpanded\def\settabular  {\doaddfeature{f:tabular}}
874\unexpanded\def\setsuperiors{\doaddfeature{f:superiors}}
875\unexpanded\def\setfractions{\doaddfeature{f:fractions}}
876
877% \unexpanded\def\frc#1#2%
878%   {\dontleavehmode
879%    \begingroup
880%    \addff{frac}%
881%    \resetbreakpoints
882%    #1/#2%
883%    \endgroup}
884
885%D \macros
886%D   {uppercasing, lowercasing}
887
888\definefontfeature[lowercasing][lowercasing=yes]
889\definefontfeature[uppercasing][uppercasing=yes]
890
891\unexpanded\def\uppercasing{\addff{uppercasing}}
892\unexpanded\def\lowercasing{\addff{lowercasing}}
893
894%D \macros
895%D   {tinyfont}
896%D
897%D By default we load the Computer Modern Roman fonts (but
898%D not yet at this moment) and activate the 12pt roman
899%D bodyfont. Sans serif and teletype are also available and
900%D can be called for by \type{\ss} and \type{\tt}. Loading
901%D takes place elsewhere.
902%D
903%D For tracing purposes we define:
904
905\definefont[tinyfont][file:dejavusansmono at 1ex]
906
907%D \macros
908%D   {infofont}
909%D
910%D The second situation occurs when we enable the info mode,
911%D and put all kind of status information in the margin. We
912%D don't want huge switches to the main bodyfont and style, so
913%D here too we use a direct method.
914
915\let\infofont         \relax
916\let\infofontbold     \relax
917\let\smallinfofont    \relax
918\let\smallinfofontbold\relax
919
920\definefont[infofont]         [file:dejavusansmono*none      at 6pt]
921\definefont[infofontbold]     [file:dejavusansmono-bold*none at 6pt]
922\definefont[smallinfofont]    [file:dejavusansmono*none      at 3pt]
923\definefont[smallinfofontbold][file:dejavusansmono-bold*none at 3pt]
924
925%D Optimization (later we overload in math). Also needed in order to get \type {\ss}
926%D properly defined.
927
928\unexpanded\def\normaltf{\let\fontalternative\s!tf\font_helpers_synchronize_font}
929\unexpanded\def\normalbf{\let\fontalternative\s!bf\font_helpers_synchronize_font}
930\unexpanded\def\normalit{\let\fontalternative\s!it\font_helpers_synchronize_font}
931\unexpanded\def\normalsl{\let\fontalternative\s!sl\font_helpers_synchronize_font}
932\unexpanded\def\normalbi{\let\fontalternative\s!bi\font_helpers_synchronize_font}
933\unexpanded\def\normalbs{\let\fontalternative\s!bs\font_helpers_synchronize_font}
934
935\let\tf\normaltf
936\let\bf\normalbf
937\let\it\normalit
938\let\sl\normalsl
939\let\bi\normalbi
940\let\bs\normalbs
941
942\unexpanded\def\normalrm{\font_helpers_set_current_font_style{\s!rm}}
943\unexpanded\def\normalss{\font_helpers_set_current_font_style{\s!ss}}
944\unexpanded\def\normaltt{\font_helpers_set_current_font_style{\s!tt}}
945
946\pushoverloadmode
947
948\let\rm\normalrm
949\let\ss\normalss
950\let\tt\normaltt
951
952\popoverloadmode
953
954\protect \endinput
955
956% LM math vs CM math (analysis by Taco):
957%
958% Computer Modern Roman : Donald Knuth
959% Latin Modern          : LM Font Revision Team
960%
961% lmex10.tfm  % identical
962% lmmi5.tfm   % identical
963% lmmi6.tfm   % identical
964% lmmi7.tfm   % identical
965% lmmi8.tfm   % identical
966% lmmi9.tfm   % identical
967% lmmi10.tfm  % identical
968% lmmi12.tfm  % identical
969% lmmib10.tfm % identical
970% lmsy5.tfm   % extra chars: 254,255 (octal)
971% lmsy6.tfm   % extra chars: 254,255 (octal)
972% lmsy7.tfm   % extra chars: 254,255 (octal)
973% lmsy8.tfm   % extra chars: 254,255 (octal)
974% lmsy9.tfm   % extra chars: 254,255 (octal)
975% lmsy10.tfm  % extra chars: 254,255 (octal)
976% lmbsy10.tfm % extra chars: 254,255 (octal)
977%
978% From the 'AMS' set:
979%
980% lmmib5.tfm  % identical
981% lmmib7.tfm  % identical
982% lmbsy5.tfm  % extra chars: 254,255 (octal)
983% lmbsy7.tfm  % extra chars: 254,255 (octal)
984%
985% The two extra characters are:
986%
987%   /lessorequalslant
988%   /greaterorequalslant
989
990% \unprotect
991%
992% \definehighlight[\v!italic    ][\c!command=\v!no,\c!style=\v!italic]
993% \definehighlight[\v!bold      ][\c!command=\v!no,\c!style=\v!bold]
994% \definehighlight[\v!bolditalic][\c!command=\v!no,\c!style=\v!bolditalic]
995% \definehighlight[\v!mono]      [\c!command=\v!no,\c!style=\v!mono]
996% \definehighlight[\v!monobold]  [\c!command=\v!no,\c!style=\v!monobold]
997%
998% \definehighlight[important]    [\c!command=\v!no,\c!style=\v!bold]
999% \definehighlight[unimportant]  [\c!command=\v!no,\c!color=darkgray]
1000% \definehighlight[warning]      [\c!command=\v!no,\c!style=\v!bold,\c!color=darkblue]
1001% \definehighlight[error]        [\c!command=\v!no,\c!style=\v!bold,\c!color=darkred]
1002%
1003% \protect
1004%
1005% \starttext
1006%     \highlight[italic]     {italic}
1007%     \highlight[bolditalic] {bolditalic}
1008%     \highlight[bold]       {bold}
1009%     \highlight[mono]       {mono}
1010%     \highlight[monobold]   {monobold}
1011%     \highlight[important]  {important}
1012%     \highlight[unimportant]{unimportant}
1013%     \highlight[warning]    {warning}
1014%     \highlight[error]      {error}
1015% \stoptext
1016