summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-06-23 00:50:58 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-06-23 00:50:58 +0200
commit79a75e8efc0d4df83f9ae73f7107e86d81147da9 (patch)
treeb45302113ab067c65aa75355bf293e772cf5ffa2
parent310fa29531fd6003ed840165b8041105827040cb (diff)
downloadluaotfload-79a75e8efc0d4df83f9ae73f7107e86d81147da9.tar.gz
move db version check to load time
-rw-r--r--luaotfload-database.lua25
1 files 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",