diff options
| -rw-r--r-- | luaotfload-fonts.lua | 18 | ||||
| -rw-r--r-- | update-luatex-font-database.lua | 9 | 
2 files changed, 19 insertions, 8 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 diff --git a/update-luatex-font-database.lua b/update-luatex-font-database.lua index 9a870f5..d067c56 100644 --- a/update-luatex-font-database.lua +++ b/update-luatex-font-database.lua @@ -30,6 +30,7 @@ Rebuild the LuaTeX font database.  Valid options:    -d --dbdir DIRECTORY       writes the database in the specified directory +  -f --force                 force re-indexing all fonts    -q --quiet                 don't output anything    -v --verbose=LEVEL         be more verbose (print the searched directories)    -vv                        print the loaded fonts @@ -59,6 +60,7 @@ end  local long_opts = {      dbdir    = "d", +    force    = "f",      quiet    = "q",      verbose  = 1,      version  = "V", @@ -68,7 +70,7 @@ local long_opts = {      ['no-fc-cache'] = 0,  } -local short_opts = "d:qvVh" +local short_opts = "d:fqvVh"  -- Function running fc-cache if needed.  -- The argument is nil for default, 0 for no fc-cache and 1 for fc-cache. @@ -88,6 +90,7 @@ end  -- a temporary variable, containing the command line option concerning fc-cache  local run_fc_cache = nil +local force_reload = nil  local function process_cmdline()      local opts, optind, optarg = alt_getopt.get_ordered_opts (arg, short_opts, long_opts) @@ -109,6 +112,8 @@ local function process_cmdline()              os.exit(0)          elseif v == "d" then              luaotfload.fonts.directory = optarg [i] +        elseif v == "f" then +            force_reload = 1          elseif v == "fc-cache" then              run_fc_cache = 1          elseif v == "no-fc-cache" then @@ -125,4 +130,4 @@ end  process_cmdline()  do_run_fc_cache(run_fc_cache) -luaotfload.fonts.generate() +luaotfload.fonts.reload(force_reload)  | 
