diff options
author | Hans Hagen <pragma@wxs.nl> | 2011-02-08 17:08:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2011-02-08 17:08:00 +0100 |
commit | 94397b74482b88818f737145af99c883802210d7 (patch) | |
tree | 8321335e88f65a31a69e049dbd905a3997a671f9 /tex/context/base/font-lua.lua | |
parent | 13fe57ae547e79f911229fe4586591f7a8439c69 (diff) | |
download | context-94397b74482b88818f737145af99c883802210d7.tar.gz |
beta 2011.02.08 17:08
Diffstat (limited to 'tex/context/base/font-lua.lua')
-rw-r--r-- | tex/context/base/font-lua.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tex/context/base/font-lua.lua b/tex/context/base/font-lua.lua new file mode 100644 index 000000000..fe07dd38b --- /dev/null +++ b/tex/context/base/font-lua.lua @@ -0,0 +1,45 @@ +if not modules then modules = { } end modules ['font-lua'] = { + version = 1.001, + comment = "companion to font-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end) + +local report_lua = logs.new("fonts","lua loading") + +fonts.formats.lua = "lua" + +local readers = fonts.tfm.readers + +local function check_lua(specification,fullname) + -- standard tex file lookup + local fullname = resolvers.findfile(fullname) or "" + if fullname ~= "" then + local loader = loadfile(fullname) + loader = loader and loader() + return loader and loader(specification) + end +end + +function readers.lua(specification) + local original = specification.specification + if trace_defining then + report_lua("using lua reader for '%s'",original) + end + local fullname, tfmtable = specification.filename or "", nil + if fullname == "" then + local forced = specification.forced or "" + if forced ~= "" then + tfmtable = check_lua(specification,specification.name .. "." .. forced) + end + if not tfmtable then + tfmtable = check_lua(specification,specification.name) + end + else + tfmtable = check_lua(specification,fullname) + end + return tfmtable +end |