summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkluatexfontdb.lua11
-rw-r--r--otfl-font-dum.lua21
2 files changed, 17 insertions, 15 deletions
diff --git a/mkluatexfontdb.lua b/mkluatexfontdb.lua
index 66fc231..a34b81e 100644
--- a/mkluatexfontdb.lua
+++ b/mkluatexfontdb.lua
@@ -31,7 +31,7 @@ names.version = names.version or 2.004
-- the path to add to TEXMFVAR or TEXMFSYSVAR to get the final directory in
-- normal cases
-mkluatexfontdb.subtexmfvardir = "/tex/"
+mkluatexfontdb.subtexmfvardir = "/scripts/luatexfontdb/"
-- the directory in which the database will be saved, can be overwritten
mkluatexfontdb.directory = kpse.expand_var("$TEXMFVAR") .. mkluatexfontdb.subtexmfvardir
@@ -57,7 +57,8 @@ Valid options:
--sys writes the database for the whole system
(default is only for the user)
-The output database file is named otfl-fonts.lua.
+The output database file is named otfl-fonts.lua. By default it is placed
+in TEXMFVAR/scripts/luatexfontdb/.
]], name))
end
@@ -149,8 +150,8 @@ 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 = nil
-local status_file = mkluatexfontdb.directory .. '/' .. "otfl-names-status.lua"
-if lfs.isfile(status_file) then
+local status_file = mkluatexfontdb.directory .. "/otfl-names-status.lua"
+if file.isreadable(status_file) then
status = dofile(status_file)
end
@@ -159,7 +160,7 @@ local function generate(force)
local savepath = mkluatexfontdb.directory
if not lfs.isdir(savepath) then
log("creating directory %s", savepath)
- lfs.mkdir(savepath)
+ dir.mkdirs(savepath)
if not lfs.isdir(savepath) then
texio.write_nl(string.format("Error: cannot create directory '%s', exiting.\n", savepath))
os.exit(1)
diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua
index 0b2e911..0c76736 100644
--- a/otfl-font-dum.lua
+++ b/otfl-font-dum.lua
@@ -48,8 +48,9 @@ end
fonts.names = fonts.names or { }
-fonts.names.version = 2.004 -- not the same as in context
-fonts.names.basename = "otfl-names.lua"
+fonts.names.version = 2.004 -- not the same as in context
+fonts.names.basename = "otfl-names.lua"
+fonts.names.subtexmfvardir = "/scripts/luatexfontdb/"
fonts.names.new_to_old = { }
fonts.names.old_to_new = { }
@@ -69,14 +70,14 @@ function fonts.names.resolve(specification)
local name, style = specification.name, specification.style or "regular"
if not loaded then
local basename = fonts.names.basename
- if basename and basename ~= "" then
- for _, format in ipairs { "lua", "tex", "other text files" } do
- local foundname = resolvers.find_file(basename,format) or ""
- if foundname ~= "" then
- data = dofile(foundname)
- logs.report("load font", "loaded font names database: %s", foundname)
- break
- end
+ if basename and basename ~= "" and fonts.names.subtexmfvardir then
+ local foundname = kpse.expand_var("$TEXMFVAR") .. fonts.names.subtexmfvardir .. basename
+ if not file.isreadable(foundname) then
+ foundname = kpse.expand_var("$TEXMFSYSVAR") .. fonts.names.subtexmfvardir .. basename
+ end
+ if file.isreadable(foundname) then
+ data = dofile(foundname)
+ logs.report("load font", "loaded font names database: %s", foundname)
end
end
loaded = true