From 19bc52023e3c345855c41ba36911143ed094bf1a Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 12 May 2016 22:57:50 +0200 Subject: [features,loaders] tidy up loading of afm --- src/luaotfload-loaders.lua | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/luaotfload-loaders.lua') diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index f6cb272..0a0185b 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -49,12 +49,19 @@ local unsupported_reader = function (format) end end -local afm_compat_message = function (specification, method) +local afm_reader = fonts.readers.afm + +local afm_compat_message = function (specification) + local name = specification.name + local filename = specification.filename logreport ("both", 4, "loaders", "PFB format only supported with matching \z - AFM; redirecting (“%s”, “%s”).", - tostring (specification.name), tostring (method)) - return fonts.readers.afm (specification, method) + AFM; redirecting (“%s”, “afm”).", + tostring (specification.name)) + specification.forced = "afm" + specification.forcedname = filename + specification.filename = file.replacesuffix (filename, "afm") + return afm_reader (specification, "afm") end local install_formats = function () @@ -89,6 +96,7 @@ local install_formats = function () return aux ("evl", eval_reader) and aux ("lua", lua_reader) and aux ("pfa", unsupported_reader "pfa") + and aux ("afm", function (spec) return afm_reader (spec, "afm") end) and aux ("pfb", afm_compat_message) --- pfb loader is incomplete and aux ("ofm", readers.tfm) and aux ("dfont", unsupported_reader "dfont") -- cgit v1.2.3 From 934edcaba82997bd64bfe5dd3a08e07c59056ba1 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 13 May 2016 00:03:29 +0200 Subject: [loaders] make AFM wrappers more consistent --- src/luaotfload-loaders.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/luaotfload-loaders.lua') diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index 0a0185b..e5298b2 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -51,19 +51,23 @@ end local afm_reader = fonts.readers.afm -local afm_compat_message = function (specification) +local afm_loader = function (specification) local name = specification.name local filename = specification.filename - logreport ("both", 4, "loaders", - "PFB format only supported with matching \z - AFM; redirecting (“%s”, “afm”).", - tostring (specification.name)) specification.forced = "afm" specification.forcedname = filename specification.filename = file.replacesuffix (filename, "afm") return afm_reader (specification, "afm") end +local afm_compat_message = function (specification) + logreport ("both", 4, "loaders", + "PFB format only supported with matching \z + AFM; redirecting (“%s”, “afm”).", + tostring (specification.name)) + return afm_loader (specification) +end + local install_formats = function () local fonts = fonts if not fonts then return false end @@ -71,9 +75,8 @@ local install_formats = function () local readers = fonts.readers local sequence = readers.sequence local seqset = table.tohash (sequence) - local handlers = fonts.handlers local formats = fonts.formats - if not readers or not handlers or not formats then return false end + if not readers or not formats then return false end local aux = function (which, reader) if not which or type (which) ~= "string" @@ -83,7 +86,6 @@ local install_formats = function () end formats [which] = "type1" readers [which] = reader - handlers [which] = { } if not seqset [which] then logreport ("both", 3, "loaders", "Extending reader sequence for “%s”.", which) @@ -96,7 +98,7 @@ local install_formats = function () return aux ("evl", eval_reader) and aux ("lua", lua_reader) and aux ("pfa", unsupported_reader "pfa") - and aux ("afm", function (spec) return afm_reader (spec, "afm") end) + and aux ("afm", afm_loader) and aux ("pfb", afm_compat_message) --- pfb loader is incomplete and aux ("ofm", readers.tfm) and aux ("dfont", unsupported_reader "dfont") -- cgit v1.2.3 From 563c3df1e1690132b1bf76fad59bd157254c53b1 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 13 May 2016 07:20:44 +0200 Subject: [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. --- src/luaotfload-loaders.lua | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/luaotfload-loaders.lua') 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 -- cgit v1.2.3 From e7b0a9520127d4b143ceaa1240bd199219f341e8 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 18 May 2016 07:51:00 +0200 Subject: [featurs,loaders] adjust loader specifications to Context conventions --- src/luaotfload-loaders.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/luaotfload-loaders.lua') diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index c21c9eb..fd3e711 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -52,12 +52,9 @@ end local afm_reader = fonts.readers.afm local afm_loader = function (specification) - local name = specification.name - local filename = specification.filename - specification.forced = "afm" - specification.forcedname = filename - specification.filename = file.replacesuffix (filename, "afm") - return afm_reader (specification, "afm") + specification.forced = "afm" + specification.sub = false + return afm_reader (specification) end local afm_compat_message = function (specification) -- cgit v1.2.3 From 72f10523323c3e5183f91931db56dcf38f92b68d Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Thu, 19 May 2016 08:25:34 +0200 Subject: [fontloader] include font-one.lua --- src/luaotfload-loaders.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/luaotfload-loaders.lua') diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index fd3e711..68cc50f 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -52,9 +52,11 @@ end local afm_reader = fonts.readers.afm local afm_loader = function (specification) - specification.forced = "afm" - specification.sub = false - return afm_reader (specification) + specification.forced = "afm" + specification.sub = false + specification.forcedname = file.addsuffix(specification.name, "afm") + inspect(specification) + return afm_reader (specification, "afm") end local afm_compat_message = function (specification) -- cgit v1.2.3