1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Typesetting Macros Kerning}
15
16\unprotect
17
18\registerctxluafile{typokrn}{}
19
20\definesystemattribute[kern][public]
21
22
23
24
25
26\installcorenamespace{characterkerning}
27
28\installcommandhandler \??characterkerning {characterkerning} \??characterkerning
29
30\unexpanded\def\setcharacterkerning[#1]
31 {\edef\currentcharacterkerning{#1}
32 \ifx\currentcharacterkerning\s!reset
33 \resetcharacterkerning
34 \else
35 \typo_kerning_set
36 \fi}
37
38\def\typo_kerning_set
39 {\usecharacterkerningstyleandcolor\c!style\c!color
40 \useaddfontfeatureparameter\characterkerningparameter
41 \clf_setcharacterkerning{\characterkerningparameter\c!factor}}
42
43\unexpanded\def\resetcharacterkerning
44 {\c_attr_kern\attributeunsetvalue}
45
46\appendtoks
47 \resetcharacterkerning
48\to \everyresettypesetting
49
50\definecharacterkerning [extrakerning] [\c!factor=.125]
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
83
84
85
86
87\appendtoks
88 \setuevalue{\currentcharacterkerning}
89 {\doifelsenextoptional
90 {\typo_kerning_apply_yes{\currentcharacterkerning}}
91 {\typo_kerning_apply_nop{\currentcharacterkerning}}}
92\to \everydefinecharacterkerning
93
94\unexpanded\def\typo_kerning_apply_yes#1[#2]
95 {\groupedcommand{\typo_kerning_apply_yes_indeed{#1}{#2}}\donothing}
96
97\unexpanded\def\typo_kerning_apply_nop#1
98 {\groupedcommand{\typo_kerning_apply_nop_indeed{#1}}\donothing}
99
100\def\typo_kerning_apply_yes_indeed#1#2
101 {\edef\currentcharacterkerning{#1}
102 \setupcurrentcharacterkerning[\c!factor=#2]
103 \typo_kerning_set}
104
105\def\typo_kerning_apply_nop_indeed#1
106 {\edef\currentcharacterkerning{#1}
107 \typo_kerning_set}
108
109\definecharacterkerning [\v!kerncharacters] [\c!factor=.125]
110\definecharacterkerning [\v!letterspacing ] [\v!kerncharacters] [\c!features=letterspacing]
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137\definecharacterkerning
138 [\v!stretched]
139 [\c!factor=\v!max,
140 \c!width=\availablehsize]
141
142\unexpanded\def\setupstretched
143 {\setupcharacterkerning[\v!stretched]}
144
145\unexpanded\def\stretched
146 {\dosingleempty\typo_kerning_stretched}
147
148\unexpanded\def\typo_kerning_stretched[#1]#2
149 {\begingroup
150 \let\currentcharacterkerning\v!stretched
151 \iffirstargument
152 \setupcurrentcharacterkerning[#1]
153 \fi
154 \edef\p_width{\characterkerningparameter\c!width}
155 \ifx\p_width\empty \else
156 \hbox to \p_width
157 \fi
158 \bgroup
159 \usecharacterkerningstyleandcolor\c!style\c!color
160 \useaddfontfeatureparameter\characterkerningparameter
161 \typo_kerning_set
162 #2
163 \egroup
164 \endgroup}
165
166\protect \endinput
167 |