summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/typo-krn.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/typo-krn.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/typo-krn.mkiv59
1 files changed, 31 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/context/base/typo-krn.mkiv b/Master/texmf-dist/tex/context/base/typo-krn.mkiv
index bb4a48a5d71..e1e404a7bef 100644
--- a/Master/texmf-dist/tex/context/base/typo-krn.mkiv
+++ b/Master/texmf-dist/tex/context/base/typo-krn.mkiv
@@ -5,7 +5,7 @@
%D subtitle=Spacing,
%D author=Hans Hagen,
%D date=\currentdate,
-%D copyright=\PRAGMA]
+%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
@@ -23,34 +23,28 @@
%
% {\setcharacterkerning[extrakerning]\input davis\relax}
-\unexpanded\def\definecharacterkerning
- {\dodoubleargument\dodefinecharacterkerning}
+\installcorenamespace{characterkerning}
-\def\dodefinecharacterkerning[#1][#2]%
- {\getparameters[\??ck#1][\c!factor=0.125,#2]%
- \setuvalue{\??ck:#1}{\dosetcharacterkerning{#1}}}
+\installcommandhandler \??characterkerning {characterkerning} \??characterkerning
-\unexpanded\def\setupcharacterkerning
- {\dodoubleargument\dosetupcharacterkerning}
-
-\def\dosetupcharacterkerning[#1][#2]%
- {\ifcsname\??ck:#1\endcsname
- \getparameters[\??ck#1][#2]%
+\unexpanded\def\setcharacterkerning[#1]%
+ {\edef\currentcharacterkerning{#1}%
+ \ifx\currentcharacterkerning\s!reset
+ \resetcharacterkerning
\else
- \dodefinecharacterkerning[#1][#2]% bonus
+ \typo_kerning_set
\fi}
-\unexpanded\def\dosetcharacterkerning#1%
- {\ctxlua{typesetters.kerns.set(\csname\??ck#1\c!factor\endcsname)}}
+% \def\typo_kerning_set
+% {\ctxcommand{setcharacterkerning(\characterkerningparameter\c!factor)}}
-\unexpanded\def\setcharacterkerning[#1]%
- {\csname\??ck:#1\endcsname}
+\def\typo_kerning_set
+ {\usecharacterkerningstyleandcolor\c!style\c!color % goodie, maybe also strut
+ \ctxcommand{setcharacterkerning(\characterkerningparameter\c!factor)}}
\unexpanded\def\resetcharacterkerning % fast one
{\attribute\kernattribute\attributeunsetvalue}
-\letvalue{\??ck\s!reset\c!factor}\attributeunsetvalue % trick
-
\appendtoks
\resetcharacterkerning
\to \everyresettypesetting
@@ -65,23 +59,32 @@
%D \stoptyping
%D
%D We could combine this with the previous definition command but
-%D then we alwasy would get a command defined which is not beforehand
+%D then we always would get a command defined which is not beforehand
%D a good idea.
\def\v!kerncharacters{kerncharacters} % no time now for translations
\definecharacterkerning [\v!kerncharacters] [\c!factor=.125]
+% Here we need to keep the groupedcommand solution as it is
+% used as modifier.
+
\unexpanded\def\kerncharacters
- {\dosingleempty\dokerncharacters}
+ {\doifnextoptionalelse\typo_kerning_apply_yes\typo_kerning_apply_nop}
+
+\def\typo_kerning_apply_yes[#1]%
+ {\groupedcommand{\typo_kerning_apply_yes_indeed{#1}}\donothing}
+
+\def\typo_kerning_apply_nop
+ {\groupedcommand\typo_kerning_apply_nop_indeed\donothing}
-\def\dokerncharacters[#1]%
- {\groupedcommand{\dodokerncharacters{#1}}\donothing}
+\def\typo_kerning_apply_yes_indeed#1%
+ {\let\currentcharacterkerning\v!kerncharacters
+ \setupcurrentcharacterkerning[\c!factor=#1]%
+ \typo_kerning_set}
-\def\dodokerncharacters#1%
- {\iffirstargument
- \setupcharacterkerning[\v!kerncharacters][\c!factor=#1]%
- \fi
- \setcharacterkerning[\v!kerncharacters]}
+\def\typo_kerning_apply_nop_indeed
+ {\let\currentcharacterkerning\v!kerncharacters
+ \typo_kerning_set}
\protect \endinput