s-fonts-features.mkiv /size: 2257 b    last modification: 2020-07-01 14:35
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
24\def\kernpairheight{.8\strutht}
25\def\kernpairdepth {.8\strutdp}
26\def\kernpairwidth {\onepoint}
27
28\unexpanded\def\showkernpair#1#2#3% first kern second
29  {\dontleavehmode
30   \hbox \bgroup
31   \scratchdimen#2\scaledpoint
32   \kern\fontcharwd\font#1\relax
33   \ifdim\scratchdimen>\zeropoint
34     \bgroup
35       \darkgreen
36       \vrule width \scratchdimen height \kernpairheight depth \kernpairdepth
37     \egroup
38     \kern-\scratchdimen
39   \else\ifdim\scratchdimen<\zeropoint
40     \kern\scratchdimen
41     \bgroup
42       \darkred
43       \vrule width -\scratchdimen height \kernpairheight depth \kernpairdepth
44     \egroup
45   \else
46     \kern-.5\dimexpr\kernpairwidth\relax
47     \bgroup
48       \darkblue
49       \vrule width \kernpairwidth height \kernpairheight depth \kernpairdepth
50     \egroup
51     \kern-.5\dimexpr\kernpairwidth\relax
52   \fi\fi
53   \kern-\fontcharwd\font#1\relax
54   \char#1\relax
55   \char#3\relax
56   \egroup
57   \space}
58
59\stopmodule
60
61\continueifinputfile{s-fonts-features.mkiv}
62
63\usemodule
64  [art-01]
65
66\starttext
67
68    \showusedfeatures \page
69
70    \definefontfeature[default-base][default][mode=base]
71
72    \start
73        \definedfont[Serif*default-base]
74        \showbasekerns
75        \page
76    \stop
77
78    \start
79        \bf
80        \showallkerns
81        \page
82    \stop
83
84\stoptext
85