summaryrefslogtreecommitdiff
path: root/tex/context/base/font-ini.lua
blob: d4adf360bc915d1df6cb4b1680cadc890b28a00c (plain)
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
if not modules then modules = { } end modules ['font-ini'] = {
    version   = 1.001,
    comment   = "companion to font-ini.tex",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

--[[ldx--
<p>Not much is happening here.</p>
--ldx]]--

-- vtf comes first
-- fix comes last

fonts = fonts or { }

fonts.trace = false -- true
fonts.mode  = 'base'

fonts.methods = {
    base = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { } },
    node = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { }  },
}

fonts.initializers = {
    base = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { }  },
    node = { tfm = { }, afm = { }, otf = { }, vtf = { }, fix = { }  }
}

fonts.triggers = {
    'mode',
    'language',
    'script'
}

-- tracing

do

    fonts.color = fonts.color or { }

    fonts.color.trace = false

    local attribute = attributes.numbers['color'] or 4 -- we happen to know this -)
    local mapping   = attributes.list[attribute]

    local set_attribute   = node.set_attribute
    local unset_attribute = node.unset_attribute

    function fonts.color.set(n,c)
    --  local mc = mapping[c] if mc then unset_attribute((n,attribute) else set_attribute(n,attribute,mc) end
        set_attribute(n,attribute,mapping[c] or -1) -- also handles -1 now
    end
    function fonts.color.reset(n)
        unset_attribute(n,attribute)
    end

end