summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-08-03 22:22:56 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-08-03 22:22:56 +0200
commit24ef88fda9d592e880c4694b50c64c5ae0b74a92 (patch)
tree8435e1cc315e00790a99cbbc107072c15ae156a7
parent8d890cb8e98d50f13bfe2a279da5ce3518458ac1 (diff)
downloadluaotfload-24ef88fda9d592e880c4694b50c64c5ae0b74a92.tar.gz
[tool] make --find process normal requests
-rw-r--r--luaotfload-database.lua2
-rw-r--r--luaotfload-features.lua37
-rwxr-xr-xluaotfload-tool.lua14
3 files changed, 37 insertions, 16 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 22a3744..939b6bb 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -2169,7 +2169,7 @@ update_names = function (fontnames, force, dry_run)
if config.luaotfload.update_live == false then
report("info", 2, "db",
- "skipping database update")
+ "Skipping database update")
--- skip all db updates
return fontnames or names.data
end
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index 213a529..db0b1d0 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -14,11 +14,25 @@ local lpegmatch = lpeg.match
---[[ begin included font-ltx.lua ]]
--- this appears to be based in part on luatex-fonts-def.lua
-local fonts = fonts
+local fonts = fonts
+local definers = fonts.definers
+local handlers = fonts.handlers
+
+local as_script, normalize
+
+if handlers then
+ normalize = handlers.otf.features.normalize
+else
+ normalize = function () end
+ as_script = true
+end
+
--HH A bit of tuning for definitions.
-fonts.constructors.namemode = "specification" -- somehow latex needs this (changed name!) => will change into an overload
+if fonts.constructors then
+ fonts.constructors.namemode = "specification" -- somehow latex needs this (changed name!) => will change into an overload
+end
--[[HH--
tricky: we sort of bypass the parser and directly feed all into
@@ -1182,20 +1196,21 @@ local handle_request = function (specification)
--- The next line sets the “rand” feature to “random”; I haven’t
--- investigated it any further (luatex-fonts-ext), so it will
--- just stay here.
- specification.features.normal
- = fonts.handlers.otf.features.normalize(request.features)
+ specification.features.normal = normalize (request.features)
return specification
end
-local compare_requests = function (spec)
- local old = old_behavior(spec)
- local new = handle_request(spec)
- return new
+if as_script == true then --- skip the remainder of the file
+ fonts.names.handle_request = handle_request
+ report ("log", 5, "load",
+ "Exiting early from luaotfload-features.lua.")
+ return
+else
+ local registersplit = definers.registersplit
+ registersplit (":", handle_request, "cryptic")
+ registersplit ("", handle_request, "more cryptic") -- catches \font\text=[names]
end
-fonts.definers.registersplit(":", handle_request, "cryptic")
-fonts.definers.registersplit("", handle_request, "more cryptic") -- catches \font\text=[names]
-
---[[ end included font-ltx.lua ]]
--[[doc--
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 11013e9..a187e12 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -753,7 +753,7 @@ end
actions.blacklist = function (job)
names.read_blacklist()
local n = 0
- for n, entry in next, table.sortedkeys(fonts.names.blacklist) do
+ for n, entry in next, table.sortedkeys(names.blacklist) do
texiowrite_nl(stringformat("(%d %s)", n, entry))
end
return true, false
@@ -803,16 +803,22 @@ end
actions.query = function (job)
+ require "luaotfload-features"
+
local query = job.query
+
local tmpspec = {
name = query,
lookup = "name",
- specification = "name:" .. query,
+ specification = query,
optsize = 0,
+ features = { },
}
+ tmpspec = names.handle_request (tmpspec)
+
local foundname, subfont, success =
- fonts.names.resolve(nil, nil, tmpspec)
+ names.resolve(nil, nil, tmpspec)
if success then
logs.names_report(false, 0,
@@ -835,7 +841,7 @@ actions.query = function (job)
if job.fuzzy == true then
logs.names_report(false, 0,
"resolve", "Looking for close matches, this may take a while ...")
- local success = fonts.names.find_closest(query, job.fuzzy_limit)
+ local success = names.find_closest(query, job.fuzzy_limit)
end
end
return true, true