typo-itc.mklx /size: 3235 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [       file=typo-itc,
3%D        version=2011.10.08,
4%D          title=\CONTEXT\ Typesetting Macros,
5%D       subtitle=Italic Correction,
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\writestatus{loading}{ConTeXt Typesetting Macros / Italics Corrections}
15
16\unprotect
17
18%D The brave might try:
19%D
20%D \starttyping
21%D \definefontfeature[default][default][itlc=yes] % is now default
22%D \setitaliccorrection
23%D \stoptyping
24
25\registerctxluafile{typo-itc}{autosuffix}
26
27\installcorenamespace{italics}
28
29\permanent\protected\def\typo_italic_set
30  {\bitwiseflip\glyphoptions        \textcheckitalicglyphoptioncode
31   \bitwiseflip\discretionaryoptions\textcheckitalicdiscoptioncode}
32
33\permanent\protected\def\typo_italic_reset
34  {\bitwiseflip\glyphoptions        -\textcheckitalicglyphoptioncode
35   \bitwiseflip\discretionaryoptions-\textcheckitalicdiscoptioncode}
36
37\letcsname\??italics\v!no    \endcsname\typo_italic_reset
38\letcsname\??italics\v!reset \endcsname\typo_italic_reset
39%letcsname\??italics\v!yes   \endcsname\typo_italic_set
40%letcsname\??italics\v!big   \endcsname\typo_italic_set
41%letcsname\??italics\v!medium\endcsname\typo_italic_set
42%letcsname\??italics\v!small \endcsname\typo_italic_set
43
44\permanent\tolerant\protected\def\setitaliccorrection[#1]%
45  {\ifcsname\??italics#1\endcsname\lastnamedcs\else\typo_italic_set\fi}
46
47\aliased\let\resetitaliccorrection\typo_italic_reset
48\aliased\let\setupitaliccorrection\setitaliccorrection
49
50\permanent\protected\def\italiccorrection
51  {\ifbitwiseand\glyphoptions\textcheckitalicglyphoptioncode\else
52     % This doesn't do anything due to the way we set up the callback ...
53     % \normalitaliccorrection
54     % ... so we do this instead:
55     \forcedrightcorrection
56   \fi}
57
58\pushoverloadmode
59    \aliased\let\/\italiccorrection % replaces the primitive
60  % \aliased\let\explicititaliccorrection\italiccorrection % replaces the primitive
61\popoverloadmode
62
63% only for manuals ... obsolete
64
65\permanent\protected\def\pushitaliccorrection{}% \typo_italic_reset
66\permanent\protected\def\popitaliccorrection {}% \typo_italic_set
67
68%D Correcting for weird shapes.
69
70%D \starttyping
71%D \showglyphs \showfontitalics \showfontkerns
72%D
73%D \setupbodyfont[bonum]
74%D
75%D \startTEXpage[offset=1ts,width=5em]
76%D     \setupitaliccorrection[italic]
77%D     \dontleavehmode
78%D     \ruledhbox{\it\shapecorrection[both] f}\quad
79%D     \ruledhbox{\it\shapecorrection[both]ff}
80%D \stopTEXpage
81%D \stoptyping
82
83\installcorenamespace{shapecorrection}
84
85\defcsname\??shapecorrection\v!left \endcsname{\groupedcommandcs\forcedleftcorrection\relax}
86\defcsname\??shapecorrection\v!right\endcsname{\groupedcommandcs\relax               \forcedrightcorrection}
87\defcsname\??shapecorrection\v!both \endcsname{\groupedcommandcs\forcedleftcorrection\forcedrightcorrection}
88\defcsname\??shapecorrection        \endcsname{\groupedcommandcs\relax               \forcedrightcorrection}
89
90\permanent\tolerant\protected\def\shapecorrection[#1]{\begincsname\??shapecorrection#1\endcsname}
91
92\protect \endinput
93