summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-mis.lua
blob: 68165c9b8f5a58df707fdfebc27799daba72baa3 (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
60
61
62
63
64
65
if not modules then modules = { } end modules ['font-mis'] = {
    version   = 1.001,
    comment   = "companion to mtx-fonts",
    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
    copyright = "PRAGMA ADE / ConTeXt Development Team",
    license   = "see context related readme files"
}

fonts          = fonts or { }

local helpers  = fonts.helpers or { }
fonts.helpers  = helpers

local handlers = fonts.handlers or { }
fonts.handlers = handlers

local otf      = handlers.otf or { }
handlers.otf   = otf

local readers  = otf.readers

if readers then

    otf.version = otf.version or 3.109
    otf.cache   = otf.cache   or containers.define("fonts", "otl", otf.version, true)

    function fonts.helpers.getfeatures(name,save)
        local filename = resolvers.findfile(name) or ""
        if filename ~= "" then
--             local name      = file.removesuffix(file.basename(filename))
--             local cleanname = containers.cleanname(name)
--             local data      = containers.read(otf.cache,cleanname)
--             if data then
--                 readers.unpack(data)
--             else
--                 data = readers.loadfont(filename) -- we can do a more minimal load
--              -- if data and save then
--              --     -- keep this in sync with font-otl
--              --     readers.compact(data)
--              --     readers.rehash(data,"unicodes")
--              --     readers.addunicodetable(data)
--              --     readers.extend(data)
--              --     readers.pack(data)
--              --     -- till here
--              --     containers.write(otf.cache,cleanname,data)
--              -- end
--             end
--             if not data then
--                 data = readers.loadfont(filename) -- we can do a more minimal load
--             end
--             if data then
--                 readers.unpack(data)
--             end
local data = otf.load(filename)
            return data and data.resources and data.resources.features
        end
    end

else

    function fonts.helpers.getfeatures(name)
        -- not supported
    end

end