s-fonts-features.mkiv /size: 2650 b    last modification: 2024-01-16 09:03
1%D \module
2%D   [      file=s-fonts-features, % was s-fnt-41, s-fnt-27
3%D        version=2012.11.27, % 2010.02.22
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Features,
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\startmodule[fonts-features]
15
16\registerctxluafile{s-fonts-features}{}
17
18\installmodulecommandluasingle \showusedfeatures  {moduledata.fonts.features.showused}
19\installmodulecommandluasingle \showallkerns      {moduledata.fonts.features.showallkerns}
20\installmodulecommandluasingle \showbasekerns     {moduledata.fonts.features.showbasekerns}
21\installmodulecommandluasingle \showallligatures  {moduledata.fonts.features.showallligatures}
22\installmodulecommandluasingle \showfeatureset    {moduledata.fonts.features.showfeatureset}
23\installmodulecommandluasingle \showallfeatures   {moduledata.fonts.features.showallfeatures}
24\installmodulecommandluasingle \showsubstitutions {moduledata.fonts.features.showsubstitutions}
25
26\unexpanded\def\showfontidchar#1#2{\glyph id #1 #2\relax}
27
28\def\kernpairheight{.8\strutht}
29\def\kernpairdepth {.8\strutdp}
30\def\kernpairwidth {\onepoint}
31
32\unexpanded\def\showkernpair#1#2#3% first kern second
33  {\dontleavehmode
34   \hbox \bgroup
35   \scratchdimen#2\scaledpoint
36   \kern\fontcharwd\font#1\relax
37   \ifdim\scratchdimen>\zeropoint
38     \bgroup
39       \darkgreen
40       \vrule width \scratchdimen height \kernpairheight depth \kernpairdepth
41     \egroup
42     \kern-\scratchdimen
43   \else\ifdim\scratchdimen<\zeropoint
44     \kern\scratchdimen
45     \bgroup
46       \darkred
47       \vrule width -\scratchdimen height \kernpairheight depth \kernpairdepth
48     \egroup
49   \else
50     \kern-.5\dimexpr\kernpairwidth\relax
51     \bgroup
52       \darkblue
53       \vrule width \kernpairwidth height \kernpairheight depth \kernpairdepth
54     \egroup
55     \kern-.5\dimexpr\kernpairwidth\relax
56   \fi\fi
57   \kern-\fontcharwd\font#1\relax
58   \char#1\relax
59   \char#3\relax
60   \egroup
61   \space}
62
63\stopmodule
64
65\continueifinputfile{s-fonts-features.mkiv}
66
67\usemodule
68  [art-01]
69
70\starttext
71
72%     \showusedfeatures \page
73
74%     \definefontfeature[default-base][default][mode=base]
75
76%     \start
77%         \definedfont[Serif*default-base]
78%         \showbasekerns
79%         \page
80%     \stop
81
82%     \start
83%         \bf
84%         \showallkerns
85%         \page
86%     \stop
87
88    \showsubstitutions
89      [name=xcharter-math.otf,
90       feature=*,
91       script=math,
92       language=dflt]
93
94\stoptext
95