summaryrefslogtreecommitdiff
path: root/luaotfload-features.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-29 13:57:35 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-29 13:57:35 +0200
commit1a76cea6357f50d7dae752765173af335ba95beb (patch)
tree37a20c1981e7192cc49e16143ce79de52c0672ed /luaotfload-features.lua
parentbe7d5713a125033d686d97a38910cb5af62f9093 (diff)
downloadluaotfload-1a76cea6357f50d7dae752765173af335ba95beb.tar.gz
add handler for XeTeX slashed notation
Diffstat (limited to 'luaotfload-features.lua')
-rw-r--r--luaotfload-features.lua35
1 files changed, 35 insertions, 0 deletions
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.