diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2010-01-14 18:45:25 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2010-01-15 08:28:18 +0200 |
commit | f4a8d67512cc4201188301d9ffb75b985a07e41d (patch) | |
tree | 48e940e3847790b99942b20faa134be5c4ff931e | |
parent | 5f4df7b29cab5afa15d2c691b69f5013119ac74c (diff) | |
download | luaotfload-f4a8d67512cc4201188301d9ffb75b985a07e41d.tar.gz |
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.
-rw-r--r-- | luaotfload-fonts.lua | 7 |
1 files changed, 5 insertions, 2 deletions
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 |