hand-ini.mkxl /size: 4939 b    last modification: 2025-02-21 11:03
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{\do_set_expansion{\currentexpansion}}%
91\to \everydefineexpansion
92
93\protected\def\do_set_expansion#1%
94  {\edef\currentexpansion{#1}%
95   \adjustspacingstep   \expansionparameter\c!step   \relax
96   \adjustspacingstretch\expansionparameter\c!stretch\relax
97   \adjustspacingshrink \expansionparameter\c!shrink \relax}
98
99\permanent\tolerant\protected\def\setexpansion[#1]{\begincsname\??expansion:\ifparameter#1\or#1\else\currentexpansion\fi\endcsname}
100
101\permanent\protected\def\resetexpansion
102  {\adjustspacingstep   \zerocount
103   \adjustspacingstretch\zerocount
104   \adjustspacingshrink \zerocount}
105
106\protected\instance\letcsname\??expansion:\v!reset\endcsname\resetexpansion
107\protected\instance\defcsname\??expansion:\endcsname{\do_set_expansion\empty}%
108
109\setupexpansion
110  [\c!step=1,
111   \c!stretch=40,
112   \c!shrink=20]
113
114% \defineexpansion % the default
115% \defineexpansion[\v!default]
116
117\setexpansion
118
119%D New in \LMTX: can be used grouped.
120
121\permanent\protected\def\noexpansion {\bitwiseflip\glyphoptions\noexpansionglyphoptioncode}
122\permanent\protected\def\noprotrusion{\bitwiseflip\glyphoptions\noprotrusionglyphoptioncode}
123
124\protect \endinput
125