From c7d9945cbece75331c9342ce0a8eaa9c37a0a06b Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 27 May 2013 22:15:06 +0200 Subject: add option prefer-texmf to luaotfload-tool --- luaotfload-database.lua | 20 ++++++++------------ luaotfload-tool.lua | 6 +++++- luaotfload-tool.rst | 7 +++++-- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 3a0d61e..e7d4bf9 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -941,7 +941,7 @@ local load_font = function (fullname, fontnames, newfontnames, texmf) end local newmappings = newfontnames.mappings - local newstatus = newfontnames.status + local newstatus = newfontnames.status --- by full path local mappings = fontnames.mappings local status = fontnames.status @@ -962,28 +962,26 @@ local load_font = function (fullname, fontnames, newfontnames, texmf) end local new_timestamp, current_timestamp - current_timestamp = status[entryname] - and status[entryname].timestamp + current_timestamp = status[fullname] + and status[fullname].timestamp new_timestamp = lfsattributes(fullname, "modification") - local newentrystatus = newstatus[entryname] + local newentrystatus = newstatus[fullname] --- newentrystatus: nil | false | table if newentrystatus and newentrystatus.timestamp == new_timestamp then -- already indexed this run return false end - newstatus[entryname] = newentrystatus or { } - local newentrystatus = newstatus[entryname] + newstatus[fullname] = newentrystatus or { } + local newentrystatus = newstatus[fullname] newentrystatus.timestamp = new_timestamp newentrystatus.index = newentrystatus.index or { } - --- this test compares the modification date registered - --- in the database with the current one if current_timestamp == new_timestamp and not newentrystatus.index[1] then - for _, v in next, status[entryname].index do + for _, v in next, status[fullname].index do local index = #newentrystatus.index local fullinfo = mappings[v] local location = #newmappings + 1 @@ -1002,7 +1000,6 @@ local load_font = function (fullname, fontnames, newfontnames, texmf) if not fullinfo then return false end - fullinfo.texmf = texmf --- flag for resolver local location = #newmappings+1 local index = newentrystatus.index[n_font] if not index then index = location end @@ -1127,7 +1124,7 @@ end --doc]]-- ---- string -> dbobj -> dbobj -> bool -> (int * int) +--- string -> dbobj -> dbobj -> bool -> bool -> (int * int) local scan_dir = function (dirname, fontnames, newfontnames, dry_run, texmf) local n_scanned, n_new = 0, 0 --- total of fonts collected report("both", 2, "db", "scanning directory %s", dirname) @@ -1463,7 +1460,6 @@ end --- dbobj -> dbobj local gen_fast_lookups = function (fontnames) report("both", 2, "db", "creating filename map") - local texmf_wins = config.luaotfload.texmf_wins local mappings = fontnames.mappings local nmappings = #mappings --- this is needlessly complicated due to texmf priorization diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index 721e3cf..9479180 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -172,6 +172,7 @@ This tool is part of the luaotfload package. Valid options are: -f --force force re-indexing all fonts -l --flush-lookups empty lookup cache of font requests -D --dry-run skip loading of fonts, just scan + -p --prefer-texmf prefer fonts in the TEXMF over system fonts --find="font name" query the database for a font name -F --fuzzy look for approximate matches if --find fails @@ -562,13 +563,14 @@ local process_cmdline = function ( ) -- unit -> jobspec limit = 1, list = 1, log = 1, + ["prefer-texmf"] = "p", quiet = "q", update = "u", verbose = 1 , version = "V", } - local short_options = "DfFilquvVh" + local short_options = "DfFilpquvVh" local options, _, optarg = alt_getopt.get_ordered_opts (arg, short_options, long_options) @@ -629,6 +631,8 @@ local process_cmdline = function ( ) -- unit -> jobspec result.cache = optarg[n] elseif v == "D" then result.dry_run = true + elseif v == "p" then + config.luaotfload.prioritize = "texmf" end end diff --git a/luaotfload-tool.rst b/luaotfload-tool.rst index 9ea267b..a428375 100644 --- a/luaotfload-tool.rst +++ b/luaotfload-tool.rst @@ -15,9 +15,9 @@ SYNOPSIS ======================================================================= -**luaotfload** [ -cfFiquvVh ] +**luaotfload** [ -cfFipquvVh ] -**luaotfload** --update [ --force ] [ --quiet ] [ --verbose ] [ --dry-run ] +**luaotfload** --update [ --force ] [ --quiet ] [ --verbose ] [ --prefer-texmf ] [ --dry-run ] **luaotfload** --find=FONTNAME [ --fuzzy ] [ --info ] @@ -55,6 +55,9 @@ update mode --update, -u Update the database; indexes new fonts. --force, -f Force rebuilding of the database; re-indexes all fonts. +--prefer-texmf, -p Organize the file name database in a way so + that it prefer fonts in the *TEXMF* tree over + system fonts if they are installed in both. --dry-run, -D Don’t load fonts, scan directories only. (For debugging file system related issues.) -- cgit v1.2.3