summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-database.lua3
-rw-r--r--src/luaotfload-main.lua2
-rw-r--r--src/luaotfload-resolvers.lua32
-rwxr-xr-xsrc/luaotfload-tool.lua7
4 files changed, 22 insertions, 22 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index 086f46f..b84b48d 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -3501,7 +3501,8 @@ return {
logreport = luaotfload.log.report
local fonts = fonts
fonts.names = fonts.names or names
- fonts.definers = fonts.definers or { }
+ fonts.formats = fonts.formats or { }
+ fonts.definers = fonts.definers or { resolvers = { } }
names.blacklist = blacklist
names.version = 2.51
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua
index ff2b48d..98afee0 100644
--- a/src/luaotfload-main.lua
+++ b/src/luaotfload-main.lua
@@ -194,7 +194,7 @@ luaotfload.main = function ()
initialize "colors" --- Per-font colors.
luaotfload.resolvers = loadmodule "resolvers" --- Font lookup
- luaotfload.resolvers.install ()
+ luaotfload.resolvers.init ()
if not config.actions.reconfigure () then
logreport ("log", 0, "load", "Post-configuration hooks failed.")
diff --git a/src/luaotfload-resolvers.lua b/src/luaotfload-resolvers.lua
index 42ea2fd..2e34a4e 100644
--- a/src/luaotfload-resolvers.lua
+++ b/src/luaotfload-resolvers.lua
@@ -37,15 +37,9 @@ local stringlower = string.lower
local stringformat = string.format
local filesuffix = file.suffix
local fileremovesuffix = file.removesuffix
-local formats = fonts.formats
-local names = fonts.names
-local encodings = fonts.encodings
local luatexbase = luatexbase
local logreport = luaotfload.log.report
-formats.ofm = "type1"
-encodings.known = encodings.known or { }
-
--[[doc--
\identifier{luaotfload} promises easy access to system fonts.
@@ -70,9 +64,9 @@ encodings.known = encodings.known or { }
local resolve_file
resolve_file = function (specification)
- local name = names.lookup_font_file (specification.name)
+ local name = fonts.names.lookup_font_file (specification.name)
local suffix = filesuffix (name)
- if formats[suffix] then
+ if fonts.formats[suffix] then
specification.forced = stringlower (suffix)
specification.forcedname = fileremovesuffix(name)
else
@@ -101,7 +95,7 @@ resolve_path = function (specification)
resolve_file (specification)
else
local suffix = filesuffix (name)
- if formats[suffix] then
+ if fonts.formats[suffix] then
specification.forced = stringlower (suffix)
specification.name = fileremovesuffix(name)
specification.forcedname = name
@@ -122,9 +116,9 @@ end
local resolve_name
resolve_name = function (specification)
- local resolver = names.lookup_font_name_cached
+ local resolver = fonts.names.lookup_font_name_cached
if config.luaotfload.run.resolver == "normal" then
- resolver = names.lookup_font_name
+ resolver = fonts.names.lookup_font_name
end
local resolved, subfont = resolver (specification)
if resolved then
@@ -210,7 +204,7 @@ local resolve_kpse
resolve_kpse = function (specification)
local name = specification.name
local suffix = filesuffix (name)
- if suffix and formats[suffix] then
+ if suffix and fonts.formats[suffix] then
name = fileremovesuffix (name)
if resolvers.findfile (name, suffix) then
specification.forced = stringlower (suffix)
@@ -218,7 +212,7 @@ resolve_kpse = function (specification)
return
end
end
- for t, format in next, formats do --- brute force
+ for t, format in next, fonts.formats do --- brute force
if kpsefind_file (name, format) then
specification.forced = t
specification.name = name
@@ -238,8 +232,11 @@ local resolve_my = function (specification)
end
return {
- install = function ( )
- luatexbase.create_callback ("luaotfload.resolve_font", "simple", function () end)
+ init = function ( )
+ if luatexbase and luatexbase.create_callback then
+ luatexbase.create_callback ("luaotfload.resolve_font",
+ "simple", function () end)
+ end
logreport ("log", 5, "resolvers", "installing font resolvers", name)
local request_resolvers = fonts.definers.resolvers
request_resolvers.file = resolve_file
@@ -248,8 +245,11 @@ return {
request_resolvers.path = resolve_path
request_resolvers.kpse = resolve_kpse
request_resolvers.my = resolve_my
+ fonts.formats.ofm = "type1"
+ fonts.encodings = fonts.encodings or { }
+ fonts.encodings.known = fonts.encodings.known or { }
return true
- end, --- [.install]
+ end, --- [.init]
}
--- vim:ft=lua:ts=8:sw=4:et
diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua
index 8b7bc33..e92f5fb 100755
--- a/src/luaotfload-tool.lua
+++ b/src/luaotfload-tool.lua
@@ -76,7 +76,6 @@ else -- 5.2
runtime = { "stock", _VERSION }
end
-
local C, Ct, P, S = lpeg.C, lpeg.Ct, lpeg.P, lpeg.S
local lpegmatch = lpeg.match
@@ -84,7 +83,6 @@ local loader_file = "luatexbase.loader.lua"
local loader_path = assert(kpsefind_file(loader_file, "lua"),
"File '"..loader_file.."' not found")
-
string.quoted = string.quoted or function (str)
return string.format("%q",str)
end
@@ -171,6 +169,7 @@ loadmodule "log.lua" --- this populates the luaotfload.log.* namespace
loadmodule "parsers" --- fonts.conf, configuration, and request syntax
loadmodule "configuration" --- configuration file handling
loadmodule "database"
+loadmodule "resolvers" --- Font lookup
local logreport
@@ -237,7 +236,7 @@ Usage: %s [OPTIONS...]
-c --no-compress do not gzip index file (text version only)
-l --flush-lookups empty lookup cache of font requests
-D --dry-run skip loading of fonts, just scan
- --formats=[+|-]EXTENSIONS set, add, or subtract formats to index
+ --formats=[+|-]EXTENSIONS set, add, or subtract file formats
-p --prefer-texmf prefer fonts in the TEXMF over system fonts
--max-fonts=N process at most N font files
@@ -1227,7 +1226,7 @@ actions.query = function (job)
if tmpspec.lookup == "name"
or tmpspec.lookup == "anon" --- not *exactly* as resolvers.anon
then
- foundname, subfont = fonts.names.resolve_name (tmpspec)
+ foundname, subfont = fonts.definers.resolvers.name (tmpspec)
if foundname then
foundname, _, success = fonts.names.font_file_lookup (foundname)
end