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