1if not modules then modules = { } end modules ['font-ini'] = {
2 version = 1.001,
3 comment = "companion to font-ini.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9local sortedhash, setmetatableindex = table.sortedhash, table.setmetatableindex
10local allocate = utilities.storage.allocate
11
12fonts = fonts or { }
13local fonts = fonts
14
15local identifiers = allocate()
16
17fonts.hashes = fonts.hashes or { identifiers = identifiers }
18fonts.tables = fonts.tables or { }
19fonts.helpers = fonts.helpers or { }
20fonts.tracers = fonts.tracers or { }
21fonts.specifiers = fonts.specifiers or { }
22fonts.callbacks = fonts.callbacks or { }
23
24fonts.analyzers = { }
25fonts.readers = { }
26fonts.definers = { methods = { } }
27fonts.loggers = { register = function() end }
28
29fonts.privateoffsets = {
30 textbase = 0xF0000,
31 textextrabase = 0xFD000,
32 mathextrabase = 0xFE000,
33 mathbase = 0xFF000,
34 keepnames = false,
35}
36
37local effects = setmetatableindex(
38 function(t,slant)
39 local v = setmetatableindex(
40 function(t,squeeze)
41 local v = setmetatableindex(
42 function(t,extend)
43 local v = setmetatableindex(
44 function(t,mode)
45 local v = setmetatableindex(
46 function(t,line)
47 local v = {
48 slant = slant,
49 squeeze = squeeze,
50 extend = extend,
51 mode = mode,
52 line = line * 1000,
53 }
54 t[line] = v
55 return v
56 end)
57 t[mode] = v
58 return v
59 end)
60 t[extend] = v
61 return v
62 end)
63 t[squeeze] = v
64 return v
65 end)
66 t[slant] = v
67 return v
68 end)
69
70
71
72
73
74
75
76
77
78fonts.effects = effects
79
80fonts.effects[0][1][1][0][0] = false
81
82function fonts.toeffect(t)
83 local slant = t.slant or 0
84 local squeeze = t.squeeze or 1
85 local extend = t.extend or 1
86 local mode = t.mode or 0
87 local line = t.weight or t.line or 0
88 if slant or squeeze or extend or mode or line then
89 local effect = effects[slant][squeeze][extend][mode][line]
90 if effect then
91 return effect
92 end
93 end
94end
95
96
97 |