From f4a8d67512cc4201188301d9ffb75b985a07e41d Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Thu, 14 Jan 2010 18:45:25 +0200 Subject: Sanitize font names Remove spaces, hyphens etc. so that we don't have to deal with many irregularities. Now I seem to process all fonts included with TeXlive correctly, and my +2000 files font collection with two errors only. --- luaotfload-fonts.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'luaotfload-fonts.lua') diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua index 431cc55..df019c6 100644 --- a/luaotfload-fonts.lua +++ b/luaotfload-fonts.lua @@ -32,7 +32,7 @@ local function info(...) logs.simple(...) end -local function clean(str) +local function sanitize(str) return string.gsub(string.lower(str), "[^%a%d]", "") end @@ -92,6 +92,9 @@ function fontloader.fullinfo(filename, subfont) if not t.style or t.style:is_empty() then t.style = "Regular" end + for k,v in pairs(t) do + t[k] = sanitize(v) + end -- tprint(m) print(w) m, n = nil, nil return t @@ -115,7 +118,7 @@ local function load_font(filename, names, texmf) local fullinfo = fontloader.fullinfo(filename) if texmf == true then filename = basename(filename) - end + end if not families[fullinfo.family] then families[fullinfo.family] = { } end -- cgit v1.2.3