diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-05-13 07:20:44 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-05-13 07:25:06 +0200 |
commit | 563c3df1e1690132b1bf76fad59bd157254c53b1 (patch) | |
tree | 61986091785611da45efd18ca7ba1e9480256709 | |
parent | 934edcaba82997bd64bfe5dd3a08e07c59056ba1 (diff) | |
download | luaotfload-563c3df1e1690132b1bf76fad59bd157254c53b1.tar.gz |
[loaders] implement readable load failure message
Add a message that includes the information relevant for
troubleshooting.
Due to the spammy nature of the message printed by Fontspec this is not
exactly useful with Latex so disabled by default for now.
-rw-r--r-- | src/luaotfload-loaders.lua | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index e5298b2..c21c9eb 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -104,6 +104,22 @@ local install_formats = function () and aux ("dfont", unsupported_reader "dfont") end +local not_found_msg = function (specification, size, id) + logreport ("both", 0, "loaders", "") + logreport ("both", 0, "loaders", + "--------------------------------------------------------") + logreport ("both", 0, "loaders", "") + logreport ("both", 0, "loaders", "Font definition failed for:") + logreport ("both", 0, "loaders", "") + logreport ("both", 0, "loaders", " > id : %d", id) + logreport ("both", 0, "loaders", " > specification : %q", specification) + if size > 0 then + logreport ("both", 0, "loaders", " > size : %.2f pt", size / 2^16) + end + logreport ("both", 0, "loaders", "") + logreport ("both", 0, "loaders", + "--------------------------------------------------------") +end --[[doc-- \subsection{\CONTEXT override} @@ -120,6 +136,7 @@ do local patch = function (specification, size, id) local fontdata = read (specification, size, id) +----if not fontdata then not_found_msg (specification, size, id) end if type (fontdata) == "table" and fontdata.shared then --- We need to test for the “shared” field here --- or else the fontspec capheight callback will @@ -139,10 +156,8 @@ do logreport ("both", 0, "loaders", " > spec %q", specification) logreport ("both", 0, "loaders", " > at size %.2f pt", size / 2^16) local result = definer (specification, size, id) - if not result then - logreport ("both", 0, "loaders", " > font definition failed") - return - elseif type (result) == "number" then + if not result then return not_found_msg (specification, size, id) end + if type (result) == "number" then logreport ("both", 0, "loaders", " > font definition yielded id %d", result) return result end |