summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreroux <elie.roux@telecom-bretagne.eu>2010-03-01 11:48:31 +0100
committereroux <elie.roux@telecom-bretagne.eu>2010-03-01 11:48:31 +0100
commit8e504aea583057b70c34e71cd24af1f8cc648fa1 (patch)
tree57e6e4e5416b8188cae3245b3111d90bd4f1a38c
parentbb568ecaa472c40c9276068c99dbcbb10d84c281 (diff)
downloadluaotfload-8e504aea583057b70c34e71cd24af1f8cc648fa1.tar.gz
Now having version in status table too
Also stronger checks on status
-rw-r--r--mkluatexfontdb.lua4
-rw-r--r--otfl-font-nms.lua14
2 files changed, 13 insertions, 5 deletions
diff --git a/mkluatexfontdb.lua b/mkluatexfontdb.lua
index 7481252..66fc231 100644
--- a/mkluatexfontdb.lua
+++ b/mkluatexfontdb.lua
@@ -148,7 +148,7 @@ do_run_fc_cache(run_fc_cache)
-- the status table is containing correspondances between absolute path and last modification
-- timestamp, it's uses to save time during update, by not reparsing unchanged fonts.
-local status = {}
+local status = nil
local status_file = mkluatexfontdb.directory .. '/' .. "otfl-names-status.lua"
if lfs.isfile(status_file) then
status = dofile(status_file)
@@ -178,7 +178,7 @@ local function generate(force)
else
fontnames = {}
end
- fontnames = names.update(fontnames, force, status)
+ fontnames, status = names.update(fontnames, force, status)
log("%s fonts in %s families in the database",
#fontnames.mappings, #table.keys(fontnames.families))
io.savedata(savepath, table.serialize(fontnames, true))
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index e9b0d4e..15466a1 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -312,6 +312,12 @@ local function fontnames_init()
}
end
+local function status_init()
+ return {
+ version = names.version,
+ }
+end
+
-- The main function, scans everything
-- - fontnames is the final table to return
-- - force is whether we rebuild it from scratch or not
@@ -319,10 +325,12 @@ end
local function update(fontnames, force, status)
if force then
fontnames = fontnames_init()
+ status = status_init()
else
- if fontnames and fontnames.version and fontnames.version == names.version then
- else
+ if not fontnames or not fontnames.version or fontnames.version ~= names.version
+ or not status or not status.version or status.version ~= names.version then
fontnames = fontnames_init()
+ status = status_init()
if trace_search then
logs.report("no font names database or old one found, generating new one")
end
@@ -330,7 +338,7 @@ local function update(fontnames, force, status)
end
fontnames = scan_texmf_tree(fontnames, status)
fontnames = scan_os_fonts (fontnames, status)
- return fontnames
+ return fontnames, status
end
names.scan = scan_dir