font-mis.lua /size: 2172 b    last modification: 2020-07-01 14:35
1
if
not
modules
then
modules
=
{
}
end
modules
[
'
font-mis
'
]
=
{
2
version
=
1
.
001
,
3
comment
=
"
companion to mtx-fonts
"
,
4
author
=
"
Hans Hagen, PRAGMA-ADE, Hasselt NL
"
,
5
copyright
=
"
PRAGMA ADE / ConTeXt Development Team
"
,
6
license
=
"
see context related readme files
"
7
}
8 9
fonts
=
fonts
or
{
}
10 11
local
helpers
=
fonts
.
helpers
or
{
}
12
fonts
.
helpers
=
helpers
13 14
local
handlers
=
fonts
.
handlers
or
{
}
15
fonts
.
handlers
=
handlers
16 17
local
otf
=
handlers
.
otf
or
{
}
18
handlers
.
otf
=
otf
19 20
local
readers
=
otf
.
readers
21 22
if
readers
then
23 24
otf
.
version
=
otf
.
version
or
3
.
111
25
otf
.
cache
=
otf
.
cache
or
containers
.
define
(
"
fonts
"
,
"
otl
"
,
otf
.
version
,
true
)
26 27
function
fonts
.
helpers
.
getfeatures
(
name
,
save
)
28
local
filename
=
resolvers
.
findfile
(
name
)
or
"
"
29
if
filename
~
=
"
"
then
30
-- local name = file.removesuffix(file.basename(filename))
31
-- local cleanname = containers.cleanname(name)
32
-- local data = containers.read(otf.cache,cleanname)
33
-- if data then
34
-- readers.unpack(data)
35
-- else
36
-- data = readers.loadfont(filename) -- we can do a more minimal load
37
-- -- if data and save then
38
-- -- -- keep this in sync with font-otl
39
-- -- readers.compact(data)
40
-- -- readers.rehash(data,"unicodes")
41
-- -- readers.addunicodetable(data)
42
-- -- readers.extend(data)
43
-- -- readers.pack(data)
44
-- -- -- till here
45
-- -- containers.write(otf.cache,cleanname,data)
46
-- -- end
47
-- end
48
-- if not data then
49
-- data = readers.loadfont(filename) -- we can do a more minimal load
50
-- end
51
-- if data then
52
-- readers.unpack(data)
53
-- end
54
local
data
=
otf
.
load
(
filename
)
55
local
resources
=
data
and
data
.
resources
56
if
resources
then
57
return
data
.
resources
.
features
,
data
.
resources
.
foundtables
,
data
58
end
59
end
60
end
61 62
else
63 64
function
fonts
.
helpers
.
getfeatures
(
name
)
65
-- not supported
66
end
67 68
end
69