From 743c725a3c4e515cdb591a04dc5396c5e9e1de42 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 24 Apr 2013 23:17:41 +0200 Subject: =?UTF-8?q?default=20to=20=E2=80=9Cnode=E2=80=9D=20mode=20processo?= =?UTF-8?q?r=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luaotfload-features.lua | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'luaotfload-features.lua') diff --git a/luaotfload-features.lua b/luaotfload-features.lua index 3c5aa8c..78f8256 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -111,6 +111,8 @@ local defaults = { }, } +local global_defaults = { mode = "node" } + defaults.beng = defaults.deva defaults.guru = defaults.deva defaults.gujr = defaults.deva @@ -129,22 +131,36 @@ defaults.tibt = defaults.khmr defaults.lao = defaults.thai -local set_default_features = function (script) - local features - local script = script or "dflt" +--- (string, string) dict -> (string, string) dict +local set_default_features = function (speclist) + local script = speclist.script or "dflt" + report("log", 0, "load font", "auto-selecting default features for script: %s", script) - if defaults[script] then - features = defaults[script] - else - features = defaults["dflt"] + + local requested = defaults[script] + if not requested then + report("log", 0, "load font", + "no defaults for script “%s”, falling back to “dflt”", + script) + requested = defaults.dflt end - for _,v in next, features do - if feature_list[v] ~= false then - feature_list[v] = true + + for i=1, #requested do + local feat = requested[i] + if speclist[feat] ~= false then + speclist[feat] = true end end + + for feat, state in next, global_defaults do + --- This is primarily intended for setting node + --- mode unless “base” is requested, as stated + --- in the manual. + if not speclist[feat] then speclist[feat] = state end + end + return speclist end local function issome () feature_list.lookup = 'name' end @@ -177,13 +193,9 @@ local options = P(":") * spaces * (P(";")^0 * option)^0 local pattern = (filename + fontname) * subvalue^0 * stylespec^0 * options^0 local function colonized(specification) -- xetex mode - --print"~~~~~~~~~~~~~~~~~~~~~~~~" - --print(specification.specification) feature_list = { } lpeg.match(pattern,specification.specification) - set_default_features(feature_list.script) - --inspect(feature_list) - --os.exit() + feature_list = set_default_features(feature_list) if feature_list.style then specification.style = feature_list.style feature_list.style = nil @@ -216,9 +228,7 @@ local function colonized(specification) -- xetex mode -- if no mode is set, use our default feature_list.mode = fonts.mode end - --inspect(feature_list) specification.features.normal = fonts.handlers.otf.features.normalize(feature_list) - --inspect(specification.features.normal) return specification end -- cgit v1.2.3