hand-ini.mkxl /size: 4309 b    last modification: 2020-07-01 14:35
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 New stuff.
41 42
\unexpanded
\def
\setupfontexpansion
{
\dodoubleargument
\font_expansion_setup
}
43
\unexpanded
\def
\setupfontprotrusion
{
\dodoubleargument
\font_protrusion_setup
}
44 45
\def
\font_expansion_setup
[#
1
][#
2
]
{
\clf_setupfontexpansion
{
#
1
}{
#
2
}}
46
\def
\font_protrusion_setup
[#
1
][#
2
]
{
\clf_setupfontprotrusion
{
#
1
}{
#
2
}}
47 48
% \setupfontprotrusion[quality-upright][vector=quality]
49
% \setupfontprotrusion[quality-slanted][vector=quality,right=1.5]
50 51
\let\adjustspacing\relax
\newcount
\adjustspacing
% a little bit protection
52
\let\protrudechars\relax
\newcount
\protrudechars
% a little bit protection
53 54
% at some point we can introduce extreme expansion, i.e. \normaladjustspacing\plustwo
55 56
% 0 = disabled
57
% 1 = notused (thesis)
58
% 2 = glyph + kern
59
% 3 = glyph only
60 61
\def
\font_expansion_enable
{
\normaladjustspacing
\plusthree
}
62
\def
\font_expansion_enable_k
{
\normaladjustspacing
\plustwo
}
63
%def\font_expansion_enable_n{\normaladjustspacing\plusone}
64
\def
\font_expansion_disable
{
\normaladjustspacing
\zerocount
}
65 66
\def
\font_protruding_enable_b
{
\normalprotrudechars
\plusthree
}
% also deal with r2l (experimental lmtx)
67
\def
\font_protruding_enable
{
\normalprotrudechars
\plustwo
}
68
\def
\font_protruding_disable
{
\normalprotrudechars
\zerocount
}
69 70
\appendtoks
\font_expansion_disable
\to
\everyforgetall
% Here or not here?
71
\appendtoks
\font_protruding_disable
\to
\everyforgetall
% Here or not here?
72 73
% \def\fonthandlingerror{\writestatus\m!fonts{font handling is replaced by features in mkiv}}
74
%
75
% \let\fonthandling\empty
76
%
77
% \unexpanded\def\startfonthandling #1{\fonthandlingerror\fonthandlingerror\gobbleuntil\stopfonthandling} % can't happen
78
% \unexpanded\def\definefonthandling {\dotripleempty\dodefinefonthandling}
79
% \unexpanded\def\setupfonthandling {\dodoubleempty\dosetupfonthandling }
80
% \def\dodefinefonthandling[#1][#2][#3]{\fonthandlingerror}
81
% \def\dosetupfonthandling [#1][#2]{\fonthandlingerror}
82
% \def\usehandling [#1]{\fonthandlingerror}
83 84
\installcorenamespace
{
expansion
}
85 86
\installcommandhandler
\??expansion
{
expansion
}
\??expansion
87 88
\appendtoks
89
\setuevalue
{
\??expansion
:
\currentexpansion
}
%
90
{
\adjustspacingstep
\expansionparameter
\c!step
\relax
91
\adjustspacingstretch
\expansionparameter
\c!stretch
\relax
92
\adjustspacingshrink
\expansionparameter
\c!shrink
\relax
}
%
93
\to
\everydefineexpansion
94 95
\defineexpansion
96
[
\c!step
=
1
,
97
\c!stretch
=
4
0
,
98
\c!shrink
=
2
0
]
99 100
% \defineexpansion
101
% [myexpansion]
102
% [\c!stretch=50,
103
% \c!shrink=20]
104 105
\unexpanded
\def
\setexpansion
106
{
\dosingleempty
\font_expansion_set
}
107 108
\unexpanded
\def
\font_expansion_set
[#
1
]
%
109
{
\begincsname
\??expansion
:
#
1
\endcsname
}
110 111
\protect
\endinput
112