summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-features.lua17
-rw-r--r--src/luaotfload-loaders.lua46
2 files changed, 56 insertions, 7 deletions
diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua
index 723fd54..0ca58c1 100644
--- a/src/luaotfload-features.lua
+++ b/src/luaotfload-features.lua
@@ -74,7 +74,6 @@ local handle_combination = function (combo, spec)
report ("both", 0, "load", "Empty font combination requested.")
return false
end
- inspect(combo)
if not fontidentifiers then
fontidentifiers = fonts.hashes and fonts.hashes.identifiers
@@ -150,9 +149,16 @@ local handle_combination = function (combo, spec)
for j = 1, #def do
local this = def [j]
if type (this) == "number" then
+ report ("both", 0, "load",
+ " *> [%d][%d]: import codepoint U+%.4X",
+ i, j, this)
pickchr (this)
elseif type (this) == "table" then
- for uc = this [1], this [2] do pickchr (uc) end
+ local lo, hi = unpack (this)
+ report ("both", 0, "load",
+ " *> [%d][%d]: import codepoint range U+%.4X--U+%.4X",
+ i, j, lo, hi)
+ for uc = lo, hi do pickchr (uc) end
else
report ("both", 0, "load",
" *> item no. %d of combination definition \z
@@ -163,7 +169,12 @@ local handle_combination = function (combo, spec)
" *> font %d / %d: imported %d glyphs into combo.",
i, nc, cnt)
end
- return basefnt
+ spec.lookup = nil
+ spec.method = nil
+ spec.name = spec.specification
+ spec.forced = nil
+ spec.data = function () return basefnt end
+ return spec
end
---[[ begin excerpt from font-ott.lua ]]
diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua
index 0f22f46..8e5248b 100644
--- a/src/luaotfload-loaders.lua
+++ b/src/luaotfload-loaders.lua
@@ -14,13 +14,43 @@ if not luaotfload then error "this module requires Luaotfload" end
local logreport = luaotfload.log and luaotfload.log.report or print
+local lua_reader = function (specification)
+ local fullname = specification.filename or ""
+ if fullname == "" then
+ local forced = specification.forced or ""
+ if forced ~= "" then
+ fullname = specification.name .. "." .. forced
+ else
+ fullname = specification.name
+ end
+ end
+ local fullname = resolvers.findfile (fullname) or ""
+ if fullname ~= "" then
+ local loader = loadfile (fullname)
+ loader = loader and loader ()
+ return loader and loader (specification)
+ end
+end
+
+local data_reader = function (specification)
+ local data = specification.data
+ if data and type (data) == "function" then
+ logreport ("both", 0, "loaders",
+ "data: found tfmdata for ā€œ%sā€, injecting.",
+ specification.name)
+ return data ()
+ end
+end
+
local install_formats = function ()
local fonts = fonts
if not fonts then return false end
- local readers = fonts.readers
- local handlers = fonts.handlers
- local formats = fonts.formats
+ local readers = fonts.readers
+ local sequence = readers.sequence
+ local seqset = table.tohash (sequence)
+ local handlers = fonts.handlers
+ local formats = fonts.formats
if not readers or not handlers or not formats then return false end
local aux = function (which, reader)
@@ -32,10 +62,18 @@ local install_formats = function ()
formats [which] = "type1"
readers [which] = reader
handlers [which] = { }
+ if not seqset [which] then
+ logreport ("both", 0, "loaders",
+ "Extending reader sequence for ā€œ%sā€.", which)
+ sequence [#sequence + 1] = which
+ seqset [which] = true
+ end
return true
end
- return aux ("pfa", function (spec) return readers.opentype (spec, "pfa", "type1") end)
+ return aux ("dat", data_reader)
+ and aux ("lua", lua_reader)
+ and aux ("pfa", function (spec) return readers.opentype (spec, "pfa", "type1") end)
and aux ("pfb", function (spec) return readers.opentype (spec, "pfb", "type1") end)
and aux ("ofm", readers.tfm)
end