summaryrefslogtreecommitdiff
path: root/mkluatexfontdb.lua
diff options
context:
space:
mode:
authoreroux <elie.roux@telecom-bretagne.eu>2010-03-01 11:21:17 +0100
committereroux <elie.roux@telecom-bretagne.eu>2010-03-01 11:21:17 +0100
commitbb568ecaa472c40c9276068c99dbcbb10d84c281 (patch)
tree7c4898e3199ef77766209275082f935e49e8b6c0 /mkluatexfontdb.lua
parentddc33bbbb9240422c28bb2ed917ed4f397d0521a (diff)
downloadluaotfload-bb568ecaa472c40c9276068c99dbcbb10d84c281.tar.gz
Changing the checksum system to a timestamp system
- the status is now externalized in another file name (in the same directory), so that it's not loaded when just asking for a font - the status is now filename->last-modification-timestamp so that we don't have to checksum the files (much faster)
Diffstat (limited to 'mkluatexfontdb.lua')
-rw-r--r--mkluatexfontdb.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/mkluatexfontdb.lua b/mkluatexfontdb.lua
index f05f668..7481252 100644
--- a/mkluatexfontdb.lua
+++ b/mkluatexfontdb.lua
@@ -146,6 +146,13 @@ end
process_cmdline()
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_file = mkluatexfontdb.directory .. '/' .. "otfl-names-status.lua"
+if lfs.isfile(status_file) then
+ status = dofile(status_file)
+end
local function generate(force)
log("generating font names database.")
@@ -166,12 +173,17 @@ local function generate(force)
end
fh:close()
local fontnames
- fontnames = dofile(kpse.find_file(names.basename))
- fontnames = names.update (fontnames, force)
- log("%s fonts in %s families saved in the database",
+ if kpse.find_file(names.basename) then
+ fontnames = dofile(kpse.find_file(names.basename))
+ else
+ fontnames = {}
+ end
+ fontnames = 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))
log("saved font names database in %s\n", savepath)
+ io.savedata(status_file, table.serialize(status, true))
end
generate(force_reload)