1if not modules then modules = { } end modules ['luatex-fonts-demo-vf-4'] = {
2 version = 1.001,
3 comment = "companion to luatex-*.tex",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9return function(specification)
10 local t = { }
11 for k, v in pairs(specification.features.normal) do
12 local n = tonumber(k)
13 if n then
14 t[n] = v
15 end
16 end
17 for k, v in ipairs(t) do
18 local name, rest = string.match(v,"^(.-){(.*)}$")
19 if rest then
20 t[k] = { name = name, list = { } }
21 for s in string.gmatch(rest,"([^%+]+)") do
22 local b, e = string.match(s,"^(.-)%-(.*)$")
23 if b and e then
24 b = tonumber(b)
25 e = tonumber(e)
26 else
27 b = tonumber(s)
28 e = b
29 end
30 if b and e then
31 table.insert(t[k].list,{ b = b, e = e })
32 end
33 end
34 else
35 t[k] = { name = v }
36 end
37 end
38 local ids = { }
39 for k, v in ipairs(t) do
40 local f, id
41 if tonumber(v.name) then
42 id = tonumber(v.name)
43 f = fonts.hashes.identifiers[id]
44 else
45 f, id = fonts.constructors.readanddefine(v.name,specification.size)
46 end
47 v.f = f
48 ids[k] = { id = id }
49 end
50 local one = t[1].f
51 if one then
52 one.properties.name = specification.name
53 one.properties.virtualized = true
54 one.fonts = ids
55 local chr = one.characters
56 for n, v in ipairs(t) do
57 if n == 1 then
58
59 elseif v.list and #v.list > 0 then
60 local chrs = v.f.characters
61 for k, v in ipairs(v.list) do
62 for u=v.b,v.e do
63 local c = chrs[u]
64 if c then
65 c.commands = {
66 { 'slot', n, u },
67 }
68 chr[u] = c
69 end
70 end
71 end
72 else
73 for u, c in ipairs(v.f.characters) do
74 c.commands = {
75 { 'slot', n, u },
76 }
77 chr[u] = c
78 end
79 end
80 end
81 end
82 return one
83end
84 |