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
|
%D \module
%D [ file=m-oldotf,
%D version=2015.07.08,
%D title=\CONTEXT\ Extra Modules,
%D subtitle=Traditional OTF Loader,
%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.
\unprotect
\startluacode
local files = {
"font-otf",
"font-otb",
"font-inj",
-- "font-ota",
"font-otn",
"font-otd",
"font-otp",
"font-otc",
"font-oth",
"font-odv",
"font-one",
"font-map",
"font-fbk",
"font-gds",
}
local report = logs.reporter("oldotf")
local findfile = resolvers.findfile
local addsuffix = file.addsuffix
report()
report("using traditional font loader code")
report()
for i=1,#files do
local foundfile = findfile(addsuffix(files[i],"lua"))
if foundfile and foundfile ~= "" then
report("loading %a",foundfile)
dofile(foundfile)
end
end
report()
-- needed for testing:
local nuts = nodes.nuts
local copy_node = nuts.copy
local kern = nuts.pool.register(nuts.pool.kern())
local setfield = nuts.setfield
nuts.setattr(kern,attributes.private('fontkern'),1) -- we can have several, attributes are shared
nodes.injections.installnewkern(function(k)
local c = copy_node(kern)
setfield(c,"kern",k)
return c
end)
directives.register("fonts.injections.fontkern", function(v) setfield(kern,"subtype",v and 0 or 1) end)
local fonts = fonts
local handlers = fonts.handlers
local otf = handlers.otf -- brrr
local afm = handlers.afm -- brrr
local getters = fonts.getters
getters.kern .opentype = otf.getkern
getters.substitution.opentype = otf.getsubstitution
getters.alternate .opentype = otf.getalternate
getters.multiple .opentype = otf.getmultiple
\stopluacode
\protect \endinput
|