%D \module %D [ file=typo-krn, %D version=2009.03.27, % code moved from core-spa.mkiv %D title=\CONTEXT\ Typesetting Macros, %D subtitle=Spacing, %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 / Kerning} \unprotect \registerctxluafile{typo-krn}{1.001} \definesystemattribute[kern][public] % more % % {\setcharacterkerning[extrakerning]\input davis\relax} \installcorenamespace{characterkerning} \installcommandhandler \??characterkerning {characterkerning} \??characterkerning \unexpanded\def\setcharacterkerning[#1]% {\edef\currentcharacterkerning{#1}% \ifx\currentcharacterkerning\s!reset \resetcharacterkerning \else \typo_kerning_set \fi} % \def\typo_kerning_set % {\ctxcommand{setcharacterkerning(\characterkerningparameter\c!factor)}} \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} \appendtoks \resetcharacterkerning \to \everyresettypesetting \definecharacterkerning [extrakerning] [\c!factor=.125] % used in manuals %D Added after discussion on list (posted by WS, adapted abit by HH) %D \unknown\ this needs to be interfaced (\type {\v!kerncharacters}). %D %D \starttyping %D \setuphead[section][style=\sca,textstyle={\kerncharacters[.5]}] \section{Section} %D \stoptyping %D %D We could combine this with the previous definition command but %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 {\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\typo_kerning_apply_yes_indeed#1% {\let\currentcharacterkerning\v!kerncharacters \setupcurrentcharacterkerning[\c!factor=#1]% \typo_kerning_set} \def\typo_kerning_apply_nop_indeed {\let\currentcharacterkerning\v!kerncharacters \typo_kerning_set} \protect \endinput