diff --git a/luametalatex-font-sfnt.lua b/luametalatex-font-sfnt.lua index 9c6de8b..5e45fcb 100644 --- a/luametalatex-font-sfnt.lua +++ b/luametalatex-font-sfnt.lua @@ -41,7 +41,7 @@ return { write = function(magic, tables) local tabdata = {} for t, val in next, tables do - tabdata[#tabdata+1] = {t, val .. string.rep("\0", (#val+3&~3)-#val), #val} + tabdata[#tabdata+1] = {string.format("%-4s", t), val .. string.rep("\0", (#val+3&~3)-#val), #val} end table.sort(tabdata, function(a,b)return a[1] "^"" The ^ is for cmd escaping, the """ is for command line splitting escaping, -- backslashes still have to be escaped, but only in front of " or \ + -- Additionally, "%" always as to be escaped for some variable substitution + -- pass before everything else. -- WARNING: This works with luametatex's argument splitting, but don't generally rely -- on it for other Windows programs. There are two standard Windows ways which are incompatible... - escape = '\\' * #l.S'\\"' * l.Cc'\\' + '"' * l.Cc'^""' + 1 + escape = '\\' * #l.S'\\"' * l.Cc'\\' + '"' * l.Cc'^""' + '%' * l.Cc'%' + 1 else -- POSIX: We escape with single quotes, so only single quotes need escaping escape = "'" * l.Cc"\\''" + 1 @@ -45,7 +47,8 @@ local kpse_call = io.popen(string.format("kpsewhich -progname%s -format lua -all local file repeat file = kpse_call:read() -until not file:match('^%.') +until not assert(file, "Unable to find initialization script. Aborting."):match('^%.') + if not kpse_call:close() then error(file) end