summaryrefslogtreecommitdiff
path: root/luaotfload-fonts.lua
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-02-26 15:24:43 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-02-26 15:24:43 +0200
commit0b99d9ec4dd253721ca4dc29af6d95a65975da56 (patch)
tree80c22b38ea41cbb716cca24f9849204c354f0e4a /luaotfload-fonts.lua
parentfe0fde65f066d5e9a107a26eaec8fdbfe195f92e (diff)
downloadluaotfload-0b99d9ec4dd253721ca4dc29af6d95a65975da56.tar.gz
Implement a --force option
Diffstat (limited to 'luaotfload-fonts.lua')
-rw-r--r--luaotfload-fonts.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua
index cca4f28..9a59681 100644
--- a/luaotfload-fonts.lua
+++ b/luaotfload-fonts.lua
@@ -331,12 +331,18 @@ local function fontnames_init()
end
-- The main function, scans everything and writes the file.
-local function generate()
+local function reload(force)
texio.write("luaotfload | Generating font names database.")
- local fnames = kpse.do_file(luaotfload.fonts.basename) or fontnames_init()
- if fnames.version ~= luaotfload.fonts.version then
- log(2, "Old font names database version, generating new one")
+ local fnames
+ if force then
fnames = fontnames_init()
+ else
+ fnames = kpse.do_file(luaotfload.fonts.basename)
+ if fnames and fnames.version and fnames.version == luaotfload.fonts.version then
+ else
+ log(2, "Old font names database version, generating new one")
+ fnames = fontnames_init()
+ end
end
local savepath = luaotfload.fonts.directory
savepath = path_normalize(savepath)
@@ -365,5 +371,5 @@ local function generate()
log(1, "Saved font names database in %s\n", savepath)
end
-luaotfload.fonts.scan = scan_dir
-luaotfload.fonts.generate = generate
+luaotfload.fonts.scan = scan_dir
+luaotfload.fonts.reload = reload