summaryrefslogtreecommitdiff
path: root/luaotfload-features.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-18 11:51:26 -0700
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-18 11:51:26 -0700
commit145f556ee90d4e46b897d5fac5a3d7387416f056 (patch)
tree191ff873a1143ecaaef9f3ad7459177621948349 /luaotfload-features.lua
parent1ae16ddf7fbfde3eafedcbe1800592221ab751f3 (diff)
parent6a572d507fc8ec31ab02da469b07f166ca3e1011 (diff)
downloadluaotfload-145f556ee90d4e46b897d5fac5a3d7387416f056.tar.gz
Merge pull request #80 from phi-gamma/master
fix issue #79
Diffstat (limited to 'luaotfload-features.lua')
-rw-r--r--luaotfload-features.lua36
1 files changed, 30 insertions, 6 deletions
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index f541964..7ae035b 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -35,6 +35,7 @@ local report = logs.names_report
local stringfind = string.find
local stringlower = string.lower
local stringgsub = string.gsub
+local stringsub = string.sub
local stringis_empty = string.is_empty
--- TODO an option to dump the default features for a script would make
@@ -864,13 +865,34 @@ end
---
-----------------------------------------------------------------------
+--[[doc--
+
+ One further incompatibility between Xetex and Luatex-Fonts consists
+ in their option list syntax: apparently, Xetex requires key-value
+ options to be prefixed by a "+" (ascii “plus”) character. We
+ silently accept this as well, dropping the first byte if it is a
+ plus or minus character.
+
+ Reference: https://github.com/lualatex/luaotfload/issues/79#issuecomment-18104483
+
+--doc]]--
+
+local strip_leading_sign = function (s)
+ --- handle option list keys
+ local first = stringsub(s, 1, 1)
+ if first == "+" or first == "-" then --- Xetex style
+ return stringsub(s, 2)
+ end
+ return s
+end
local toboolean = function (s)
- if s == "true" then return true end
- if s == "false" then return false end
---if s == "yes" then return true end --- Context style
---if s == "no" then return false end
- return stringlower(s)
+ --- handle option list values
+ if s == "true" then return true end
+ if s == "false" then return false end
+ --if s == "yes" then return true end --- Context style
+ --if s == "no" then return false end
+ return stringlower(s)
end
--[[doc--
@@ -956,7 +978,9 @@ local path_lookup = lbrk * Cg(C((1-rbrk)^1), "path") * rbrk
local field = (anum + S"+-.")^1 --- sic!
--- assignments are “lhs=rhs”
--- switches are “+key” | “-key”
-local assignment = C(field) * ws * equals * ws * (field / toboolean)
+local assignment = (field / strip_leading_sign) * ws
+ * equals * ws
+ * (field / toboolean)
local switch = P"+" * ws * C(field) * Cc(true)
+ P"-" * ws * C(field) * Cc(false)
+ C(field) * Cc(true) -- catch crap