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
|
if not modules then modules = { } end modules ['luatex-fonts-demo-vf-4'] = {
version = 1.001,
comment = "companion to luatex-*.tex",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
return function(specification)
local t = { }
for k, v in pairs(specification.features.normal) do
local n = tonumber(k)
if n then
t[n] = v
end
end
for k, v in ipairs(t) do
local name, rest = string.match(v,"^(.-){(.*)}$")
if rest then
t[k] = { name = name, list = { } }
for s in string.gmatch(rest,"([^%+]+)") do
local b, e = string.match(s,"^(.-)%-(.*)$")
if b and e then
b = tonumber(b)
e = tonumber(e)
else
b = tonumber(s)
e = b
end
if b and e then
table.insert(t[k].list,{ b = b, e = e })
end
end
else
t[k] = { name = v }
end
end
local ids = { }
for k, v in ipairs(t) do
local f, id
if tonumber(v.name) then
id = tonumber(v.name)
f = fonts.hashes.identifiers[id]
else
f, id = fonts.constructors.readanddefine(v.name,specification.size)
end
v.f = f
ids[k] = { id = id }
end
local one = t[1].f
if one then
one.properties.name = specification.name
one.properties.virtualized = true
one.fonts = ids
local chr = one.characters
for n, v in ipairs(t) do
if n == 1 then
-- use font 1 as base
elseif v.list and #v.list > 0 then
local chrs = v.f.characters
for k, v in ipairs(v.list) do
for u=v.b,v.e do
local c = chrs[u]
if c then
c.commands = {
{ 'slot', n, u },
}
chr[u] = c
end
end
end
else
for u, c in ipairs(v.f.characters) do
c.commands = {
{ 'slot', n, u },
}
chr[u] = c
end
end
end
end
return one
end
|