diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-08 03:41:19 -0700 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-08 03:41:19 -0700 |
commit | ae8ffd0615b797d91cd8799debf12e2891c5b0d2 (patch) | |
tree | ef50e53bfc9aa3bb04eff5c63cd7ad57bb7bfe99 /luaotfload-override.lua | |
parent | bfe128deb88ae00efa37d4ebffc70b4bf8bf8a33 (diff) | |
parent | 9c8b4e0d6b2ca6557b490513a4d90182df12d16d (diff) | |
download | luaotfload-ae8ffd0615b797d91cd8799debf12e2891c5b0d2.tar.gz |
Merge pull request #50 from phi-gamma/master
``font-age.lua`` -> ``luaotfload-glyphlist.lua``
also address issue #51
Diffstat (limited to 'luaotfload-override.lua')
-rw-r--r-- | luaotfload-override.lua | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/luaotfload-override.lua b/luaotfload-override.lua index 863187f..c047dad 100644 --- a/luaotfload-override.lua +++ b/luaotfload-override.lua @@ -63,7 +63,7 @@ end local level_ids = { common = 0, loading = 1, search = 2 } -logs.names_report = function (mode, lvl, ...) +local names_report = function (mode, lvl, ...) if type(lvl) == "string" then lvl = level_ids[lvl] end @@ -81,4 +81,52 @@ logs.names_report = function (mode, lvl, ...) end end +logs.names_report = names_report + +--[[doc-- + + Adobe Glyph List. + ------------------------------------------------------------------- + + Context provides a somewhat different font-age.lua from an unclear + origin. Unfortunately, the file name it reads from is hard-coded + in font-enc.lua, so we have to replace the entire table. + + This shouldn’t cause any complications. Due to its implementation + the glyph list will be loaded upon loading a OTF or TTF for the + first time during a TeX run. (If one sticks to TFM/OFM then it is + never read at all.) For this reason we can install a metatable that + looks up the file of our choosing and only falls back to the + Context one in case it cannot be found. + +--doc]]-- + +if next(fonts.encodings.agl) then + print(next, fonts.encodings.agl) + --- unnecessary because the file shouldn’t be loaded at this time + --- but we’re just making sure + fonts.encodings.agl = nil + collectgarbage"collect" +end + + +fonts.encodings.agl = { } + +setmetatable(fonts.encodings.agl, { __index = function (t, k) + if k == "unicodes" then + local glyphlist = resolvers.findfile"luaotfload-glyphlist.lua" + if glyphlist then + names_report("both", 0, "load", "loading the Adobe glyph list") + else + glyphlist = resolvers.findfile"font-age.lua" + names_report("both", 0, "load", "loading the extended glyph list from ConTeXt") + end + local unicodes = dofile(glyphlist) + fonts.encodings.agl = { unicodes = unicodes } + return unicodes + else + return nil + end +end }) + -- vim:tw=71:sw=4:ts=4:expandtab |