From 144fd789860c459894159de0c6fafdf552c01a01 Mon Sep 17 00:00:00 2001 From: ezdiy Date: Sat, 24 Oct 2020 13:23:05 +0200 Subject: [PATCH] fontlist: Skip fonts with missing family_name (#6820) * Also don't trip on pipes --- frontend/fontlist.lua | 20 +++++++++++--------- frontend/util.lua | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/frontend/fontlist.lua b/frontend/fontlist.lua index 2cbd7eb22..2ce4f58df 100644 --- a/frontend/fontlist.lua +++ b/frontend/fontlist.lua @@ -117,15 +117,17 @@ local function collectFaceInfo(path) return nil end - local fres = face:getInfo() - local hbface = HB.hb_ft_face_create_referenced(face) - fres.names = hbface:getNames() - fres.scripts, fres.langs = hbface:getCoverage() - fres.path = path - fres.index = i - table.insert(res, fres) - - hbface:destroy() + -- If family_name is missing, it's probably too broken to be useful + if face.family_name ~= nil then + local fres = face:getInfo() + local hbface = HB.hb_ft_face_create_referenced(face) + fres.names = hbface:getNames() + fres.scripts, fres.langs = hbface:getCoverage() + fres.path = path + fres.index = i + table.insert(res, fres) + hbface:destroy() + end face:done() end return res diff --git a/frontend/util.lua b/frontend/util.lua index 9a27f2a6e..11f148513 100644 --- a/frontend/util.lua +++ b/frontend/util.lua @@ -594,7 +594,7 @@ function util.findFiles(dir, cb) if f ~= "." and f ~= ".." then scan(path) end - else + elseif attr.mode == "file" or attr.mode == "link" then cb(path, f, attr) end end