diff options
author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2010-02-25 20:55:05 +0200 |
---|---|---|
committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2010-02-25 20:55:05 +0200 |
commit | b35abcf3c0caa9f8d098e635fbaf1f70b36d1b92 (patch) | |
tree | 371462c198a9e367b2936f6f8baf625a946d520f | |
parent | 8dddcfbffc28c3405c5ca957d6f5a1d3903222fe (diff) | |
download | luaotfload-b35abcf3c0caa9f8d098e635fbaf1f70b36d1b92.tar.gz |
Making the final directory changeable
Useful for the --sys option
-rw-r--r-- | luaotfload-fonts.lua | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua index 353f9b3..f8fdb9e 100644 --- a/luaotfload-fonts.lua +++ b/luaotfload-fonts.lua @@ -4,7 +4,6 @@ -- It is part of the luaotfload bundle, see luaotfload's README for legal -- notice. - -- some usual initializations luaotfload = luaotfload or { } luaotfload.fonts = { } @@ -21,13 +20,24 @@ luaotfload.fonts.module = { kpse.set_program_name("luatex") -dofile(kpse.find_file("luaextra.lua")) +local luaextra_file = kpse.find_file("luaextra.lua") +if not luaextra_file then + texio.write_nl("Error: cannot find 'luaextra.lua', exiting.") + os.exit(1) +end +dofile(luaextra_file) local splitpath, expandpath, glob, basename = file.split_path, kpse.expand_path, dir.glob, file.basename local upper, format, rep = string.upper, string.format, string.rep --- the final name of the font database +-- the file name of the font database luaotfload.fonts.basename = "otfl-names.lua" + +-- the directory in which the database will be saved, can be overwritten +luaotfload.fonts.directory = kpse.expand_var("$TEXMFVAR") .. "/tex/" + +-- the version of the database, to be checked by the lookup function of +-- luaotfload luaotfload.fonts.version = 2.002 -- Log facilities: @@ -297,13 +307,12 @@ local function generate() families = { }, version = luaotfload.fonts.version, } - local savepath -- we save the scanned fonts in a variable in order for scan_os_fonts not -- to rescan them local scanned_fonts = scan_texmf_tree(fnames) scan_os_fonts (fnames, scanned_fonts) log(1, "%s fonts in %s families saved in the database", #fnames.mappings, #table.keys(fnames.families)) - savepath = kpse.expand_var("$TEXMFVAR") .. "/tex/" + local savepath = luaotfload.fonts.directory if not file.isreadable(savepath) then log(1, "Creating directory %s", savepath) lfs.mkdir(savepath) |