diff options
author | David Carlisle <d.p.carlisle@gmail.com> | 2015-11-21 21:45:03 +0000 |
---|---|---|
committer | David Carlisle <d.p.carlisle@gmail.com> | 2015-11-21 21:45:03 +0000 |
commit | b46f13e0949e310b46e97e791fd4e9e38635a491 (patch) | |
tree | 415c893c82e7f55ed630a10033885f1b5781ab56 /src/luaotfload-features.lua | |
parent | a472b6fd5461318ec1e5d2899af2ef57f0fb14e8 (diff) | |
parent | 6c3d70e21b100c6c7ffa11e1c6d9260b32ccc781 (diff) | |
download | luaotfload-b46f13e0949e310b46e97e791fd4e9e38635a491.tar.gz |
for 2.6
Diffstat (limited to 'src/luaotfload-features.lua')
-rw-r--r-- | src/luaotfload-features.lua | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua index 9b895ce..6fb2114 100644 --- a/src/luaotfload-features.lua +++ b/src/luaotfload-features.lua @@ -921,24 +921,13 @@ end ---[[ end included font-ltx.lua ]] ---[[doc-- -This uses the code from luatex-fonts-merged (<- font-otc.lua) instead -of the removed luaotfload-font-otc.lua. - -TODO find out how far we get setting features without these lines, -relying on luatex-fonts only (it *does* handle features somehow, after -all). ---doc]]-- - --- we assume that the other otf stuff is loaded already +-- We assume that the other otf stuff is loaded already; though there’s +-- another check below during the initialization phase. ---[[ begin snippet from font-otc.lua ]] local trace_loading = false trackers.register("otf.loading", function(v) trace_loading = v end) local report_otf = logs.reporter("fonts","otf loading") -local otf = fonts.handlers.otf -local registerotffeature = otf.features.register - --[[HH-- In the userdata interface we can not longer tweak the loaded font as @@ -960,7 +949,7 @@ setmetatableindex(types, function(t,k) t[k] = k return k end) -- "key" local everywhere = { ["*"] = { ["*"] = true } } -- or: { ["*"] = { "*" } } local noflags = { } -local function addfeature(data,feature,specifications) +local function addfeature (data, feature, specifications) local descriptions = data.descriptions local resources = data.resources local lookups = resources.lookups @@ -1100,26 +1089,9 @@ local function addfeature(data,feature,specifications) end end - -otf.enhancers.addfeature = addfeature - -local extrafeatures = { } - -function otf.addfeature(name,specification) - extrafeatures[name] = specification -end - -local function enhance(data,filename,raw) - for feature, specification in next, extrafeatures do - addfeature(data,feature,specification) - end -end - -otf.enhancers.register("check extra features",enhance) - ---[[ end snippet from font-otc.lua ]] -local tlig = { +local tlig_specification = { { type = "substitution", features = everywhere, @@ -1167,9 +1139,6 @@ local tlig = { }, } -otf.addfeature ("tlig", tlig) -otf.addfeature ("trep", { }) - local anum_arabic = { --- these are the same as in font-otc [0x0030] = 0x0660, [0x0031] = 0x0661, @@ -1228,11 +1197,45 @@ local anum_specification = { }, } -otf.addfeature ("anum", anum_specification) +return { + init = function () + + if not fonts and fonts.handlers then + logreport ("log", 0, "color", + "OTF mechanisms missing -- did you forget to \z + load a font loader?") + return false + end + + local otf = fonts.handlers.otf -registerotffeature { - name = "anum", - description = "arabic digits", + local extrafeatures = { + tlig = tlig_specification, + trep = { }, + anum = anum_specification, + } + + otf.enhancers.register ("check extra features", + function (data,filename, raw) + for feature, specification in next, extrafeatures do + addfeature (data, feature, specification) + end + end) + + logreport = luaotfload.log.report + if not fonts then + logreport ("log", 0, "color", + "OTF mechanisms missing -- did you forget to \z + load a font loader?") + return false + end + + otf.features.register { + name = "anum", + description = "arabic digits", + } + return true + end } -- vim:tw=71:sw=4:ts=4:expandtab |