diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-01-12 08:12:50 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-01-12 08:12:50 +0100 |
commit | d0edf3e90e8922d9c672f24ecdc5d44fe2716f31 (patch) | |
tree | 5b618b87aa5078a8c744c94bbf058d69cd7111b2 /tex/context/base/mkiv/typo-pnc.mkiv | |
parent | 409a95f63883bd3b91699d39645e39a8a761457c (diff) | |
download | context-d0edf3e90e8922d9c672f24ecdc5d44fe2716f31.tar.gz |
2018-01-08 23:11:00
Diffstat (limited to 'tex/context/base/mkiv/typo-pnc.mkiv')
-rw-r--r-- | tex/context/base/mkiv/typo-pnc.mkiv | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/typo-pnc.mkiv b/tex/context/base/mkiv/typo-pnc.mkiv new file mode 100644 index 000000000..39d0c85f4 --- /dev/null +++ b/tex/context/base/mkiv/typo-pnc.mkiv @@ -0,0 +1,55 @@ +%D \module +%D [ file=typo-pnc, +%D version=2017.06.23, % experiment in project +%D title=\CONTEXT\ Typesetting Macros, +%D subtitle=Punctuation, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Typesetting Macros / Punctuation} + +\unprotect + +% In manuals we often have "foo e.g. bar" where we then have to compensate spaces +% with "foo e.g.\ bar" so let's see if we can automate that and at the same time +% inject spaces between the snippets. It gets boring writing this kind of code. + +\registerctxluafile{typo-pnc}{} + +\definesystemattribute[periodkern][public,global] + +\installcorenamespace{periodkerning} + +\installcommandhandler \??periodkerning {periodkerning} \??periodkerning + +\unexpanded\def\setperiodkerning[#1]% + {\edef\currentperiodkerning{#1}% + \ifx\currentperiodkerning\s!reset + \resetperiodkerning + \else + \typo_periodkerning_set + \fi} + +\def\typo_periodkerning_set + {\clf_setperiodkerning{\periodkerningparameter\c!factor}} + +\unexpanded\def\resetperiodkerning % fast one + {\attribute\periodkernattribute\attributeunsetvalue} + +\appendtoks + \resetperiodkerning +\to \everyresettypesetting + +\defineperiodkerning [zerospaceperiods] [\c!factor=0] +\defineperiodkerning [smallspaceperiods] [\c!factor=.25] +\defineperiodkerning [halfspaceperiods] [\c!factor=.5] + +% If we ever need a command, see typo-krn.mkiv but it doesn't make much sense +% to have it. + +\protect |