diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-04-28 16:04:05 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-04-28 16:04:05 +0200 |
commit | 98147cdc664312aa287a46a6d64c0e8fa86ebdbc (patch) | |
tree | 4f63bdefef7f3a959a030a8d59b5ad0b6f3871e5 /luaotfload-features.lua | |
parent | 2a4159410151fa9c99adaf56071a370bcb261ac1 (diff) | |
download | luaotfload-98147cdc664312aa287a46a6d64c0e8fa86ebdbc.tar.gz |
add the subfont selector patter into new syntax (hidden goodie?)
Diffstat (limited to 'luaotfload-features.lua')
-rw-r--r-- | luaotfload-features.lua | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/luaotfload-features.lua b/luaotfload-features.lua index c939a3f..08414f6 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -384,10 +384,28 @@ local feature_list = Cf(Ct"" , 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 +--- Who’s 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") -local specification = (prefixed + unprefixed) * modifier_list^-1 +local specification = (prefixed + unprefixed) + * subfont^-1 + * modifier_list^-1 local font_request = Ct(path_lookup * (colon^-1 * features)^-1 + specification * (colon * features)^-1) @@ -449,6 +467,7 @@ local handle_request = function (specification) local feat = import_values[n] local newvalue = request.features[feat] if newvalue then + print(feat, newvalue) specification[feat] = request.features[feat] request.features[feat] = nil end @@ -467,11 +486,11 @@ local compare_requests = function (spec) return new end -fonts.definers.registersplit(":", compare_requests, "cryptic") -fonts.definers.registersplit("", compare_requests, "more cryptic") -- catches \font\text=[names] +--fonts.definers.registersplit(":", compare_requests, "cryptic") +--fonts.definers.registersplit("", compare_requests, "more cryptic") -- catches \font\text=[names] ---fonts.definers.registersplit(":", handle_request, "cryptic") ---fonts.definers.registersplit("", handle_request, "more cryptic") -- catches \font\text=[names] +fonts.definers.registersplit(":", handle_request, "cryptic") +fonts.definers.registersplit("", handle_request, "more cryptic") -- catches \font\text=[names] --fonts.definers.registersplit(":",old_behavior,"cryptic") --fonts.definers.registersplit("", old_behavior,"more cryptic") -- catches \font\text=[names] |