diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-06-16 12:50:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-06-16 12:50:00 +0200 |
commit | c768d04a83193229af281526797c8fc4e64d589f (patch) | |
tree | 599bb1fdf466b5a9de7181a0758608e8ad164824 /scripts | |
parent | 084756f44fc08cb9a1803a31e34a31f584fd19f9 (diff) | |
download | context-c768d04a83193229af281526797c8fc4e64d589f.tar.gz |
beta 2011.06.16 12:50
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-fonts.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 8c8f47a70..90fa1b03e 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -334,6 +334,23 @@ function scripts.fonts.list() end +function scripts.fonts.unpack() + local name = file.removesuffix(file.basename(environment.files[1] or "")) + if name and name ~= "" then + local cache = containers.define("fonts", "otf", 2.730, true) + local cleanname = containers.cleanname(name) + local data = containers.read(cache,cleanname) + if data then + local savename = file.addsuffix(cleanname .. "-unpacked","tma") + report("fontsave, saving data in %s",savename) + fonts.handlers.otf.enhancers.unpack(data) + io.savedata(savename,table.serialize(data,true)) + else + report("unknown file '%s'",name) + end + end +end + function scripts.fonts.save() local name = environment.files[1] or "" local sub = environment.files[2] or "" @@ -387,6 +404,8 @@ elseif environment.argument("reload") then scripts.fonts.reload() elseif environment.argument("save") then scripts.fonts.save() +elseif environment.argument("unpack") then + scripts.fonts.unpack() elseif environment.argument("statistics") then fonts.names.statistics() else |