summaryrefslogtreecommitdiff
path: root/tex/context/base/s-fonts-features.mkiv
blob: 8982f73474712d1d8ac2e04c5e9a942c6154c77e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
%D \module
%D   [      file=s-fonts-features, % was s-fnt-41, s-fnt-27
%D        version=2012.11.27, % 2010.02.22
%D          title=\CONTEXT\ Style File,
%D       subtitle=Features,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\startmodule[s-fonts-features]

\registerctxluafile{s-fonts-features}{}

\installmodulecommandluasingle \showusedfeatures {moduledata.fonts.features.showused}
\installmodulecommandluasingle \showallkerns     {moduledata.fonts.features.showallkerns}
\installmodulecommandluasingle \showbasekerns    {moduledata.fonts.features.showbasekerns}

\def\kernpairheight{\strutheight}
\def\kernpairdepth {\strutdepth}
\def\kernpairwidth {\onepoint}

\unexpanded\def\showkernpair#1#2#3% first second kern
  {\dontleavehmode
   \hbox \bgroup
   \scratchdimen#2\scaledpoint
   \kern\fontcharwd\font#1\relax
   \ifdim\scratchdimen>\zeropoint
     \bgroup
       \darkgreen
       \vrule width \scratchdimen height \kernpairheight depth \kernpairdepth
     \egroup
     \kern-\scratchdimen
   \else\ifdim\scratchdimen<\zeropoint
     \kern\scratchdimen
     \bgroup
       \darkred
       \vrule width -\scratchdimen height \kernpairheight depth \kernpairdepth
     \egroup
   \else
     \kern-.5\dimexpr\kernpairwidth\relax
     \bgroup
       \darkblue
       \vrule width \kernpairwidth height \kernpairheight depth \kernpairdepth
     \egroup
     \kern-.5\dimexpr\kernpairwidth\relax
   \fi\fi
   \kern-\fontcharwd\font#1\relax
   \char#1\relax
   \char#3\relax
   \egroup
   \space}

\stopmodule

\continueifinputfile{s-fonts-features.mkiv}

\usemodule
  [art-01]

\starttext

    \showusedfeatures \page

    \definefontfeature[default-base][default][mode=base]

    \start
        \definedfont[Serif*default-base]
        \showbasekerns
        \page
    \stop

    \start
        \bf
        \showallkerns
        \page
    \stop

\stoptext