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