summaryrefslogtreecommitdiff
path: root/src/luaotfload-override.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-07-13 15:30:16 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-07-13 15:30:16 +0200
commit13dd80306495936deedf9ba81e44e7eb258098a4 (patch)
treefa315c4a27b4b42e4ba1769a0a5dec6d5cd288f6 /src/luaotfload-override.lua
parenta3cd328a3e0ef88b3ba3239664f53df70d1c7aef (diff)
parent8956e54b744091acabd83207c75826b0b1087c47 (diff)
downloadluaotfload-13dd80306495936deedf9ba81e44e7eb258098a4.tar.gz
Merge pull request #228 from phi-gamma/master
merge version 2.5 (texlive2014) into master
Diffstat (limited to 'src/luaotfload-override.lua')
-rw-r--r--src/luaotfload-override.lua52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/luaotfload-override.lua b/src/luaotfload-override.lua
new file mode 100644
index 0000000..b75530b
--- /dev/null
+++ b/src/luaotfload-override.lua
@@ -0,0 +1,52 @@
+if not modules then modules = { } end modules ["luaotfload-override"] = {
+ version = "2.5",
+ comment = "companion to Luaotfload",
+ author = "Khaled Hosny, Elie Roux, Philipp Gesang",
+ copyright = "Luaotfload Development Team",
+ license = "GNU GPL v2.0"
+}
+
+local findfile = resolvers.findfile
+local encodings = fonts.encodings
+
+local log = luaotfload.log
+local report = log.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]]--
+
+encodings.agl = { }
+
+setmetatable(fonts.encodings.agl, { __index = function (t, k)
+ if k ~= "unicodes" then
+ return nil
+ end
+ local glyphlist = findfile "luaotfload-glyphlist.lua"
+ if glyphlist then
+ report ("log", 1, "load", "loading the Adobe glyph list")
+ else
+ glyphlist = findfile "font-age.lua"
+ report ("both", 0, "load",
+ "loading the extended glyph list from ConTeXt")
+ end
+ local unicodes = dofile(glyphlist)
+ encodings.agl = { unicodes = unicodes }
+ return unicodes
+end })
+
+-- vim:tw=71:sw=4:ts=4:expandtab