summaryrefslogtreecommitdiff
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
parent1ae16ddf7fbfde3eafedcbe1800592221ab751f3 (diff)
parent6a572d507fc8ec31ab02da469b07f166ca3e1011 (diff)
downloadluaotfload-145f556ee90d4e46b897d5fac5a3d7387416f056.tar.gz
Merge pull request #80 from phi-gamma/master
fix issue #79
-rw-r--r--luaotfload-features.lua36
-rw-r--r--luaotfload.dtx10
2 files changed, 40 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
diff --git a/luaotfload.dtx b/luaotfload.dtx
index 9ed00b5..25fd8f0 100644
--- a/luaotfload.dtx
+++ b/luaotfload.dtx
@@ -1496,6 +1496,16 @@ if tex.luatexversion < luatex_version then
warning("LuaTeX v%.2f is old, v%.2f is recommended.",
tex.luatexversion/100,
luatex_version /100)
+ --- we install a fallback for older versions as a safety
+ if not node.end_of_math then
+ local math_t = node.id"math"
+ local traverse_nodes = node.traverse_id
+ node.end_of_math = function (n)
+ for n in traverse_nodes(math_t, n.next) do
+ return n
+ end
+ end
+ end
end
% \end{macrocode}