blob: 2739ec5d4041be7e0cc7f6cf1d09a44062fcfbc3 (
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
|
%D \module
%D [ file=typo-dig,
%D version=2010.01.18,
%D title=\CONTEXT\ Typesetting Macros,
%D subtitle=Digits,
%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 / Digits}
\unprotect
\registerctxluafile{typo-dig}{1.001}
\definesystemattribute[digits] \chardef\digitsattribute \dogetattributeid{digits}
%D This could as well be a dynamic font feature but why bother.
%D
%D \macros
%D {\equaldigits}
%D
%D \startbuffer
%D test test \ruledhbox{123} test test\par
%D test test \ruledhbox{\equaldigits{123}} test test\par
%D test test \equaldigits{123} test test\par
%D \stopbuffer
%D
%D \typebuffer
%D
%D This calls result in:
%D
%D \startlines
%D \getbuffer
%D \stoplines
\unexpanded\def\setdigitsmanipulation[#1]%
{\ctxlua{typesetting.digits.set(\number#1)}}
\unexpanded\def\resetdigitsmanipulation
{\attribute\digitsattribute\attributeunsetvalue}
\appendtoks
\resetdigitsmanipulation
\to \everyresettypesetting
\unexpanded\def\equaldigits{\groupedcommand{\setdigitsmanipulation[\plusone]}{}}
\unexpanded\def\dummydigit {\hphantom{\setdigitsmanipulation[\plusone]0}}
\appendtoks
\resetcharacterspacing
\to \everyinitializeverbatim
\protect \endinput
|