1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Typesetting Macros Initials}
15
16
17
18\unprotect
19
20\registerctxluafile{typodrp}{}
21
22\definesystemattribute[initial][public]
23
24\appendtoks
25 \c_attr_initial\attributeunsetvalue
26\to \everyforgetall
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\installcorenamespace{initial}
52
53\installcommandhandler \??initial {initial} \??initial
54
55\definemeasure[initial:n][\lineheight*\initialparameter\c!n \strutdp]
56
57\setupinitial
58 [\c!location=\v!text,
59 \c!n=3,
60 \c!m=1,
61 \c!method=\v!none,
62
63
64 \c!font=Bold cp \measure{initial:n},
65 \c!distance=.125\emwidth,
66 \c!hoffset=\zeropoint,
67 \c!voffset=\v!line,
68 \c!style=,
69 \c!color=,
70 \c!before=\blank]
71
72\unexpanded\def\placeinitial
73 {\dosingleempty\typo_initials_place}
74
75\def\typo_initials_place[#1]
76 {\par
77 \namedinitialparameter{#1}\c!before
78 \setinitial[#1]\relax}
79
80\unexpanded\def\setinitial
81 {\dodoubleempty\typo_initials_set}
82
83\unexpanded\def\typo_initials_set[#1][#2]
84 {\edef\typo_initial_handle{\typo_initial_handle_indeed{#1}{#2}}}
85
86\unexpanded\def\typo_initial_handle_indeed#1#2
87 {\dontleavehmode
88 \begingroup
89 \edef\currentinitial{#1}
90 \setupcurrentinitial[#2]
91 \resetfontfeature
92 \doifelsenothing{\initialparameter\c!style}
93 {\definedfont[\initialparameter\c!font]}
94 {\useinitialstyleparameter\c!style}
95 \useinitialcolorparameter\c!color
96 \edef\p_voffset{\initialparameter\c!voffset}
97 \scratchcounter \initialparameter\c!n\relax
98 \scratchvoffset\dimexpr\ifx\p_voffset\v!line\scratchcounter\lineheight\lineheight\else\p_voffset\fi\relax
99 \clf_setinitial
100 location {\initialparameter\c!location}
101 enabled true\space
102 n \scratchcounter
103 m \numexpr\initialparameter\c!m\relax
104 method {\initialparameter\c!method}
105 distance \dimexpr\initialparameter\c!distance\relax
106 hoffset \dimexpr\initialparameter\c!hoffset\relax
107 voffset \scratchvoffset
108 ma \c_attr_colormodel
109 ca \c_attr_color
110 ta \c_attr_transparency
111 font \fontid\font
112 dynamic \font_dynamic_value
113 \relax
114 \c_attr_initial\plusone
115 \initialparameter\c!text
116 \endgroup
117 \glet\typo_initial_handle\relax}
118
119\let\typo_initial_handle\relax
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136\protect \endinput
137 |