diff options
author | eroux <elie.roux@telecom-bretagne.eu> | 2010-02-26 10:40:59 +0100 |
---|---|---|
committer | eroux <elie.roux@telecom-bretagne.eu> | 2010-02-26 10:40:59 +0100 |
commit | 87fbf8b2a8f9c82bb9008a3c77330718177142a2 (patch) | |
tree | c6ab62aa13edae9ca84cf377354b575f937d7e56 | |
parent | 265b0fbc7342295e3596253c3b3d0282797bea0e (diff) | |
download | luaotfload-87fbf8b2a8f9c82bb9008a3c77330718177142a2.tar.gz |
Executing fc-cache if necessary (to be tested further)
-rw-r--r-- | update-luatex-font-database.lua | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/update-luatex-font-database.lua b/update-luatex-font-database.lua index 2ba4849..6b68e68 100644 --- a/update-luatex-font-database.lua +++ b/update-luatex-font-database.lua @@ -36,6 +36,9 @@ Valid options: -vvv print all steps of directory searching -V --version prints the version and exits -h --help prints this message + --fc-cache run fc-cache before updating database + (default is to run it if available) + --no-fc-cache do not run fc-cache --sys writes the database for the whole system (default is only for the user) @@ -55,20 +58,40 @@ end ]] local long_opts = { - dbdir = "d", - quiet = "q", - verbose = 1, - version = "V", - help = "h", - sys = 0, + dbdir = "d", + quiet = "q", + verbose = 1, + version = "V", + help = "h", + sys = 0, + ['fc-cache'] = 0, + ['no-fc-cache'] = 0, } local short_opts = "d:qvVh" -local log_level = 1 +-- Function running fc-cache if needed. +-- The argument is nil for default, 0 for no fc-cache and 1 for fc-cache. +-- Default behaviour is to run fc-cache if available. +local function do_run_fc_cache(c) + if c == 0 then return end + if not c then + -- TODO: detect if fc-cache is available + end + local toexec = 'fc-cache' + if system == 'windows' then + toexec = 'fc-cache.exe' -- TODO: to test on a non-cygwin Windows + end + luaotfload.fonts.log(1, 'Executing %s...\n', toexec) + os.execute(toexec) +end + +-- a temporary variable, containing the command line option concerning fc-cache +local run_fc_cache = nil local function process_cmdline() local opts, optind, optarg = alt_getopt.get_ordered_opts (arg, short_opts, long_opts) + local log_level = 1 for i,v in ipairs(opts) do if v == "q" then log_level = 0 @@ -86,6 +109,10 @@ local function process_cmdline() os.exit(0) elseif v == "d" then luaotfload.fonts.directory = optarg [i] + elseif v == "fc-cache" then + run_fc_cache = 1 + elseif v == "no-fc-cache" then + run_fc_cache = 0 elseif v == "sys" then luaotfload.fonts.directory = kpse.expand_var("$TEXMFSYSVAR") .. "/tex/" end @@ -94,4 +121,5 @@ local function process_cmdline() end process_cmdline() +do_run_fc_cache(run_fc_cache) luaotfload.fonts.generate() |