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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
%D \module
%D [ file=font-ini,
%D version=2007.01.10,
%D title=\CONTEXT\ Font Macros,
%D subtitle=Initialization,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
\registerctxluafile{font-ini}{1.001}
\registerctxluafile{font-enc}{1.001}
\registerctxluafile{font-map}{1.001}
\registerctxluafile{font-syn}{1.001}
\registerctxluafile{font-tfm}{1.001}
\registerctxluafile{font-afm}{1.001}
\registerctxluafile{font-otf}{1.001}
\registerctxluafile{font-vf} {1.001}
\registerctxluafile{font-def}{1.001}
\registerctxluafile{font-fbk}{1.001}
\registerctxluafile{font-ext}{1.001}
% \startruntimectxluacode
% fonts.enc.make_unicode_vector() -- each time, brrr
% \stopruntimectxluacode
\unprotect
\def\mkdefinefontfeature#1#2#3%
{\ctxlua{fonts.define.specify.preset_context("#1","#2","#3")}}
% handy for manuals
\def\otfchar#1{\ctxlua{fonts.otf.char("#1")}}
%D: We cannot yet inherit because no colors are predefined.
\definecolor[font:init][r=.75]
\definecolor[font:medi][g=.75]
\definecolor[font:fina][b=.75]
\definecolor[font:isol][y=.75]
\definecolor[font:mark][m=.75]
\definecolor[font:rest][c=.75]
%D goodies:
%D
%D \starttyping
%D \showinstalledfonts[officinasans.*][all]
%D \showinstalledfonts[officinaserif.*][all]
%D \showinstalledfonts[officina.*itc.*][all]
%D
%D \showinstalledfonts[officina.*itc.*][all,new]
%D \stoptyping
\def\showinstalledfonts
{\dodoubleempty\doshowinstalledfonts}
\def\doshowinstalledfonts[#1][#2]%
{\bgroup
\def\pattern{#1}%
\def\all{false}%
\def\reload{false}%
\doifnothing\pattern{\def\pattern{.*}}%
\processallactionsinset[#2][\v!new=>\def\reload{true},\v!all=>\def\all{true}]%
\ctxlua{fonts.names.table("#1",\reload,\all)}%
\egroup}
%D Experimental!
\def\installfontfeature
{\dodoubleargument\doinstallfontfeature}
\def\doinstallfontfeature[#1][#2]%
{\ctxlua{fonts.install_feature("#1","#2")}}
%D Not yet in \MKII.
\def\fontfeatureslist
{\dodoubleargument\dofontfeatureslist}
\def\dofontfeatureslist[#1][#2]% todo: arg voor type
{\ctxlua{tex.sprint(tex.ctxcatcodes,fonts.define.specify.context_tostring("#1","otf","\luaescapestring{#2}","yes","no",true,{"number"}))}}
\def\definefontlocal#1%
{\expandafter\font\csname#1\endcsname\lastfontname\relax}
\def\definefontglobal#1%
{\global\expandafter\font\csname#1:\endcsname\lastfontname\relax}
\attribute\zerocount\zerocount % first in list, so fast match
% \def\featureattribute#1{\ctxlua{tex.sprint(fonts.define.specify.context_number("#1"))}}
% \def\setfontfeature #1{\attribute\zerocount\featureattribute{#1}\relax}
% \def\resetfontfeature#1{\attribute\zerocount\zerocount}
\let\currentfeature\empty
\def\featureattribute#1{\ctxlua{tex.sprint(fonts.define.specify.context_number("#1"))}}
\def\setfontfeature #1{\edef\currentfeature{#1}\attribute\zerocount\featureattribute{#1}\relax}
\def\resetfontfeature#1{\let\currentfeature\empty\attribute\zerocount\zerocount}
\appendtoks
\setfontfeature\currentfeature
\to \everylanguage
%D Simpler:
\def\updatefontparameters
{\edef\@@fonthandling{\truefontdata\somefontname\s!handling}%
\edef\@@fontfeatures{\truefontdata\fontfile \s!features}%
\edef\@@fontskewchar{\truefontdata\fontfile \s!skewchar}}
\def\setfontcharacteristics
{\the\everyfont}
%D Predefined:
% \installfontfeature[otf][tlig]
% \installfontfeature[otf][trep]
\protect \endinput
|