From 79a75e8efc0d4df83f9ae73f7107e86d81147da9 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 23 Jun 2013 00:50:58 +0200 Subject: move db version check to load time --- luaotfload-database.lua | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index f374617..f8f9391 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -295,6 +295,17 @@ load_names = function (dry_run) "Font names database loaded", "%s", foundname) report("info", 3, "db", "Loading took %0.f ms", 1000*(os.gettimeofday()-starttime)) + + local db_version, nms_version = data.version, names.version + if db_version ~= nms_version then + report("log", 0, "db", + [[version mismatch; expected %4.3f, got %4.3f]], + nms_version, db_version) + if not fonts_reloaded then + report("log", 0, "db", [[force rebuild]]) + return update_names({ }, true, false) + end + end else report("both", 0, "db", [[Font names database not found, generating new one.]]) @@ -663,7 +674,7 @@ the font database created by the luaotfload-tool script. --- values. --- -resolve = function (_,_,specification) -- the 1st two parameters are used by ConTeXt +resolve = function (_, _, specification) -- the 1st two parameters are used by ConTeXt if not fonts_loaded then names.data = load_names() end local data = names.data @@ -691,18 +702,6 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con return specification.name, false, false end - local db_version, nms_version = data.version, names.version - if db_version ~= nms_version then - report("log", 0, "db", - [[version mismatch; expected %4.3f, got %4.3f]], - nms_version, db_version) - if not fonts_reloaded then - return reload_db("version mismatch", - resolve, nil, nil, specification) - end - return specification.name, false, false - end - if not data.mappings then if not fonts_reloaded then return reload_db("invalid database; missing font mapping", -- cgit v1.2.3