From 2771c83b3ea53bef90e56f3befc16cc866799b31 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 19 Apr 2016 22:28:25 +0200 Subject: [aux] make fontname substitution more robust Another take on https://github.com/lualatex/luaotfload/issues/334 The parsing issues we aim to prevent occur with spaces because Luatex treats them as argument separators. Hence apply quoting only if necessary. Also use the appropriate format string as a defense against garbage inputs. --- src/luaotfload-auxiliary.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/luaotfload-auxiliary.lua b/src/luaotfload-auxiliary.lua index 58e4c59..3d300e7 100644 --- a/src/luaotfload-auxiliary.lua +++ b/src/luaotfload-auxiliary.lua @@ -42,9 +42,14 @@ local luaotfload_callbacks = { } --- https://github.com/khaledhosny/luaotfload/issues/54 local rewrite_fontname = function (tfmdata, specification) - local format = tfmdata.properties.format + local format = tfmdata.format or tfmdata.properties.format if format ~= "type1" then - tfmdata.name = [["]] .. specification .. [["]] + if stringfind (specification, " ") then + tfmdata.name = stringformat ("%q", specification) + else + --- other specs should parse just fine + tfmdata.name = specification + end end end -- cgit v1.2.3