hand-ini.mkxl /size: 4494 b    last modification: 2023-12-21 09:44
1%D \module
2%D   [       file=hand-ini,
3%D        version=2008.02.12,
4%D          title=\CONTEXT\ Handling Macros,
5%D       subtitle=Initialization,
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%D Handling is implemented differently in \MKIV. Maybe I'll cook up
15%D some compatibility hack.
16
17% \definefontfeature[demo][default][mode=node,expansion=quality]
18% \definefontfeature[demo][default][mode=node,protrusion=pure]
19
20% experimental setup:
21%
22%  \showframe \setupalign[hanging] \enabletrackers[fonts.protrusion]
23%
24%  \definefontfeature[default] [default][mode=node,script=latn]
25%  %definefontfeature[whatever][default][mode=node,lfbd=yes,rtbd=yes,script=latn]
26%  \definefontfeature[whatever][default][mode=node,protrusion=quality]
27%  \definefontfeature[whocares][default][mode=node,protrusion=yes,opbd=yes,script=latn] % left|right|yes
28%
29%  \definedfont[fxlbi.otf*default]  \input tufte 0123456789 \par \dorecurse{15}{1 2 3 4 5 6 7 8 9 0 } \par
30%  \definedfont[fxlbi.otf*whatever] \input tufte 0123456789 \par \dorecurse{15}{1 2 3 4 5 6 7 8 9 0 } \par
31%  \definedfont[fxlbi.otf*whocares] \input tufte 0123456789 \par \dorecurse{15}{1 2 3 4 5 6 7 8 9 0 } \par
32%
33%  %definefontfeature[whocares][default][mode=node,protrusion=2,opbd=yes,script=latn,featurefile=texgyrepagella-regularxx.fea]
34%  \definefontfeature[whocares][default][mode=node,protrusion=2,opbd=yes,script=latn]
35%
36%  \definedfont[texgyrepagella-regularxx.otf*whocares] \input tufte
37
38\unprotect
39
40%D Probbaly not yet used by many.
41
42\permanent\tolerant\protected\def\setupfontexpansion [#1]#*[#2]{\clf_setupfontexpansion {#1}{#2}}
43\permanent\tolerant\protected\def\setupfontprotrusion[#1]#*[#2]{\clf_setupfontprotrusion{#1}{#2}}
44
45% \setupfontprotrusion[quality-upright][vector=quality]
46% \setupfontprotrusion[quality-slanted][vector=quality,right=1.5]
47
48\pushoverloadmode
49
50    \let\adjustspacing\relax \newcount\adjustspacing % a little bit protection
51    \let\protrudechars\relax \newcount\protrudechars % a little bit protection
52
53\popoverloadmode
54
55%D At some point we can introduce extreme expansion, i.e. \type {\normaladjustspacing\plustwo}.
56
57% 0 = disabled
58% 1 = notused      (thesis)
59% 2 = glyph + kern
60% 3 = glyph only   (default)
61
62\def\font_expansion_enable  {\normaladjustspacing\plusthree}
63\def\font_expansion_enable_k{\normaladjustspacing\plustwo}
64%def\font_expansion_enable_n{\normaladjustspacing\plusone}
65\def\font_expansion_disable {\normaladjustspacing\zerocount}
66
67\def\font_protruding_enable_b{\normalprotrudechars\plusthree} % also deal with r2l (experimental lmtx)
68\def\font_protruding_enable  {\normalprotrudechars\plustwo  }
69\def\font_protruding_disable {\normalprotrudechars\zerocount}
70
71\appendtoks \font_expansion_disable  \to \everyforgetall % Here or not here?
72\appendtoks \font_protruding_disable \to \everyforgetall % Here or not here?
73
74% \def\fonthandlingerror{\writestatus\m!fonts{font handling is replaced by features in mkiv}}
75%
76% \lettonothing\fonthandling
77%
78% \protected\def\startfonthandling  #1{\fonthandlingerror\fonthandlingerror\gobbleuntil\stopfonthandling} % can't happen
79% \protected\def\definefonthandling   {\dotripleempty\dodefinefonthandling}
80% \protected\def\setupfonthandling    {\dodoubleempty\dosetupfonthandling }
81% \def\dodefinefonthandling[#1][#2][#3]{\fonthandlingerror}
82% \def\dosetupfonthandling     [#1][#2]{\fonthandlingerror}
83% \def\usehandling                 [#1]{\fonthandlingerror}
84
85\installcorenamespace{expansion}
86
87\installcommandhandler \??expansion {expansion} \??expansion
88
89\appendtoks
90    \protected\instance\edefcsname\??expansion:\currentexpansion\endcsname
91      {\adjustspacingstep   \expansionparameter\c!step\relax
92       \adjustspacingstretch\expansionparameter\c!stretch\relax
93       \adjustspacingshrink \expansionparameter\c!shrink\relax}%
94\to \everydefineexpansion
95
96\setupexpansion
97  [\c!step=1,
98   \c!stretch=40,
99   \c!shrink=20]
100
101% \defineexpansion
102%   [myexpansion]
103%   [\c!stretch=50,
104%    \c!shrink=20]
105
106\permanent\tolerant\protected\def\setexpansion[#1]{\begincsname\??expansion:#1\endcsname}
107
108%D New in \LMTX: can be used grouped.
109
110\permanent\protected\def\noexpansion {\bitwiseflip\glyphoptions\noexpansionglyphoptioncode}
111\permanent\protected\def\noprotrusion{\bitwiseflip\glyphoptions\noprotrusionglyphoptioncode}
112
113\protect \endinput
114