m-gimmicks.mkxl /size: 2671 b    last modification: 2024-01-16 10:22
1%D \module
2%D   [       file=m-gimmicks,
3%D        version=2022.08.25
4%D          title=\CONTEXT\ Extra Modules,
5%D       subtitle=Whatever comes up,
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\def\MacScale    {.7}%
15\def\MacRule     {.05}%
16\def\MacDistance {.05}%
17\def\MacKern     {0}%
18
19\protected\def\Mac
20  {\dontleavehmode
21   \begingroup
22   \scratchwidth   \scaledfontcharwd\font`M\relax
23   \scratchdistance\MacScale\scaledfontcharwd\font`c\relax
24   \scratchoffset  \dimexpr\scaledfontcharht\font`M -\MacScale\scaledfontcharht\font`c\relax
25   \scratchdepth   \MacRule\exheight
26   \kern\scratchwidth
27   \vrule
28     width  \scratchdistance
29     height \dimexpr \scratchoffset- \scratchdepth-\MacDistance\exheight\relax
30     depth  \dimexpr-\scratchoffset+2\scratchdepth+\MacDistance\exheight\relax
31   \relax
32   \kern-\dimexpr\scratchwidth+\scratchdistance\relax
33   M%
34   \glyphscale\numexpr\numericscale\MacScale*\glyphyscale/\plusthousand\relax
35   \glyph
36     yoffset \scratchoffset `c
37   \kern\MacKern\emwidth
38   \endgroup}
39
40\continueifinputfile{m-gimmicks.mkxl}
41
42% Question on mailing list:
43
44\chardef\MacAnulty = \privatecharactercode{MacAnulty}
45
46\startsetups [box:mcanulty:\number\MacAnulty]
47    \Mac Anulty
48\stopsetups
49
50\registerboxglyph category {mcanulty} unicode \MacAnulty \relax
51
52\startluacode
53    fonts.handlers.otf.addfeature {
54        name    = "mcanulty",
55        type    = "ligature",
56        nocheck = true,
57        data    = {
58         -- [\number\MacAnulty]                         = {
59         -- [fonts.constructors.privateslots.MacAnulty] = {
60            [fonts.helpers.privateslot("MacAnulty")]    = {
61                "M", "c", "A", "n", "u", "l", "t", "y",
62            },
63        }
64    }
65\stopluacode
66
67\definefontfeature[whatever][default][box=mcanulty,mcanulty=yes]
68\definefontfeature[default][default][box=mcanulty,mcanulty=yes]
69
70\startTEXpage [offset=10dk]
71%     \def\Test#1{%
72%         \begingroup
73%         #1%
74%         \dostepwiserecurse{5}{8}{1}{
75%             \def\MacScale{.##1}%
76%             \Mac Anulty
77%             \par
78%         }
79%         \endgroup
80%     }
81%     \Test\tf
82%     \Test\bf
83%     \Test\it
84%     \Test\sl
85%     \Test\bfb
86%     \def\MacScale{.6}
87%     \def\MacKern {-.1}
88%     \Mac Anulty
89
90{\definedfont[Serif*whatever]     McAnulty\quad \MacAnulty\par}
91{\definedfont[SerifBold*whatever] McAnulty\quad \MacAnulty\par}
92
93{\tf McAnulty\quad \MacAnulty\par}
94{\bf McAnulty\quad \MacAnulty\par}
95
96\stopTEXpage
97