typo-pnc.mkiv /size: 1644 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [       file=typo-pnc,
3%D        version=2017.06.23, % experiment in project
4%D          title=\CONTEXT\ Typesetting Macros,
5%D       subtitle=Punctuation,
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 / Punctuation}
15
16\unprotect
17
18% In manuals we often have "foo e.g. bar" where we then have to compensate spaces
19% with "foo e.g.\ bar" so let's see if we can automate that and at the same time
20% inject spaces between the snippets. It gets boring writing this kind of code.
21
22\registerctxluafile{typo-pnc}{}
23
24\definesystemattribute[periodkern][public,global]
25
26\installcorenamespace{periodkerning}
27
28\installcommandhandler \??periodkerning {periodkerning} \??periodkerning
29
30\unexpanded\def\setperiodkerning[#1]%
31  {\edef\currentperiodkerning{#1}%
32   \ifx\currentperiodkerning\s!reset
33     \resetperiodkerning
34   \else
35     \typo_periodkerning_set
36   \fi}
37
38\def\typo_periodkerning_set
39  {\clf_setperiodkerning{\periodkerningparameter\c!factor}}
40
41\unexpanded\def\resetperiodkerning % fast one
42  {\c_attr_periodkern\attributeunsetvalue}
43
44\appendtoks
45    \resetperiodkerning
46\to \everyresettypesetting
47
48\defineperiodkerning [zerospaceperiods]  [\c!factor=0]
49\defineperiodkerning [smallspaceperiods] [\c!factor=.25]
50\defineperiodkerning [halfspaceperiods]  [\c!factor=.5]
51
52% If we ever need a command, see typo-krn.mkiv but it doesn't make much sense
53% to have it.
54
55\protect
56