summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2015-07-16 08:29:33 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2015-07-16 08:31:28 +0200
commit5718f3e6d5580270a8c7c4943933ad5d26ba43ec (patch)
tree49d51df6b2cfe141cb74bd819575d89c3f394e2a /src
parent28c4d1840be50e186ddeae4adc510233c2837042 (diff)
downloadluaotfload-5718f3e6d5580270a8c7c4943933ad5d26ba43ec.tar.gz
[init,override] move AGL initialization into post fontloader hook
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-init.lua68
-rw-r--r--src/luaotfload-main.lua4
-rw-r--r--src/luaotfload-override.lua52
3 files changed, 69 insertions, 55 deletions
diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua
index 170cbad..5c237e7 100644
--- a/src/luaotfload-init.lua
+++ b/src/luaotfload-init.lua
@@ -315,9 +315,77 @@ local init_post_install_callbacks = function ()
1)
end
+local init_post_load_agl = function ()
+
+ --[[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]]--
+
+ local findfile = resolvers.findfile
+ local encodings = fonts.encodings
+
+ if not findfile or not encodings then
+ --- Might happen during refactoring; we continue graciously but in
+ --- a somewhat defect state.
+ logreport ("log", 0, "init",
+ "preconditions unmet, skipping the Adobe Glyph List; "
+ .. "this is a Luaotfload bug.")
+ return
+ end
+
+ local agl_init = { } --- start out empty, fill on demand
+ encodings.agl = agl_init --- ugh, replaced again later
+
+ setmetatable (agl_init, { __index = function (t, k)
+
+ if k ~= "unicodes" then
+ return nil
+ end
+
+ local glyphlist = findfile "luaotfload-glyphlist.lua"
+ if glyphlist then
+ logreport ("log", 1, "init", "loading the Adobe glyph list")
+ else
+ glyphlist = findfile "font-age.lua"
+ logreport ("both", 0, "init",
+ "loading the extended glyph list from ConTeXt")
+ end
+
+ if not glyphlist then
+ logreport ("both", 4, "init",
+ "Adobe glyph list not found, please check your installation.")
+ return nil
+ end
+ logreport ("both", 4, "init",
+ "found Adobe glyph list file at ``%s``, using that.",
+ glyphlist)
+
+ local unicodes = dofile(glyphlist)
+ encodings.agl = { unicodes = unicodes }
+ return unicodes
+ end })
+
+end
+
--- (unit -> unit) list
local init_post_actions = {
init_post_install_callbacks,
+ init_post_load_agl,
}
--- unit -> size_t
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index e8f05d6..7dd0b6e 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------
-- FILE: luaotfload-main.lua
--- DESCRIPTION: Luaotfload initialization
+-- DESCRIPTION: Luaotfload entry point
-- REQUIREMENTS: luatex v.0.80 or later; packages lualibs, luatexbase
-- AUTHOR: Élie Roux, Khaled Hosny, Philipp Gesang
-- VERSION: same as Luaotfload
@@ -160,8 +160,6 @@ luaotfload.init.init ()
local log = luaotfload.log
local logreport = log.report
-load_luaotfload_module "override" --- load glyphlist on demand
-
--[[doc--
Now we load the modules written for \identifier{luaotfload}.
diff --git a/src/luaotfload-override.lua b/src/luaotfload-override.lua
deleted file mode 100644
index b75530b..0000000
--- a/src/luaotfload-override.lua
+++ /dev/null
@@ -1,52 +0,0 @@
-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