summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-mis.lua
blob: d359e213232cc0e57cb580c2ff4451fcc75482c9 (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
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 { }

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

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

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

local readers  = otf.readers

if readers then

    otf.version = otf.version or 3.020
    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)
                if data and save then
                    containers.write(otf.cache,cleanname,data)
                end
            end
            return data and data.resources and data.resources.features
        end
    end

else

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

end