diff options
author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2013-05-14 05:26:14 -0700 |
---|---|---|
committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2013-05-14 05:26:14 -0700 |
commit | 8a67b384a597b9af16ea915fe7e323d4328cdd3e (patch) | |
tree | 8aece7837bc522d9860996e5b543230d72ce99b6 /luaotfload-features.lua | |
parent | 718782c1cd45436cae846bb023733b01f1553866 (diff) | |
parent | 9dcbf9bdbbbf92152dd898cb1c117575fcd18171 (diff) | |
download | luaotfload-8a67b384a597b9af16ea915fe7e323d4328cdd3e.tar.gz |
Merge pull request #73 from phi-gamma/master
address issues #57 and #72
Diffstat (limited to 'luaotfload-features.lua')
-rw-r--r-- | luaotfload-features.lua | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/luaotfload-features.lua b/luaotfload-features.lua index 1c85dd7..39d4a88 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -1046,6 +1046,17 @@ local handle_slashed = function (modifiers) return style, optsize end +local extract_subfont +do + local eof = P(-1) + local digit = R"09" + --- Theoretically a valid subfont address can be up to seven + --- digits long. + local sub_expr = P"(" * C(digit^1) * P")" * eof + local full_path = C(P(1 - sub_expr)^1) + extract_subfont = full_path * sub_expr +end + --- spec -> spec local handle_request = function (specification) local request = lpegmatch(font_request, @@ -1055,11 +1066,27 @@ local handle_request = function (specification) --- in an anonymous lookup; --- we try to behave as friendly as possible --- just go with it ... - report("log", 0, "load", "invalid request ā%sā of type anon", + report("log", 1, "load", "invalid request ā%sā of type anon", specification.specification) - report("log", 0, "load", "use square bracket syntax or consult the documentation.") - specification.name = specification.specification - specification.lookup = "path" + report("log", 1, "load", + "use square bracket syntax or consult the documentation.") + --- The result of \fontname must be re-feedable into \font + --- which is expected by the Latex font mechanism. Now this + --- is complicated with TTC fonts that need to pass the + --- number of the requested subfont along with the file name. + --- Thus we test whether the request is a bare path only or + --- ends in a subfont expression (decimal digits inside + --- parentheses). + --- https://github.com/lualatex/luaotfload/issues/57 + local fullpath, sub = lpegmatch(extract_subfont, + specification.specification) + if fullpath and sub then + specification.sub = tonumber(sub) + specification.name = fullpath + else + specification.name = specification.specification + end + specification.lookup = "path" return specification end local lookup, name = select_lookup(request) |