1
2
3
4
5
6
7
8
9
10
11
12
13
14\unprotect
15
16\definecharacterkerning
17 [typesettingkerningdemo]
18 [factor=.5]
19
20\startbuffer[showcharacterkerning:boxes]
21 \starttextrule{boxes}
22 \showfontkerns
23 \dontcomplain
24 \startlines
25 test \hbox{!} test
26 test\hbox{!} test
27 test \hbox{!}test
28 test:$x$ test
29 \setcharacterkerning[typesettingkerningdemo]
30 test \hbox{!} test
31 test\hbox{!} test
32 test \hbox{!}test
33 test:$x$ test
34 \stoplines
35 \stoptextrule
36\stopbuffer
37
38\startbuffer[showcharacterkerning:ligatures]
39 \starttextrule{ligatures}
40 \dontcomplain
41 \startlines
42 effe flink effectief efficient fietsen
43 \blank
44 \setcharacterkerning[typesettingkerningdemo]
45 effe flink effectief efficient fietsen
46 \blank \hsize\zeropoint
47 effe
48 flink
49 effectief
50 efficient
51 fietsen
52 \stoplines
53 \stoptextrule
54\stopbuffer
55
56\startbuffer[showcharacterkerning:discretionaries]
57 \starttextrule{discretionary}
58 \dontcomplain
59 \startlines
60 \hbox{\samplediscretionary}
61 \hbox{xxx\samplediscretionary}
62 \hbox{\samplediscretionary xxx}
63 \hbox{xxx\samplediscretionary xxx}
64 \blank
65 \setcharacterkerning[typesettingkerningdemo]
66 \hbox{\samplediscretionary}
67 \hbox{xxx\samplediscretionary}
68 \hbox{\samplediscretionary xxx}
69 \hbox{xxx\samplediscretionary xxx}
70 \blank \hsize\zeropoint
71 \samplediscretionary
72 xxx\samplediscretionary
73 \samplediscretionary xxx
74 xxx\samplediscretionary xxx
75 \stoplines
76 \stoptextrule
77\stopbuffer
78
79\startbuffer[showcharacterkerning:explicits]
80 \starttextrule{explicits}
81 \exhyphenchar \hyphenasciicode
82 \preexhyphenchar \lessthanasciicode
83 \postexhyphenchar\morethanasciicode
84 \def\TestDisc
85 {\discretionary
86 {\kern\emwidth<}
87 {>\kern\emwidth}
88 {\kern\emwidth=\kern\emwidth}
89 }
90 \dontcomplain
91 \startlines
92 \hbox{supercharged}
93 \hbox{super\-charged}
94 \hbox{super\TestDisc charged}
95 \hbox{super\discretionary{[}{]}{[]}charged}
96 \blank
97 \setcharacterkerning[typesettingkerningdemo]
98 \hbox{supercharged}
99 \hbox{super\-charged}
100 \hbox{super\TestDisc charged}
101 \hbox{super\discretionary{[}{]}{[]}charged}
102 \blank \hsize\zeropoint
103 supercharged
104 super\-charged
105 super\TestDisc charged
106 super\discretionary{[}{]}{[]}charged
107 \stoplines
108 \stoptextrule
109\stopbuffer
110
111\starttexdefinition unexpanded showcharacterkerning
112 \getbuffer[showcharacterkerning:boxes]
113 \getbuffer[showcharacterkerning:ligatures]
114 \getbuffer[showcharacterkerning:discretionaries]
115 \getbuffer[showcharacterkerning:explicits]
116\stoptexdefinition
117
118
119\starttexdefinition showcharacterkerningstepscompared #1
120 \definecharacterkerning[crap][factor=\KerningStepFactor]
121 \setbox0=\ruledhbox{\color[color1]{#1}\hss}
122 \setbox2=\ruledhbox{\setcharacterkerning[crap]\color[color2]{#1}}
123 \setbox4=\ruledhbox{\setcharacterkerning[crap]\showfontkerns\showglyphs#1}
124 \xdef\KerningStepPercentage{\ctxlua{context("\letterpercent 0.2f",(1-\number\wd0/\number\wd2)*100)}}
125 \scratchwidth\wd0
126 \vtop\bgroup
127 \hbox{\box0\hskip\scratchwidth\box2}
128 \par
129 \box4
130 \egroup
131\stoptexdefinition
132
133\starttexdefinition showcharacterkerningsteps [#1]
134
135 \start
136
137 \getdummyparameters
138 [\s!font=Regular,
139 \c!sample={Wat een bende, rommelen met het font design!},
140 \c!text={rommelen},
141 \c!first=00,
142 \c!last=95,
143 \c!step=05,
144 \c!option=,
145 #1]
146
147 \doif{\dummyparameter\c!option}\v!page {
148 \startTEXpage[\c!offset=1ex]
149 }
150
151 \definecolor[color1][r=1,t=.5,a=1]
152 \definecolor[color2][b=1,t=.5,a=1]
153
154 \definedfont[\dummyparameter\s!font*default sa 1]
155
156 \doif {\dummyparameter\c!option}\v!page {
157 \begingroup
158 \tttf \dummyparameter\s!font\space @ default
159 \endgroup
160 \blank
161 }
162
163 \starttabulate[cTlcTlcT]
164
165 \NC \tt\bf factor \NC \tt\bf sample \NC \tt\bf \letterpercent \NC \tt\bf text \NC \tt\bf \letterpercent \NC \NR \HL
166
167 \dostepwiserecurse {\dummyparameter\c!first} {\dummyparameter\c!last} {\dummyparameter\c!step} {
168 \NC
169 \xdef\KerningStepFactor{\ctxlua{context("\letterpercent 0.3f",####1/1000)}}
170 \KerningStepFactor
171 \NC
172 \showcharacterkerningstepscompared{\dummyparameter\c!sample}
173 \NC
174 \KerningStepPercentage
175 \NC
176 \showcharacterkerningstepscompared{\dummyparameter\c!text}
177 \NC
178 \KerningStepPercentage
179 \NC \NR
180 }
181
182 \stoptabulate
183
184 \doif{\dummyparameter\c!option}\v!page {
185 \stopTEXpage
186 }
187
188 \stop
189
190\stoptexdefinition
191
192\protect
193
194\continueifinputfile{stypesettingkerning.mkiv}
195
196\starttext
197
198
199
200 \showcharacterkerningsteps[font=file:FuturaStdBook.otf,option=page]
201 \showcharacterkerningsteps[font=file:FuturaStdMedium.otf,option=page]
202 \showcharacterkerningsteps[font=file:FuturaStdBold.otf,option=page]
203 \showcharacterkerningsteps[font=file:FuturaStdheavy.otf,option=page]
204
205\stoptext
206
207
208
209
210 |