summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-29 16:26:45 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-29 16:26:45 +0200
commitdae29b04d0bb7e21bb4d3d19b9781b59e44ec5cb (patch)
tree3c40f9df3fac174ef460ef692e75c37c9165f1fc
parent39bfa54bb32955f36f473abfa01dc43c73ad3efe (diff)
downloadluaotfload-dae29b04d0bb7e21bb4d3d19b9781b59e44ec5cb.tar.gz
use ``fullname`` in status entries
This suppresses redundand database updates in the case where a font is found in multiple directories with different timestamps. Also removed references to ``fontdbutil``.
-rw-r--r--luaotfload-database.lua48
-rw-r--r--luaotfload-features.lua2
-rwxr-xr-xluaotfload-tool.lua17
-rw-r--r--luaotfload.dtx30
4 files changed, 47 insertions, 50 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index a750804..037ca07 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -383,7 +383,7 @@ TODO:
× 3) make caching optional (via the config table) for debugging
× 4) make names_update() cache aware (nil if “force”)
× 5) add logging
- × 6) add cache control to fontdbutil
+ × 6) add cache control to luaotfload-tool
× 7) incr db version
8) wishlist: save cache only at the end of a run
9) ???
@@ -858,8 +858,10 @@ font_fullinfo = function (filename, subfont)
end
--- we return true if the fond is new or re-indexed
---- string -> dbobj -> dbobj -> bool -> bool
+--- string -> dbobj -> dbobj -> bool
local load_font = function (fullname, fontnames, newfontnames)
+ if not fullname then return false end
+
local newmappings = newfontnames.mappings
local newstatus = newfontnames.status
@@ -878,40 +880,39 @@ local load_font = function (fullname, fontnames, newfontnames)
local entryname = basename
- if not fullname then return false end
-
- if names.blacklist[fullname]
- or names.blacklist[basename]
+ if names.blacklist[fullname] or names.blacklist[basename]
then
report("log", 2, "db",
"ignoring blacklisted font “%s”", fullname)
return false
end
+
local timestamp, db_timestamp
- db_timestamp = status[entryname]
- and status[entryname].timestamp
+ db_timestamp = status[fullname]
+ and status[fullname].timestamp
timestamp = lfs.attributes(fullname, "modification")
- local index_status = newstatus[entryname] or newstatus[basename]
- local teststat = newstatus[entryname]
+ local index_status = newstatus[fullname]
--- index_status: nil | false | table
if index_status and index_status.timestamp == timestamp then
-- already indexed this run
return false
end
- newstatus[entryname] = newstatus[entryname] or { }
- newstatus[entryname].timestamp = timestamp
- newstatus[entryname].index = newstatus[entryname].index or { }
+ newstatus[fullname] = newstatus[fullname] or { }
+ newstatus[fullname].timestamp = timestamp
+ newstatus[fullname].index = newstatus[fullname].index or { }
+ --- this test compares the modification data registered
+ --- in the database with the current one
if db_timestamp == timestamp
- and not newstatus[entryname].index[1] then
- for _,v in next, status[entryname].index do
- local index = #newstatus[entryname].index
+ and not newstatus[fullname].index[1] then
+ for _,v in next, status[fullname].index do
+ local index = #newstatus[fullname].index
local fullinfo = mappings[v]
local location = #newmappings + 1
newmappings[location] = fullinfo --- keep
- newstatus[entryname].index[index+1] = location --- is this actually used anywhere?
+ newstatus[fullname].index[index+1] = location --- is this actually used anywhere?
-- newfullnames[fullname] = location
newbasenames[basename] = location
newbarenames[barename] = location
@@ -929,14 +930,14 @@ local load_font = function (fullname, fontnames, newfontnames)
return false
end
local location = #newmappings+1
- local index = newstatus[entryname].index[n_font]
+ local index = newstatus[fullname].index[n_font]
if not index then index = location end
newmappings[index] = fullinfo
-- newfullnames[fullname] = location
newbasenames[basename] = location
newbarenames[barename] = location
- newstatus[entryname].index[n_font] = index
+ newstatus[fullname].index[n_font] = index
end
else
local fullinfo = font_fullinfo(fullname, false)
@@ -944,14 +945,14 @@ local load_font = function (fullname, fontnames, newfontnames)
return false
end
local location = #newmappings+1
- local index = newstatus[entryname].index[1]
+ local index = newstatus[fullname].index[1]
if not index then index = location end
newmappings[index] = fullinfo
-- newfullnames[fullname] = location
newbasenames[basename] = location
newbarenames[barename] = location
- newstatus[entryname].index[1] = index
+ newstatus[fullname].index[1] = index
end
else --- missing info
@@ -1108,7 +1109,7 @@ local function scan_texmf_fonts(fontnames, newfontnames)
fontdirs = fontdirs .. stringgsub(kpseexpand_path("$TTFONTS"), "^%.", "")
if not stringis_empty(fontdirs) then
for _,d in next, filesplitpath(fontdirs) do
- local found, new = scan_dir(d, fontnames, newfontnames, true)
+ local found, new = scan_dir(d, fontnames, newfontnames)
n_scanned = n_scanned + found
n_new = n_new + new
end
@@ -1374,7 +1375,6 @@ local function scan_os_fonts(fontnames, newfontnames)
]]
report("info", 2, "db", "Scanning OS fonts...")
report("info", 3, "db", "Searching in static system directories...")
- print"~~~~"
for _,d in next, get_os_dirs() do
local found, new = scan_dir(d, fontnames, newfontnames)
n_scanned = n_scanned + found
@@ -1409,9 +1409,9 @@ update_names = function (fontnames, force)
fontnames = load_names()
end
if fontnames.version ~= names.version then
- fontnames = fontnames_init(true)
report("log", 1, "db", "No font names database or old "
.. "one found; generating new one")
+ fontnames = fontnames_init(true)
end
end
local newfontnames = fontnames_init(true)
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index 6cbfdf4..494d02d 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -301,7 +301,7 @@ end
---
--- caching of successful lookups is essential. we need
--- an additional subtable "cached" in the database. it
---- should be nil’able by issuing fontdbutil --flush or
+--- should be nil’able by issuing luaotfload-tool --flush or
--- something. if a cache miss is followed by a successful
--- lookup, then it will be counted as new addition to the
--- cache. we also need a config option to ignore caching.
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 470d282..bb935cf 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -35,7 +35,7 @@ Depending on how the script is called we change its behavior.
For backwards compatibility, moving or symlinking the script to a
file name starting with \fileent{mkluatexfontdb} will cause it to
trigger a database update on every run.
-Running as \fileent{fontdbutil} -- the new name -- will do this upon
+Running as \fileent{luaotfload-tool} -- the new name -- will do this upon
request only.
There are two naming conventions followed here: firstly that of
@@ -61,10 +61,9 @@ do -- we don’t have file.basename and the likes yet, so inline parser ftw
local extension = dot * (1 - slash - dot)^1
local p_basename = path^-1 * C(thename) * extension^-1 * P(-1)
- -- if stringfind(stringlower(arg[0]), "^fontdbutil") then
local self = lpegmatch(p_basename, stringlower(arg[0]))
- if self == "fontdbutil" then
- config.luaotfload.self = "fontdbutil"
+ if self == "luaotfload-tool" then
+ config.luaotfload.self = "luaotfload-tool"
else
config.luaotfload.self = "mkluatexfontdb"
end
@@ -101,7 +100,7 @@ local db_src_out = names.path.dir.."/"..names.path.basename
local db_bin_out = file.replacesuffix(db_src_out, "luc")
local help_messages = {
- fontdbutil = [[
+ ["luaotfload-tool"] = [[
Usage: %s [OPTION]...
@@ -119,7 +118,7 @@ This tool is part of the luaotfload package. Valid options are:
-V --version print version and exit
-h --help print this message
- --alias=<name> force behavior of “fontdbutil” or legacy
+ --alias=<name> force behavior of “luaotfload-tool” or legacy
“mkluatexfontdb”
-------------------------------------------------------------------------------
DATABASE
@@ -155,7 +154,7 @@ Valid options:
-vvv print all steps of directory searching
-V --version print version and exit
-h --help print this message
- --alias=<name> force behavior of “fontdbutil” or legacy
+ --alias=<name> force behavior of “luaotfload-tool” or legacy
“mkluatexfontdb”
The font database will be saved to
@@ -167,7 +166,7 @@ The font database will be saved to
local help_msg = function ( )
local template = help_messages[config.luaotfload.self]
- or help.messages.fontdbutil
+ or help_messages["luaotfload-tool"]
texiowrite_nl(stringformat(template, config.luaotfload.self, db_src_out, db_bin_out))
end
@@ -394,9 +393,7 @@ local process_cmdline = function ( ) -- unit -> jobspec
if config.luaotfload.self == "mkluatexfontdb" then
action_pending["generate"] = true
- print(result.log_level)
result.log_level = math.max(2, result.log_level)
- print(result.log_level)
end
return result
end
diff --git a/luaotfload.dtx b/luaotfload.dtx
index 6392c64..9c5d600 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -768,8 +768,8 @@ and the derived files
% This is particularly noticeable if it occurs during a typesetting run.
% In any case, subsequent updates to the database will be quite fast.
%
-% \subsection[fontdbutil / mkluatexfontdb.lua]%
-% {\fileent{fontdbutil} /
+% \subsection[luaotfload-tool / mkluatexfontdb.lua]%
+% {\fileent{luaotfload-tool} /
% \fileent{mkluatexfontdb.lua}\footnote{%
% The script may be named just \fileent{mkluatexfontdb} in your
% distribution.
@@ -778,7 +778,7 @@ and the derived files
% It can still be desirable at times to do some of these steps
% manually, and without having to compile a document.
% To this end, \identifier{luaotfload} comes with the utility
-% \fileent{fontdbutil} that offers an interface to the database
+% \fileent{luaotfload-tool} that offers an interface to the database
% functionality.
% Being a \LUA script, there are two ways to run it:
% either make it executable (\verb|chmod +x| on unixoid systems) or
@@ -793,15 +793,15 @@ and the derived files
% \emphasis{Note}:
% On \abbrev{MS} \identifier{Windows} systems, the script can be run
% either by calling the wrapper application
-% \fileent{fontdbutil.exe} or as
-% \verb|texlua.exe fontdbutil|.
+% \fileent{luaotfload-tool.exe} or as
+% \verb|texlua.exe luaotfload-tool.lua|.
% }
% Invoked with the argument \verb|--update| it will perform a database
% update, scanning for fonts not indexed.
%
% \begin{quote}
% \begin{verbatim}
-% fontdbutil --update
+% luaotfload-tool --update
% \end{verbatim}
% \end{quote}
%
@@ -810,11 +810,11 @@ and the derived files
%
% \begin{quote}
% \begin{verbatim}
-% fontdbutil --update --force
+% luaotfload-tool --update --force
% \end{verbatim}
% \end{quote}
%
-% For sake of backwards compatibility, \fileent{fontdbutil} may be
+% For sake of backwards compatibility, \fileent{luaotfload-tool} may be
% renamed or symlinked to \fileent{mkluatexfontdb}.
% Whenever it is run under this name, it will update the database
% first, mimicking the behavior of earlier versions of
@@ -862,7 +862,7 @@ and the derived files
%
% \subsection{Querying from Outside}
%
-% \fileent{fontdbutil} also provides rudimentary means of
+% \fileent{luaotfload-tool} also provides rudimentary means of
% accessing the information collected in the font database.
% If the option \verb|--find=|\emphasis{name} is given, the script will
% try and search the fonts indexed by \identifier{luaotfload} for a
@@ -871,7 +871,7 @@ and the derived files
%
% \begin{quote}
% \begin{verbatim}
-% fontdbutil --find="Iwona Regular"
+% luaotfload-tool --find="Iwona Regular"
% \end{verbatim}
% \end{quote}
%
@@ -888,7 +888,7 @@ and the derived files
%
% \begin{quote}
% \begin{verbatim}
-% fontdbutil -F --find="Iwona Bright"
+% luaotfload-tool -F --find="Iwona Bright"
% \end{verbatim}
% \end{quote}
%
@@ -899,7 +899,7 @@ and the derived files
% using the \verb|-i| option (\verb|--info|).
% \begin{quote}
% \begin{verbatim}
-% fontdbutil -F --find="Iwona Light Italic"
+% luaotfload-tool -F --find="Iwona Light Italic"
% \end{verbatim}
% \end{quote}
% \noindent
@@ -908,7 +908,7 @@ and the derived files
% In \TEX Live: \fileent{texmf-dist/doc/luatex/base/luatexref-t.pdf}.
% }
%
-% \verb|fontdbutil --help| will list the available command line
+% \verb|luaotfload-tool --help| will list the available command line
% switches, including some not discussed in detail here.
%
% \subsection{Blacklisting Fonts}
@@ -917,7 +917,7 @@ and the derived files
% Some fonts are problematic in general, or just in \LUATEX.
% If you find that compiling your document takes far too long or eats
% away all your system’s memory, you can track down the culprit by
-% running \verb|fontdbutil -v| to increase verbosity.
+% running \verb|luaotfload-tool -v| to increase verbosity.
% Take a note of the \emphasis{filename} of the font that database
% creation fails with and append it to the file
% \fileent{luaotfload-blacklist.cnf}.
@@ -1126,7 +1126,7 @@ and the derived files
% verbosity levels and redirecting log output to \fileent{stdout}:
%
% \begin{verbatim}
-% fontdbutil -fuvvv --log=stdout
+% luaotfload-tool -fuvvv --log=stdout
% \end{verbatim}
%
% If this fails, the font last printed to the terminal is likely to be