diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-02-17 10:31:56 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-02-17 10:31:56 +0100 |
commit | b14f992ef5f4e868c9959b174278c86516d60dbc (patch) | |
tree | 28587bb46c025ea7b0d27ba93f09c93dcf53c73a /tex/context/base/mkiv/font-web.lua | |
parent | 95a1799032dc61dbca4a11e495be34b4397c8fec (diff) | |
download | context-b14f992ef5f4e868c9959b174278c86516d60dbc.tar.gz |
2017-02-17 10:23:00
Diffstat (limited to 'tex/context/base/mkiv/font-web.lua')
-rw-r--r-- | tex/context/base/mkiv/font-web.lua | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/font-web.lua b/tex/context/base/mkiv/font-web.lua index 8ea57f301..452a8f59b 100644 --- a/tex/context/base/mkiv/font-web.lua +++ b/tex/context/base/mkiv/font-web.lua @@ -12,6 +12,9 @@ if not modules then modules = { } end modules ['font-otr'] = { -- and in a tex environment one can as well store the ttf/otf files in the tex tree. So, -- eventually we might even remove this code when version 1 is obsolete. +local ioopen = io.open +local replacesuffix = file.replacesuffix + local readers = fonts and fonts.handlers.otf.readers local streamreader = readers and readers.streamreader or utilities.files @@ -44,10 +47,22 @@ local infotags = { local report = logs.reporter("fonts","woff") +local runner = sandbox.registerrunner { + name = "woff2otf", + method = "execute", + program = "woff2_decompress", + template = "%inputfile% %outputfile%", + reporter = report, + checkers = { + inputfile = "readable", + outputfile = "writable", + } +} + local function woff2otf(inpname,outname,infoonly) - local outname = outname or file.replacesuffix(inpname,"otf") - local inp = io.open(inpname,"rb") + local outname = outname or replacesuffix(inpname,"otf") + local inp = ioopen(inpname,"rb") if not inp then report("invalid input file %a",inpname) @@ -73,7 +88,12 @@ local function woff2otf(inpname,outname,infoonly) if signature == "wOF2" then inp:close() if false then - os.execute("woff2_decompress " .. inpname .. " " .. outname) + if runner then + runner { + inputfile = inpname, + outputfile = outname, + } + end return outname, flavor else report("skipping version 2 file %a",inpname) @@ -81,7 +101,7 @@ local function woff2otf(inpname,outname,infoonly) end end - local out = io.open(outname,"wb") + local out = ioopen(outname,"wb") if not out then inp:close() |