diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-06-12 18:43:11 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-06-12 18:43:11 +0200 |
commit | e32722cb62bfe37116d3d97659040463bc381719 (patch) | |
tree | 936fd21f63dab30e4a895da8e85d633997780084 | |
parent | 04f559ba1bc2caa232eded21d500d070142bfa1f (diff) | |
download | luaotfload-e32722cb62bfe37116d3d97659040463bc381719.tar.gz |
[db] adapt error handling to new fontloader conventions
-rw-r--r-- | src/luaotfload-database.lua | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index b017340..7495ff2 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -1298,23 +1298,29 @@ find_closest = function (name, limit) return false end --- find_closest() +--- string -> uint -> bool * (string | rawdata) local read_font_file = function (filename, subfont) - return otfhandler.readers.getinfo (filename, - { subfont = subfont - , details = false - , platformnames = true - , rawfamilynames = true - }) + local fontdata = otfhandler.readers.getinfo (filename, + { subfont = subfont + , details = false + , platformnames = true + , rawfamilynames = true + }) + local msg = fontdata.comment + if msg then + return false, msg + end + return true, fontdata end local load_font_file = function (filename, subfont) - local rawfont, _msg = read_font_file (filename, subfont) - - if not rawfont then - logreport ("log", 1, "db", "ERROR: failed to open %s.", filename) + local err, ret = read_font_file (filename, subfont) + if err == false then + logreport ("both", 1, "db", "ERROR: failed to open %q: %q.", + tostring (filename), tostring (ret)) return end - return rawfont + return ret end --- rawdata -> (int * int * int | bool) @@ -1773,11 +1779,12 @@ local read_font_names = function (fullname, --- 4) get basic info, abort if fontloader can’t read it - local info = read_font_file (fullname) + local err, info = read_font_file (fullname) - if not info then + if err == false then logreport ("log", 1, "db", - "Failed to read basic information from %q", basename) + "Failed to read basic information from %q: %q", + basename, tostring (info)) return false end |