From 1a76cea6357f50d7dae752765173af335ba95beb Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 29 Apr 2013 13:57:35 +0200 Subject: add handler for XeTeX slashed notation --- luaotfload-features.lua | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'luaotfload-features.lua') diff --git a/luaotfload-features.lua b/luaotfload-features.lua index de7ff3f..b11bf22 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -431,6 +431,35 @@ local select_lookup = function (request) end end +local supported = { + b = "bold", + i = "italic", + bi = "bolditalic", + aat = false, + icu = false, + gr = false, +} + +local handle_slashed = function (modifiers) + local style, optsize + for i=1, #modifiers do + local mod = modifiers[i] + if supported[mod] then + style = supported[mod] + --elseif stringfind(v, "^s=") then + elseif stringsub(v, 1, 2) == "s=" then + local val = stringsub(v, 3) + optsize = val + elseif stylename == false then + report("log", 0, + "load", "unsupported font option: %s", v) + elseif not stringis_empty(v) then + style = stringgsub(v, "[^%a%d]", "") + end + end + return style, optsize +end + --- spec -> spec local handle_request = function (specification) local request = lpegmatch(font_request, @@ -443,6 +472,11 @@ local handle_request = function (specification) specification.lookup = lookup or specification.lookup end + if request.modifiers then + local style, optsize = handle_slashed(request.modifiers) + specification.style, specification.optsize = style, optsize + end + for n=1, #import_values do local feat = import_values[n] local newvalue = request.features[feat] @@ -451,6 +485,7 @@ local handle_request = function (specification) request.features[feat] = nil end end + --- The next line sets the “rand” feature to “random”; I haven’t --- investigated it any further (luatex-fonts-ext), so it will --- just stay here. -- cgit v1.2.3