blob: e2f10d8066a5f24519ff2026314b4b125ee48be5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
%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]
%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]
% more
%
% {\setcharacterkerning[extrakerning]\input davis\relax}
\newcount \maxcharacterkerningid
\def\definecharacterkerning
{\dosingleargument\dodefinecharacterkerning}
\def\dodefinecharacterkerning[#1]%
{\ifcsname\??ck#1\endcsname \else
\global\advance\maxcharacterkerningid\plusone
\setxvalue{\??ck:#1}{\the\maxcharacterkerningid}%
\fi}
\def\setupcharacterkerning
{\dodoubleargument\dosetupcharacterkerning}
\def\dosetupcharacterkerning[#1][#2]%
{\ifcsname\??ck:#1\endcsname
\begingroup
\getparameters[\??ck][\c!factor=0,#2]%
\ctxlua{kerns.setspacing(\getvalue{\??ck:#1},\@@ckfactor)}%
\endgroup
\fi}
\def\setcharacterkerning
{\ctxlua{kerns.enabled=true}%
\gdef\setcharacterkerning[##1]{\dosetattribute{kern}{\csname\??ck:##1\endcsname}}%
\setcharacterkerning}
\letvalue{\??ck:\s!reset}\attributeunsetvalue
\definecharacterkerning[extrakerning]
\setupcharacterkerning[extrakerning][\c!factor=.125]
\protect \endinput
|