From eb522f0f723c5ab94f43c72cce25d9ac6921a8d9 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 10 May 2013 01:08:31 +0200 Subject: reinstated deprecated paths in file: lookups --- luaotfload-features.lua | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'luaotfload-features.lua') diff --git a/luaotfload-features.lua b/luaotfload-features.lua index f91aee7..5e8216c 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -32,6 +32,7 @@ local old_feature_list = { } local report = logs.names_report +local stringfind = string.find local stringlower = string.lower local stringgsub = string.gsub local stringis_empty = string.is_empty @@ -215,10 +216,25 @@ local toboolean = function (s) return s end +--- dirty test if a file: request is actually a path: lookup; don’t +--- ask! +local check_garbage = function (_,i, garbage) + if stringfind(garbage, "/") then + report("log", 0, "load", --- ffs use path! + "warning: path in file: lookups is deprecated; ") + report("log", 0, "load", "use bracket syntax instead!") + report("log", 0, "load", + "position: %d; full match: “%s”", + i, garbage) + return true + end + return false +end + local lpegmatch = lpeg.match local P, S, R = lpeg.P, lpeg.S, lpeg.R -local C, Cc, Cf, Cg, Cs, Ct - = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Cs, lpeg.Ct +local C, Cc, Cf, Cg, Cmt, Cs, Ct + = lpeg.C, lpeg.Cc, lpeg.Cf, lpeg.Cg, lpeg.Cmt, lpeg.Cs, lpeg.Ct --- terminals and low-level classes ----------------------------------- --- note we could use the predefined ones from lpeg.patterns @@ -259,9 +275,17 @@ local modifier = slash * (other_modifier --> ignore local modifier_list = Cg(Ct(modifier^0), "modifiers") --- lookups ----------------------------------------------------------- -local fontname = C((1-S"/:(")^1) --- like luatex-fonts +local fontname = C((1-S":(/")^1) --- like luatex-fonts +local unsupported = Cmt((1-S":(")^1, check_garbage) local prefixed = P"name:" * ws * Cg(fontname, "name") - + P"file:" * ws * Cg(fontname, "file") +--- initially we intended file: to emulate the behavior of +--- luatex-fonts, i.e. no paths allowed. after all, we do have XeTeX +--- emulation with the path lookup and it interferes with db lookups. +--- turns out fontspec and other widely used packages rely on file: +--- with paths already, so we’ll add a less strict rule here. anyways, +--- we’ll emit a warning. + + P"file:" * ws * Cg(unsupported, "path") + + P"file:" * ws * Cg(fontname, "file") local unprefixed = Cg(fontname, "anon") local path_lookup = lbrk * Cg(C((1-rbrk)^1), "path") * rbrk -- cgit v1.2.3