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 { }
22
23fonts.analyzers = { }
24fonts.readers = { }
25fonts.definers = { methods = { } }
26fonts.loggers = { register = function() end }
27
28fonts.privateoffsets = {
29 textbase = 0xF0000,
30 textextrabase = 0xFD000,
31 mathextrabase = 0xFE000,
32 mathbase = 0xFF000,
33 keepnames = false,
34}
35
36local effects = setmetatableindex(
37 function(t,slant)
38 local v = setmetatableindex(
39 function(t,squeeze)
40 local v = setmetatableindex(
41 function(t,extend)
42 local v = setmetatableindex(
43 function(t,mode)
44 local v = setmetatableindex(
45 function(t,line)
46 local v = {
47 slant = slant,
48 squeeze = squeeze,
49 extend = extend,
50 mode = mode,
51 line = line * 1000,
52 }
53 t[line] = v
54 return v
55 end)
56 t[mode] = v
57 return v
58 end)
59 t[extend] = v
60 return v
61 end)
62 t[squeeze] = v
63 return v
64 end)
65 t[slant] = v
66 return v
67 end)
68
69
70
71
72
73
74
75
76
77fonts.effects = effects
78
79fonts.effects[0][1][1][0][0] = false
80
81function fonts.toeffect(t)
82 local slant = t.slant or 0
83 local squeeze = t.squeeze or 1
84 local extend = t.extend or 1
85 local mode = t.mode or 0
86 local line = t.line or 0
87 if slant or squeeze or extend or mode or line then
88 local effect = effects[slant][squeeze][extend][mode][line]
89 if effect then
90 return effect
91 end
92 end
93end
94
95
96 |