summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2017-02-10 22:33:27 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2017-02-10 22:33:27 +0100
commit5711c3b96a11549233afd9bfcbfea16189321525 (patch)
tree1fe4c0bf33f038737f6bf6814d864d01298896ca /src
parent46b9e82b9ec5f02db1fd326115a337142e97fed0 (diff)
downloadluaotfload-5711c3b96a11549233afd9bfcbfea16189321525.tar.gz
[parsers] extend definition grammar to allow for subfonts in path lookups
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-parsers.lua33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/luaotfload-parsers.lua b/src/luaotfload-parsers.lua
index c2b4f2e..8c297ac 100644
--- a/src/luaotfload-parsers.lua
+++ b/src/luaotfload-parsers.lua
@@ -602,6 +602,22 @@ local combodef1 = Ct(comboidx * combomapsep * comboid) --> no chars
local combodef = Ct(comboidx * combomapsep * comboidchars)
local combolist = Ct(combodef1 * (comborowsep * combodef)^1)
+--- subfonts ----------------------------------------------------------
+--- This rule is present in the original parser. It sets the “sub”
+--- field of the specification which allows addressing a specific
+--- font inside a TTC container. Neither in Luatex-Fonts nor in
+--- Luaotfload is this documented, so we might as well silently drop
+--- it. However, as backward compatibility is one of our prime goals we
+--- just insert it here and leave it undocumented until someone cares
+--- to ask. (Note: afair subfonts are numbered, but this rule matches a
+--- string; I won’t mess with it though until someone reports a
+--- problem.)
+--- local subvalue = P("(") * (C(P(1-S("()"))^1)/issub) * P(")") -- for Kim
+--- Note to self: subfonts apparently start at index 0. Tested with
+--- Cambria.ttc that includes “Cambria Math” at 0 and “Cambria” at 1.
+--- Other values cause luatex to segfault.
+local subfont = P"(" * Cg((1 - S"()")^1, "sub") * P")"
+
--- lookups -----------------------------------------------------------
local fontname = C((1-S":(/")^1) --- like luatex-fonts
local unsupported = Cmt((1-S":(")^1, check_garbage)
@@ -619,6 +635,7 @@ local prefixed = P"name:" * ws * Cg(fontname, "name")
+ P"my:" * ws * Cg(fontname, "my")
local unprefixed = Cg(fontname, "anon")
local path_lookup = lbrk * Cg(C((1-rbrk)^1), "path") * rbrk
+ * subfont^-1
--- features ----------------------------------------------------------
local field_char = anum + S"+-.!?" --- sic!
@@ -644,22 +661,6 @@ local feature_list = Cf(Ct""
* (featuresep * option^-1)^0
, rawset)
* featuresep^-1
-
---- other -------------------------------------------------------------
---- This rule is present in the original parser. It sets the “sub”
---- field of the specification which allows addressing a specific
---- font inside a TTC container. Neither in Luatex-Fonts nor in
---- Luaotfload is this documented, so we might as well silently drop
---- it. However, as backward compatibility is one of our prime goals we
---- just insert it here and leave it undocumented until someone cares
---- to ask. (Note: afair subfonts are numbered, but this rule matches a
---- string; I won’t mess with it though until someone reports a
---- problem.)
---- local subvalue = P("(") * (C(P(1-S("()"))^1)/issub) * P(")") -- for Kim
---- Note to self: subfonts apparently start at index 0. Tested with
---- Cambria.ttc that includes “Cambria Math” at 0 and “Cambria” at 1.
---- Other values cause luatex to segfault.
-local subfont = P"(" * Cg((1 - S"()")^1, "sub") * P")"
--- top-level rules ---------------------------------------------------
--- \font\foo=<specification>:<features>
local features = Cg(feature_list, "features")