diff options
-rw-r--r-- | src/luaotfload-database.lua | 4 | ||||
-rw-r--r-- | src/luaotfload-features.lua | 26 | ||||
-rw-r--r-- | src/luaotfload-loaders.lua | 17 |
3 files changed, 26 insertions, 21 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 367723b..1d5dfd8 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -583,8 +583,6 @@ local style_category = { local type1_metrics = { "tfm", "ofm", } -local dummy_findfile = resolvers.findfile -- from basics-gen - local lookup_filename = function (filename) if not name_index then name_index = load_names () end local files = name_index.files @@ -630,6 +628,8 @@ end --doc]]-- +local dummy_findfile = resolvers.findfile -- from basics-gen + --- string -> string * string * bool local lookup_font_file lookup_font_file = function (filename) diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua index 0ca58c1..aeeaea3 100644 --- a/src/luaotfload-features.lua +++ b/src/luaotfload-features.lua @@ -69,9 +69,14 @@ local mathceil = math.ceil local cmp_by_idx = function (a, b) return a.idx < b.idx end +local defined_combos = 0 + local handle_combination = function (combo, spec) + defined_combos = defined_combos + 1 if not combo [1] then - report ("both", 0, "load", "Empty font combination requested.") + report ("both", 0, "load", + "combo %d: Empty font combination requested.", + defined_combos) return false end @@ -86,7 +91,8 @@ local handle_combination = function (combo, spec) tablesort (combo, cmp_by_idx) --- pass 1: skim combo and resolve fonts - report ("both", 0, "load", "Combining %d fonts.", n) + report ("both", 0, "load", "combo %d: combining %d fonts.", + defined_combos, n) for i = 1, n do local cur = combo [i] local id = cur.id @@ -98,7 +104,7 @@ local handle_combination = function (combo, spec) " *> %.2d: include font %d at rank %d (%d items).", i, id, idx, (chars and #chars or 0)) chain [#chain + 1] = { fnt, chars, idx = idx } - fontids [#fontids + 1] = id + fontids [#fontids + 1] = { id = id } else report ("both", 0, "load", " *> %.2d: font %d at rank %d unknown, skipping.", @@ -128,7 +134,7 @@ local handle_combination = function (combo, spec) local baseprop = basefnt.properties baseprop.name = spec.name baseprop.virtualized = true - baseprop.fonts = fontids + basefnt.fonts = fontids for i = 2, nc do local cur = chain [i] @@ -140,7 +146,7 @@ local handle_combination = function (combo, spec) local pickchr = function (uc) local chr = src [uc] if chr then - chr.commands = { "slot", i, uc } + chr.commands = { { "slot", i, uc } } basechar [uc] = chr cnt = cnt + 1 end @@ -169,11 +175,11 @@ local handle_combination = function (combo, spec) " *> font %d / %d: imported %d glyphs into combo.", i, nc, cnt) end - spec.lookup = nil - spec.method = nil - spec.name = spec.specification - spec.forced = nil - spec.data = function () return basefnt end + spec.file = basefnt.filename + spec.name = stringformat ("luaotfload<%d>", defined_combos) + spec.features = { normal = { spec.specification } } + spec.forced = "evl" + spec.eval = function () return basefnt end return spec end diff --git a/src/luaotfload-loaders.lua b/src/luaotfload-loaders.lua index 8e5248b..80ce41a 100644 --- a/src/luaotfload-loaders.lua +++ b/src/luaotfload-loaders.lua @@ -32,14 +32,13 @@ local lua_reader = function (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 +local eval_reader = function (specification) + local eval = specification.eval + if not eval or type (eval) ~= "function" then return nil end + logreport ("both", 0, "loaders", + "eval: found tfmdata for ā%sā, injecting.", + specification.name) + return eval () end local install_formats = function () @@ -71,7 +70,7 @@ local install_formats = function () return true end - return aux ("dat", data_reader) + return aux ("evl", eval_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) |