diff options
author | Marius <mariausol@gmail.com> | 2011-06-16 14:00:12 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-06-16 14:00:12 +0300 |
commit | f7430075a5d36ba3731ab77b157f6df498ef17e8 (patch) | |
tree | b216d0792a61bd41fe0d4e4c86cb6595f2d5dfa7 /scripts | |
parent | ca80244b2a175882b1667a50bb5d2be2ca9ef818 (diff) | |
download | context-f7430075a5d36ba3731ab77b157f6df498ef17e8.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 |