summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-04-19 20:02:33 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2016-04-19 20:02:33 +0200
commit4ef16976a192abb9bfe2bdc5144a994bc0d61e7b (patch)
tree2f4a9051d57f9df70c5f2c4645717dbe14823df7 /src
parentf73ce8ad37e9dab36d7aebf03198586691737afe (diff)
downloadluaotfload-4ef16976a192abb9bfe2bdc5144a994bc0d61e7b.tar.gz
[features] do not attempt to add features on incomplete fonts
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-features.lua26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/luaotfload-features.lua b/src/luaotfload-features.lua
index 79f1416..9c28fa1 100644
--- a/src/luaotfload-features.lua
+++ b/src/luaotfload-features.lua
@@ -1856,19 +1856,29 @@ end
otf.addfeature = add_otf_feature
local install_extra_features = function (data, filename, raw)
+ local metadata = data and data.metadata
+ if not metadata then
+ logreport ("both", 4, "features",
+ "no metadata received from font “%s”; not \z
+ installing extra features.", filename)
+ return
+ end
+ local format = data.format
+ if not format then
+ logreport ("both", 4, "features",
+ "no format info for font “%s”/“%s”; not \z
+ installing extra features.",
+ fontname, filename)
+ return
+ end
for feature, specification in next, extrafeatures do
- local fontname
- local subfont
- local metadata = data.metadata
- if metadata then
- fontname = tostring (data.metadata.fontname)
- subfont = tonumber (metadata.subfontindex)
- end
if not fontname then fontname = "<unknown>" end
if not subfont then subfont = -1 end
+ local fontname = tostring (data.metadata.fontname) or "<unknown>"
+ local subfont = tonumber (metadata.subfontindex) or -1
logreport ("both", 3, "features",
"register synthetic feature “%s” for %s font “%s”(%d)",
- feature, data.format, fontname, subfont)
+ feature, format, fontname, subfont)
otf.features.register { name = feature, description = specification[2] }
otf.enhancers.addfeature (data, feature, specification[1])
end