diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-04-19 22:28:25 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-04-19 22:28:36 +0200 |
commit | 2771c83b3ea53bef90e56f3befc16cc866799b31 (patch) | |
tree | 4f3f16941eadb4753f726d0dc5a90121b2a167cf /src | |
parent | dcda3d094e3052786527350add241c6084d7d68b (diff) | |
download | luaotfload-2771c83b3ea53bef90e56f3befc16cc866799b31.tar.gz |
[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.
Diffstat (limited to 'src')
-rw-r--r-- | src/luaotfload-auxiliary.lua | 9 |
1 files changed, 7 insertions, 2 deletions
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 |