summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-25 11:25:18 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-25 11:25:18 +0200
commit7bf46ad63839d6e38a9c1e11ec7d4fba27d1bc51 (patch)
tree942ffddaa830a52504831526512ce48ddb5ab83d
parent4d0d2c19ab36d4918a72041a087fbcb451ac8c52 (diff)
downloadluaotfload-7bf46ad63839d6e38a9c1e11ec7d4fba27d1bc51.tar.gz
add ``--alias`` option to fontdbutil
-rwxr-xr-xfontdbutil.lua38
-rw-r--r--luaotfload-database.lua18
-rw-r--r--luaotfload-override.lua2
3 files changed, 34 insertions, 24 deletions
diff --git a/fontdbutil.lua b/fontdbutil.lua
index fed1840..d76678f 100755
--- a/fontdbutil.lua
+++ b/fontdbutil.lua
@@ -119,6 +119,8 @@ 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
+ “mkluatexfontdb”
-------------------------------------------------------------------------------
DATABASE
@@ -152,6 +154,8 @@ 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
+ “mkluatexfontdb”
The font database will be saved to
%s
@@ -187,10 +191,10 @@ local show_font_info = function (filename)
local fontinfo = fontloader.info(fullname)
local nfonts = #fontinfo
if nfonts > 0 then -- true type collection
- logs.names_report(true, 0, "resolve",
+ logs.names_report(true, 1, "resolve",
[[%s is a font collection]], filename)
for n = 1, nfonts do
- logs.names_report(true, 0, "resolve",
+ logs.names_report(true, 1, "resolve",
[[showing info for font no. %d]], n)
show_info_items(fontinfo[n])
end
@@ -198,7 +202,7 @@ local show_font_info = function (filename)
show_info_items(fontinfo)
end
else
- logs.names_report(true, 0, "resolve",
+ logs.names_report(true, 1, "resolve",
"font %s not found", filename)
end
end
@@ -221,7 +225,7 @@ local actions = { } --- (jobspec -> (bool * bool)) list
actions.loglevel = function (job)
logs.set_loglevel(job.log_level)
- logs.names_report("log", 2, "util",
+ logs.names_report("info", 3, "util",
"setting log level", "%d", job.log_level)
return true, true
end
@@ -239,7 +243,7 @@ end
actions.generate = function (job)
local fontnames, savedname
fontnames = names.update(fontnames, job.force_reload)
- logs.names_report("log", 0, "db",
+ logs.names_report("info", 2, "db",
"Fonts in the database: %i", #fontnames.mappings)
savedname = names.save(fontnames)
if savedname then --- FIXME have names.save return bool
@@ -262,18 +266,18 @@ actions.query = function (job)
fonts.names.resolve(nil, nil, tmpspec)
if success then
- logs.names_report(false, 0,
+ logs.names_report(false, 1,
"resolve", "Font “%s” found!", query)
- logs.names_report(false, 0,
+ logs.names_report(false, 1,
"resolve", "Resolved file name “%s”:", foundname)
if job.show_info then
show_font_info(foundname)
end
else
- logs.names_report(false, 0,
+ logs.names_report(false, 1,
"resolve", "Cannot find “%s”.", query)
if job.fuzzy == true then
- logs.names_report(false, 2,
+ logs.names_report(false, 1,
"resolve", "Looking for close matches, this may take a while ...")
local success = fonts.names.find_closest(query, job.fuzzy_limit)
end
@@ -295,14 +299,11 @@ local process_cmdline = function ( ) -- unit -> jobspec
local result = { -- jobspec
force_reload = nil,
query = "",
- log_level = 1,
+ log_level = 1, --- 2 is approx. the old behavior
}
- if config.luaotfload.self == "mkluatexfontdb" then
- action_pending["generate"] = true
- end
-
local long_options = {
+ alias = 1,
find = 1,
force = "f",
fuzzy = "F",
@@ -363,8 +364,17 @@ local process_cmdline = function ( ) -- unit -> jobspec
end
elseif v == "i" then
result.show_info = true
+ elseif v == "alias" then
+ config.luaotfload.self = optarg[n]
end
end
+
+ 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-database.lua b/luaotfload-database.lua
index 4044e8e..e8f3d1d 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -201,10 +201,10 @@ load_names = function ( )
if data then
report("info", 1, "db",
"Font names database loaded", "%s", foundname)
- report("info", 1, "db", "Loading took %0.f ms",
+ report("info", 3, "db", "Loading took %0.f ms",
1000*(os.gettimeofday()-starttime))
else
- report("info", 0, "db",
+ report("info", 1, "db",
[[Font names database not found, generating new one.
This can take several minutes; please be patient.]])
data = update_names(fontnames_init())
@@ -938,9 +938,9 @@ local function scan_texmf_fonts(fontnames, newfontnames)
variables OPENTYPEFONTS and TTFONTS of texmf.cnf
]]
if stringis_empty(kpseexpand_path("$OSFONTDIR")) then
- report("info", 1, "db", "Scanning TEXMF fonts...")
+ report("info", 2, "db", "Scanning TEXMF fonts...")
else
- report("info", 1, "db", "Scanning TEXMF and OS fonts...")
+ report("info", 2, "db", "Scanning TEXMF and OS fonts...")
end
local fontdirs = stringgsub(kpseexpand_path("$OPENTYPEFONTS"), "^%.", "")
fontdirs = fontdirs .. stringgsub(kpseexpand_path("$TTFONTS"), "^%.", "")
@@ -1091,8 +1091,8 @@ local function scan_os_fonts(fontnames, newfontnames)
- fontcache for Unix (reads the fonts.conf file and scans the directories)
- a static set of directories for Windows and MacOSX
]]
- report("info", 1, "db", "Scanning OS fonts...")
- report("info", 2, "db", "Searching in static system directories...")
+ report("info", 2, "db", "Scanning OS fonts...")
+ report("info", 3, "db", "Searching in static system directories...")
for _,d in next, get_os_dirs() do
local found, new = scan_dir(d, fontnames, newfontnames, false)
n_scanned = n_scanned + found
@@ -1110,7 +1110,7 @@ update_names = function (fontnames, force)
- “newfontnames” is the final table to return
- force is whether we rebuild it from scratch or not
]]
- report("info", 1, "db", "Updating the font names database"
+ report("info", 2, "db", "Updating the font names database"
.. (force and " forcefully" or ""))
if force then
@@ -1144,9 +1144,9 @@ update_names = function (fontnames, force)
--- before rewrite | after rewrite
--- partial: 804 ms | 701 ms
--- forced: 45384 ms | 44714 ms
- report("info", 1, "db",
+ report("info", 3, "db",
"Scanned %d font files; %d new entries.", n_scanned, n_new)
- report("info", 1, "db",
+ report("info", 3, "db",
"Rebuilt in %0.f ms", 1000*(os.gettimeofday()-starttime))
return newfontnames
end
diff --git a/luaotfload-override.lua b/luaotfload-override.lua
index 4953edf..726000d 100644
--- a/luaotfload-override.lua
+++ b/luaotfload-override.lua
@@ -69,7 +69,7 @@ logs.names_report = function (mode, lvl, ...)
end
if not lvl then lvl = 0 end
- if loglevel > lvl then
+ if loglevel >= lvl then
if mode == "log" then
log (...)
elseif mode == "both" then