Debian Codegraph @

texmf-dist/tex/optex/pkg/mte.opm

raw
1 % This is macro package used by OpTeX, see http://petr.olsak.net/optex
2 % mte.opm, Petr Olšák <[email protected]>, 2021
3 % See end of the file for more information
4
5 \_def \_mte_version {0.1, 2021-05-23}
6 \_codedecl \enablemte {MicroTypographic Extension <\_mte_version>}
7 \_namespace{mte}
8
9 \_doc -------------------
10 First, we define default protrusion values. They are
11 saved in the macros
12 \^`\.AlphabetPR`, \^`\.alphabetPR`, \^`\.digitsPR`, \^`\.punctPR`,
13 \^`\.quotPR`, \^`\.othersPR`
14 for regular and bold fonts. The analogous macros
15 \^`\.AlphabetPI`, \^`\.alphabetPI`, \^`\.digitsPI`, \^`\.punctPI`,
16 \^`\.quotPI`, \^`\.othersPI` store data
17 for italic and bold italic fonts.
18 We are using long names of these macros (without the dot shortcut in the
19 code) because user can copy these macros to his/her macro file and do modifications.
20 \nl
21 User (or a font family file) can define other values, for example by
22 `\def\_mte_quotPR{...}`. If such definition is done before
23 loading this package, it has precedence. This is the reason why we are
24 using \`\.trydef` which defines given macro only if it is not defined
25 already.
26 \_cod -------------------
27
28 \_def\.trydef #1{\_ifx#1\_undefined \_afterfi{\_def#1}\_else \_ea\_ignoreit \_fi}
29
30 \_doc
31 We want to save size of the following macros with data tables, so we don't write
32 `[<code of char>] =` but only \`\_mte`~`<char> =`. We use \OpTeX/ name space for
33 \^`\_mte` (no package name space) because user may copy these macros to
34 other macro files and modify them. We hope that the name \^`\_mte` will
35 be never used in another meaning in \OpTeX/.
36 \_cod
37
38 \_def\_mte #1{[\_the\_numexpr`#1]}
39
40 \_doc --------------------
41 The protrusion data follow.
42 The values are coefficients of total width of declared character.
43 First value gives left protrusion, second value is right protrusion.
44 \`\.AlphabetPR`
45 \_cod --------------------
46
47 \.trydef \_mte_AlphabetPR {% Alphabets, Protrusion, Regular fonts
48 \_mte A = {.05,.05},
49 \_mte Æ = {.05, 0},
50 \_mte F = {0 ,.05},
51 \_mte J = {.05, 0},
52 \_mte K = {0 ,.05},
53 \_mte L = {0 ,.05},
54 \_mte T = {.05,.05},
55 \_mte V = {.05,.05},
56 \_mte W = {.05,.05},
57 \_mte X = {.05,.05},
58 \_mte Y = {.05,.05},
59 }
60 \_doc
61 \`\.alphabetPR`
62 \_cod
63
64 \.trydef \_mte_alphabetPR {% alphabets, Protrusion, Regular fonts
65 \_mte k = {0 ,.05},
66 \_mte r = {0 ,.05},
67 \_mte t = {0 ,.07},
68 \_mte v = {.05,.05},
69 \_mte w = {.05,.05},
70 \_mte x = {.05,.05},
71 \_mte y = {.05,.07},
72 }
73 \_doc
74 \`\.digitsPR`
75 \_cod
76
77 \.trydef \_mte_digitsPR {% digits, Protrusion, Regular fonts
78 \_mte 0 = {0 ,.05},
79 \_mte 1 = {.1 ,.2 },
80 \_mte 2 = {.05,.05},
81 \_mte 3 = {.05,.05},
82 \_mte 4 = {.07,.07},
83 \_mte 5 = {0 ,.05},
84 \_mte 6 = {0 ,.05},
85 \_mte 7 = {.05,.1 },
86 \_mte 8 = {0 ,.05},
87 \_mte 9 = {0 ,.05},
88 [0xF731] = {.1, .1}, % /one.oldstyle
89 [0xF732] = {.05, .05}, % /two.oldstyle
90 [0xF733] = {.03, .08}, % /three.oldstyle
91 [0xF734] = {.05, .05}, % /four.oldstyle
92 [0xF737] = {.05, .08}, % /seven.oldstyle
93 }
94 \_doc
95 \`\.punctPR`
96 \_cod
97
98 \.trydef \_mte_punctPR {% punctuations, Protrusion, Regular fonts
99 \_mte . = {0 , .7},
100 \_mte , = {0 , .5},
101 \_mte : = {0 , .5},
102 \_mte ; = {0 , .5},
103 \_mte ! = {0 , .1},
104 \_mte ? = {0 , .2},
105 \_mte @ = {.05,.05},
106 \_mte ~ = {.2, .25},
107 \_mte \% = {.05,.05}, % /percent
108 \_mte * = {.3, .3},
109 \_mte + = {.25,.25},
110 \_mte - = {.4, .5}, % /hyphen
111 \_mte – = {.4, .3}, % /endash
112 \_mte — = {.3, .2}, % /emdash
113 \_mte _ = {.2, .2}, % /underscore
114 \_mte / = {.2, .3},
115 \_mte \\ = {.2, .3}, % /backslash
116 \_mte ¡ = {.1, 0}, \_mte ¿ = {.1, 0},
117 }
118 \_doc
119 \`\.quotPR`
120 \_cod
121
122 \.trydef \_mte_quotPR {% quotation marks, Protrusion, Regular fonts
123 \_mte ' = {.3,.4}, % /quotesingle
124 \_mte ‘ = {.5,.7}, \_mte ’ = {.5,.6},
125 \_mte “ = {.5,.3}, \_mte ” = {.2,.6},
126 \_mte ‚ = {.4,.4}, \_mte „ = {.4,.4},
127 \_mte ‹ = {.4,.4}, \_mte › = {.3,.5},
128 \_mte « = {.3,.2}, \_mte » = {.1,.4},
129 }
130 \_doc
131 \`\.othersPR`
132 \_cod
133
134 \.trydef \_mte_othersPR {% other characters, Protrusion, Regular fonts
135 \_mte ( = {.3, 0}, \_mte ) = {0 ,.3},
136 \_mte < = {.2, .1}, \_mte > = {.1, .2},
137 \_mte \{ = {.4, .2}, \_mte \} = {.2, .4}, % /braceleft, /braceright
138 [0x2329] = {.4, 0}, [0x232A] = {0 ,.4}, % /angleleft, /angleright
139 \_mte † = {.1,.1},
140 \_mte ‡ = {.08, .08},
141 \_mte • = {.2, .2},
142 \_mte · = {.4, .45}, % /periodcentered
143 \_mte ℃ = {.08, .05},
144 \_mte ₡ = {0 , .05},
145 \_mte ° = {.4, .4},
146 [0x2122] = {.1, .2}, % /trademark
147 \_mte © = {.1, .1},
148 \_mte ® = {.1, .1},
149 \_mte ª = {.1, .2},
150 \_mte º = {.1, .2},
151 \_mte ¹ = {.2, .25},
152 \_mte ² = {.05, .1},
153 \_mte ³ = {.05, .1},
154 \_mte ¬ = {.2, 0},
155 \_mte − = {.3, .3},
156 \_mte ± = {.15, .2},
157 \_mte × = {.15, .25},
158 \_mte ÷ = {.15, .25},
159 \_mte € = {.1, 0},
160 \_mte Γ = {0 ,.180}, % /Gamma
161 \_mte Δ = {.1, .1}, % /Delta
162 \_mte Θ = {.05, .05}, % /Theta
163 \_mte Λ = {.1,.1}, % /Lambda
164 \_mte Σ = {.05, .05}, % /Sigma
165 \_mte Υ = {.1,.1}, % /Upsilon
166 \_mte Φ = {.05, .05}, % /Phi
167 \_mte Ψ = {.05, .05}, % /Psi
168 }
169
170 \_doc
171 The protrusion data for italic and bold italic fonts follow.
172 \`\.AlphabetPI`
173 \_cod
174
175 \.trydef \_mte_AlphabetPI {% Alphabets, Protrusion, Italic fonts
176 \_mte A = {.125,.1},
177 \_mte Æ = {.125,-.055},
178 \_mte B = {.09,-.04},
179 \_mte C = {.145,-.075},
180 \_mte D = {.075,-.028},
181 \_mte E = {.08,-.055},
182 \_mte F = {.085,-.08},
183 \_mte G = {.153,-.015},
184 \_mte H = {.073,-.06},
185 \_mte I = {.14,-.12},
186 [0x0132] = {.14,-.08}, % IJ
187 \_mte J = {.135,-.08},
188 \_mte K = {.07,-.03},
189 \_mte L = {.087,.04},
190 \_mte M = {.067,-.045},
191 \_mte N = {.075,-.055},
192 \_mte O = {.15,-.03},
193 \_mte Œ = {.15,-.055},
194 \_mte P = {.082,-.05},
195 \_mte Q = {.15,-.03},
196 \_mte R = {.075, .015},
197 \_mte S = {.09,-.065},
198 \_mte $ = {.1,-.02}, % $
199 \_mte T = {.22,-.085},
200 \_mte U = {.23,-.055},
201 \_mte V = {.26,-.06},
202 \_mte W = {.185,-.055},
203 \_mte X = {.07,-.03},
204 \_mte Y = {.25,-.06},
205 \_mte Z = {.09,-.06},
206 }
207 \_doc
208 \`\.alphabetPI`
209 \_cod
210
211 \.trydef \_mte_alphabetPI {% alphabets, Protrusion, Italic fonts
212 \_mte a = {.15,-.01},
213 \_mte b = {.17, 0},
214 \_mte c = {.173,-.01},
215 \_mte d = {.15,-.055},
216 \_mte e = {.18, 0},
217 \_mte f = {0 ,-.25},
218 \_mte g = {.15,-.01},
219 \_mte h = {.1, 0},
220 \_mte i = {.21, 0},
221 [0x17C9] = {.21,-.04}, % ij
222 \_mte j = {0 ,-.04},
223 \_mte k = {.11,-.05},
224 \_mte l = {.24,-.11},
225 \_mte m = {.08, 0},
226 \_mte n = {.115, 0},
227 \_mte o = {.155, 0},
228 \_mte q = {.17,-.04},
229 \_mte r = {.155,-.04},
230 \_mte s = {.13, 0},
231 \_mte t = {.23,-.01},
232 \_mte u = {.12, 0},
233 \_mte v = {.14,-.025},
234 \_mte w = {.098,-.02},
235 \_mte x = {.065,-.04},
236 \_mte y = {.13,-.02},
237 \_mte z = {.110,-.08},
238 }
239 \_doc
240 \`\.digitsPI`
241 \_cod
242
243 \.trydef \_mte_digitsPI {% digits, Protrusion, Italic fonts
244 \_mte 0 = {.17,-.085},
245 \_mte 1 = {.23,.11},
246 \_mte 2 = {.13,-.07},
247 \_mte 3 = {.14,-.07},
248 \_mte 4 = {.13,.08},
249 \_mte 5 = {.16, 0},
250 \_mte 6 = {.175,-.03},
251 \_mte 7 = {.25,-.15},
252 \_mte 8 = {.13,-.04},
253 \_mte 9 = {.155,-.08},
254 [0xF730] = {.05,.05}, % /zero.oldstyle
255 [0xF731] = {.1, .1}, % /one.oldstyle
256 [0xF732] = {.1,.08}, % /two.oldstyle
257 [0xF733] = {.08,.05}, % /three.oldstyle
258 [0xF734] = {.08,.08}, % /four.oldstyle
259 [0xF735] = {.05, 0}, % /five.oldstyle
260 [0xF736] = {.05, 0}, % /six.oldstyle
261 [0xF737] = {.08,.08}, % /seven.oldstyle
262 [0xF738] = {.05, 0}, % /eight.oldstyle
263 [0xF739] = {0 ,.05}, % /nine.oldstyle
264 }
265 \_doc
266 \`\.punctPI`
267 \_cod
268
269 \.trydef \_mte_punctPI {% punctuations, Protrusion, Italic fonts
270 \_mte . = {0 ,.5},
271 \_mte , = {0 ,.45},
272 \_mte : = {0 ,.3},
273 \_mte ; = {0 ,.3},
274 \_mte & = {.13,.03},
275 \_mte \% = {.18,.05},
276 \_mte * = {.38,.02},
277 \_mte + = {.18,.2},
278 \_mte @ = {.18,.01},
279 \_mte ~ = {.2,.15},
280 \_mte ( = {.3, 0}, \_mte ) = {0 ,.07},
281 \_mte / = {.1,.1},
282 \_mte - = {.5,.3}, % /hyphen
283 \_mte – = {.5,.3}, % /endash
284 \_mte — = {.4,.17}, % /emdash
285 \_mte _ = {.1,.2}, % /underscore
286 \_mte ¡ = {.2, 0}, \_mte ¿ = {.2, 0},
287 }
288 \_doc
289 \`\.quotPI`
290 \_cod
291
292 \.trydef \_mte_quotPI {% quotation marks, Protrusion, Italic fonts
293 \_mte ' = {.3,.4}, % /quotesingle
294 \_mte " = {.5,.3},
295 \_mte ‘ = {.8,.2}, \_mte ’ = {.8,-.02},
296 \_mte “ = {.54,.1}, \_mte ” = {.5,.1},
297 \_mte ‚ = {.3,.7}, \_mte „ = {.2,.6},
298 \_mte ‹ = {.5,.3}, \_mte › = {.4,.4},
299 \_mte « = {.4,.1}, \_mte » = {.2,.3},
300 }
301 \_doc
302 \`\.othersPI`
303 \_cod
304
305 \.trydef \_mte_othersPI {% other characters, Protrusion, Italic fonts
306 \_mte < = {.3,.1}, \_mte > = {200,100},
307 \_mte \\ = {.3,.3},
308 \_mte \{ = {.4,.1}, \_mte \} = {200,200},
309 \_mte † = {.2,.08},
310 \_mte ‡ = {.12,.08},
311 \_mte • = {.22,.1},
312 \_mte · = {.55,.3}, % /periodcentered
313 \_mte ℃ = {.17, 0},
314 \_mte ₡ = {.1,.05},
315 \_mte ¶ = {.2, 0},
316 \_mte ° = {.5,.3},
317 [0x2122] = {.2,.07}, % /trademark
318 \_mte © = {.05,.07},
319 \_mte ® = {.05,.07},
320 \_mte ª = {.14,.1},
321 \_mte º = {.14,.1},
322 \_mte ¹ = {.40,.15},
323 \_mte ² = {.25,.08},
324 \_mte ³ = {.25,.08},
325 \_mte ¬ = {.25,.08},
326 \_mte − = {.3,.2},
327 \_mte ± = {.15,.17},
328 \_mte × = {.2,.2},
329 \_mte ÷ = {.2,.2},
330 \_mte € = {.15, 0},
331 \_mte Γ = {.1,.12}, % /Gamma
332 \_mte Δ = {.12,.1}, % /Delta
333 \_mte Θ = {.12,.05}, % /Theta
334 \_mte Λ = {.13,.1}, % /Lambda
335 \_mte Ξ = {.1, 0}, % /Xi
336 \_mte Π = {.1, 0}, % /Pi
337 \_mte Σ = {.1,.05}, % /Sigma
338 \_mte Υ = {.18,.1}, % /Upsilon
339 \_mte Φ = {.13,.07}, % /Phi
340 \_mte Ψ = {.13,.05}, % /Psi
341 \_mte Ω = {.05, 0}, % /Omega
342 }
343
344 \_doc --------------------
345 The expansion data follow in macros \^`\.AlphabetX`, \^`\.alphabetX`, \^`\.digitsX`
346 and \^`\.othersX`.
347 They are common for all fonts. \`\.AlphabetX`
348 \_cod --------------------
349
350 \.trydef \_mte_AlphabetX {% Alphabets, eXpansion
351 \_mte A = .5,
352 \_mte Æ = .5,
353 \_mte B = .7,
354 \_mte C = .7,
355 \_mte D = .5,
356 \_mte E = .7,
357 \_mte F = .7,
358 \_mte G = .5,
359 \_mte H = .7,
360 \_mte K = .7,
361 \_mte M = .7,
362 \_mte N = .7,
363 \_mte O = .5,
364 \_mte Œ = .5,
365 \_mte P = .7,
366 \_mte Q = .5,
367 \_mte R = .7,
368 \_mte S = .7,
369 \_mte U = .7,
370 \_mte W = .7,
371 \_mte Z = .7,
372 }
373 \_doc
374 \`\.alphabetX`
375 \_cod
376
377 \.trydef \_mte_alphabetX {% alphabets, eXpansion
378 \_mte a = .7,
379 \_mte æ = .7,
380 \_mte b = .7,
381 \_mte c = .7,
382 \_mte d = .7,
383 \_mte e = .7,
384 \_mte g = .7,
385 \_mte h = .7,
386 \_mte k = .7,
387 \_mte m = .7,
388 \_mte n = .7,
389 \_mte o = .7,
390 \_mte œ = .7,
391 \_mte p = .7,
392 \_mte q = .7,
393 \_mte s = .7,
394 \_mte u = .7,
395 \_mte w = .7,
396 \_mte z = .7,
397 }
398 \_doc
399 \`\.digitsX`
400 \_cod
401
402 \.trydef \_mte_digitsX {% digits, eXpansion
403 \_mte 2 = .7,
404 \_mte 3 = .7,
405 \_mte 6 = .7,
406 \_mte 8 = .7,
407 \_mte 9 = .7,
408 }
409 \_doc
410 \`\.othersX`
411 \_cod
412
413 \.trydef \_mte_othersX {% others, eXpansion
414 }
415
416 \_doc --------------------
417 The \`\_mte_P` (for protrusion, all fonts) and \`\_mte_X`
418 (for expansion, all fonts) are empty by default but user can
419 declare specific values here. These macros are used last in the
420 \`\.allPR`, \`\.allPI`, \`\.allX` macros
421 (used in the lua code below), so it has general precedence.
422 \_cod --------------------
423
424 \.trydef \_mte_P {} % user specific, Protrusion
425 \.trydef \_mte_X {} % user specific, eXpansion
426
427 \_def \.allPR {\.AlphabetPR \.alphabetPR \.digitsPR \.punctPR \.quotPR \.othersPR \.P}
428 \_def \.allPI {\.AlphabetPI \.alphabetPI \.digitsPI \.punctPI \.quotPI \.othersPI \.P}
429 \_def \.allX {\.AlphabetX \.alphabetX \.digitsX \.othersX \.X}
430
431 \_doc --------------------
432 We add a new macro \`\.features` to the \OpTeX/'s
433 \olink[fontfeatures]\_fontfeatures. It is empty by
434 default but it will be changed by `\enablemte` to read protrusion and
435 expansion data using Lua code.
436 \_cod --------------------
437
438 \_addto\_fontfeatures{\.features}
439 \_def\.features{}
440
441 \_doc --------------------
442 \`\enablemte` initializes protrusion data by the \^`\.initprotrusion` macro
443 and expansion data by the \^`\.initexpansion` macro. Then it sets
444 \elink[pdfprotrudechars]{\protrudechars} and \elink[pdfadjustspacing]{\adjustspacing}
445 primitives and sets the \^`\.features` macro to use
446 the protrusion tables `pr` (for regular or bold fonts) or `pi` (for italic
447 or bold italic fonts). The table `ex` is used for expansion data.
448 These tables are declared in the Lua code below.
449 \nl
450 \`\disablemte` disables font \^`\.features` and sets appropriate primitive
451 registers to zero.
452 \_cod --------------------
453
454 \_def\.enablemte {%
455 \_initunifonts
456 \.initprotrusion % luacode, pr and pi tables initialized
457 \.initexpansion % luacode, ex table initialized
458 \_protrudechars=2
459 \_adjustspacing=2
460 \_def\.features{protrusion=p\.var;expansion=ex;}% pr/pi and ex tables used
461 \_reloading \_currvar
462 }
463 \_def\.disablemte {%
464 \_protrudechars=0
465 \_adjustspacing=0
466 \_def\.features{}%
467 \_reloading \_currvar
468 }
469 \_nspublic \enablemte \disablemte ;
470
471 \_doc --------------------
472 The \`\.var` macro expands ro `r` when regular or bold font is loaded
473 and it expands to `i` if italic or bold italic font is loaded.
474 The `pr` or `pi` data table is selected using this macro.
475 \_cod --------------------
476
477 \_def\.it{it}\_def\.bi{bi}
478 \_def\.var{\_ifx\_whatresize\.it i\_else \_ifx\_whatresize\.bi i\_else r\_fi\_fi}
479
480 \_doc -------------------
481 The `pr` and `pi` data tables are created using lua code in
482 the \`\.initprotrusion` macro. The data from \^`\.allPR` or \^`\.allPI`
483 are used here.
484 The analogical concept is used in the \`\.initexpansion` macro.
485 \_cod -------------------
486
487 \_def\.initprotrusion {%
488 \_directlua {%
489 fonts.protrusions.setups['pr']={
490 factor=\.fpfactor,
491 \.leftright,
492 \.allPR
493 }
494 fonts.protrusions.setups['pi']={
495 factor=\.fpfactor,
496 \.leftright,
497 \.allPI
498 }}}
499 \_def\.initexpansion {%
500 \_directlua {%
501 fonts.expansions.setups['ex']={
502 \.stretchshrinkstep,
503 factor=\.fxfactor,
504 \.allX
505 }}}
506
507 \_doc --------------------
508 The \`\.leftright`, \`\.stretchshrinkstep`, \`\.fpfactor`, and \`\.fxfactor`
509 macros are used in the Lua code above and they have following default values
510 (you can re-define them, if you want):
511 \_cod --------------------
512
513 \_def \.fpfactor{1}
514 \_def \.leftright {left=1, right=1}
515 \_def \.fxfactor{1}
516 \_def \.stretchshrinkstep {stretch=3, shrink=2, step=.5}
517
518 \_doc --------------------
519 \`\setfpfactor` and \`\setfxfactor` simply define \^`\.fpfactor` and \^`\.fxfactor`.
520 \_cod --------------------
521
522 \_def\.setfpfactor #1 {\_def\.fpfactor{#1}}
523 \_def\.setfxfactor #1 {\_def\.fxfactor{#1}}
524 \_nspublic \setfpfactor \setfxfactor ;
525
526 \_doc --------------------
527 There are similar letters: A, Á, Á, Â, Ã, Ä, Å, they need the same setting.
528 But only the basic letter (A in this example) has protrusion and/or expansion
529 setting using Lua code. The equivalent settings are done by the macro
530 \`\.setequivs``<font-switch>`.
531 This macro is used in \olink[_newfontloaded]{\_newfontloaded} `<font-switch>`
532 which is called by \OpTeX/ if the font is loaded first.
533 The \^`\.setequivs` macro uses data from \^`\.equalcodes` (see below)
534 and sets equal
535 \elink[lpcode]{\lpcode}, \elink[rpcode]{\rpcode}, and \elink[efcode]{\efcode}
536 for variant characters.
537 It is called only if \^`\.features` is non-empty, i.e.\ if the font
538 includes mte data.
539 \_cod --------------------
540
541 \_def\_newfontloaded#1{\_ifx\.features\_empty \_else \.setequivs#1\_fi}
542
543 \_def\.setequivs #1{\_let\.f=#1\_ea\.setequivsA\.equalcodes,,={},}
544 \_def\.setequivsA#1#2=#3#4,{\_ifx^#3^\_else
545 \_afterfi{\_tmpnum=`#1 \.setequivsB#3#4\_end\.setequivsA}\_fi}
546 \_def\.setequivsB#1{\_ifx\_end#1\_else
547 \_lpcode\.f`#1=\_lpcode\.f\_tmpnum
548 \_rpcode\.f`#1=\_rpcode\.f\_tmpnum
549 \_efcode\.f`#1=\_efcode\.f\_tmpnum
550 \_ea\.setequivsB\_fi
551 }
552
553 \_doc --------------------
554 \`\.equalcodes` includes comma separated equivalences. The same
555 \elink[lpcode]{\lpcode}, \elink[rpcode]{\rpcode}, and \elink[efcode]{\efcode}
556 for all characters
557 given at right side is set as these codes of the character given
558 at the left side of equal sign.
559 You can do `\addto\_mte_equalcodes{<your additional settings>}`
560 if you want.
561 \_cod --------------------
562
563 \_def\.equalcodes {%
564 A = ÀÁÂÃÄÅĀĂĄǺȀẠẢẤẦẨẪẬẮẰẲẶΑ,
565 B = ฿Β,
566 C = ÇĆĈĊČ,
567 D = ÐĎĐḌḎ,
568 E = ÈÉÊËĒĔĖĘĚȄẸẺẼỀẾỄỂỆΕ,
569 G = ĜĞĠĢǦǴ,
570 H = ĤĦḤḦḪΗ,
571 I = ÌÍÎÏĨĪĬĮİȈỈỊΙ,
572 J = Ĵ,
573 K = ĶΚ,
574 L = ĹĽĻŁḶ,
575 M = Μ,
576 N = ÑŃŅŇṄṆΝ,
577 O = ÒÓÔÕÖØŌŎŐỌƠǪǾȌỎỐỒỔỖỘỚỜỠỞỢΟ,
578 P = Ρ,
579 R = ŔŖŘȐṚṘṜ,
580 S = ŚŜŞŠȘṢ,
581 T = ŢŤȚṬṮΤ,
582 U = ÙÚÛÜŨŪŬŮŰŲƯȔỤỦỨỪỬỮỰ,
583 W = ŴẀẂẄ,
584 X = Χ,
585 Y = ÝŶŸỴỶỸ,
586 Z = ŹŻŽẒΖ,
587 a = àáâãäåāăąǻȁạảấầẩẫậắằẳẵ,
588 æ = ǽ,
589 c = çćĉċč,
590 d = đḍḏ, % ď has different right side
591 e = èéêëēĕėęěȅẹẻẽếềểễệ,
592 g = ĝğġģǧǵ,
593 h = ĥħḥḧḫ,
594 i = ìíîïĩīĭįıȉỉị,
595 j = ĵ,
596 k = ķ,
597 l = ĺļłḷḹ, % ľ has different right side
598 n = ñńņňṅṇ,
599 o = òóôõöøōŏőọơǫǿȍỏốồổỗộớờỡởợ,
600 r = ŕŗřȑṛṙṝ,
601 s = śŝşšșṣ,
602 t = ţțṭṯẗť,
603 u = ùúûüũūŭůűųưȕụủứừửữự,
604 w = ŵẁẃẅ,
605 y = ýŷÿỳỵỷỹ,
606 z = źżžẓ,
607 }
608 \_endnamespace
609 \_endcode
610
611 \tit MicroTypographic Extensions for \OpTeX/
612 \hfill v. \_mte_version
613
614 \centerline{\it Petr Olšák, 2021}
615 \bigskip
616
617 You can do `\load[mte]` followed by \^`\enablemte`. The microtypographic
618 extensions (protrusions, expansions) of all fonts are available after
619 \^`\enablemte`. The \LaTeX/ package Microtype does similar effect.
620
621 The \^`\enablemte` macro reloads the current font with microtypographic
622 extensions (mte) enabled and all new fonts loaded by the Font Selection System have
623 mte enabled too, because they are added to the
624 \olink[_fontfeatures]{\_fontfeatures} macro used by \OpTeX/.
625
626 The \^`\enablemte` macro does only local settings. If it is used in a group then
627 only fonts used in this group have mte.
628
629 The \^`\enablemte` macro sets (among other things)
630 \elink[pdfprotrudechars]{\protrudechars}`=2` (protrusion is enabled) and
631 \elink[pdfadjustspacing]{\adjustspacing}`=2` (font expansion is enabled).
632 You can disable these features by setting these primitive registers to zero
633 value (it is default if \^`\enablemte` is not used).
634 Note, that the values of these registers are checked when
635 paragraph is finalized although the fonts were loaded with mte enabled.
636 It means that you have to use `\par` before end of group
637 if you use \^`\enablemte` inside a group.
638 For example:
639
640 \begtt
641 {\enablemte
642 Roman font with mte enabled, \it italic font with mte enabled.
643 \par % mte features are used
644 }
645 \endtt
646 %
647 Or, simply use \^`\enablemte` at beginning of your document.
648
649 On the other hand, you can use \^`\disablemte` macro which reloads current
650 font with mte disabled and all newly loaded fonts have
651 mte disabled too. The macro has local validity. For example,
652 `{\disablemte text}` prints `text` by a font with
653 mte disabled. It works locally in the middle of the paragraph (unlike setting
654 `\protrudechars` and `\adjustspacing` to zero).
655
656 You can define your own protrusion or expansion values: copy macros
657 `\_mte_AlphabetPR`, `\_mte_quotPR`, etc.\ from this package and define them
658 as you wish using `\def`. Such definition has precedence.
659 Similar definitions can be in some font family files too, so: do your
660 definition after all `\fontfam` if you want to keep the precedence.
661 All such definitions must be performed before the \^`\enablemte` command.
662
663 You can use `\def\_mte_P` for data of protrusion for all fonts
664 which has general precedence. For example, if you want to protrude hyphen
665 char with factor one at the right side and by factor 0.5 at the left side, use
666 \begtt
667 \def\_mte_P {% user specification, Protrusion, Regular fonts
668 \_mte - = {.5, 1}, % /hyphen
669 }
670 \endtt
671 Analogical macro can be used for expansion data `\_mte_X`.
672
673 You can use \^`\setfpfactor` `<factor><space>` to set the factor by which
674 all protrusion data are scaled. The <factor> is decimal number and its default
675 value is~1. This macro can be used before \^`\enablemte`.
676 You can use \^`\setfxfactor` `<factor><space>` with analogical meaning,
677 expansion data are scaled by given~<factor>.
678
679 If you feel that default microtypographic data are wrong in a particular case,
680 please let me know. I can correct it in this package. If you feel
681 that a specific font family needs different microtypographic data, please
682 let me know. I can add extra definitions to appropriate font family
683 file.
684
685 \_doc
686 % Run optex -jobname mte-doc '\docgen mte'
687 % (two times) to generate documentation including references and the index.
688
689 \load [doc]
690
691 \def\elink[#1]#2{%
692 \ulink[http://petr.olsak.net/ftp/olsak/optex/tex-nutshell.pdf\#cs:#1]%
693 {\tt\string#2}%
694 }
695 \def\olink[#1]#2{%
696 \ulink[http://petr.olsak.net/ftp/olsak/optex/optex-doc.pdf\#cs:#1]%
697 {\tt\string#2}%
698 }
699
700 \printdoctail mte.opm
701 \printdoc mte.opm
702
703 \nonum\sec Index
704 \begmulti 3
705 \tt \makeindex
706 \endmulti
707
708 \bye
709 \_cod
710
711 \_endinput