From cb96f3ca17901a91c33119ae8ba9c3487188fb59 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Thu, 28 Jan 2010 07:48:20 +0200 Subject: Style synonyms This is a kind of style normalization; we first check the given style, if no match is found, we then check several, presumably, similar styles. --- otfl-font-dum.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'otfl-font-dum.lua') diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua index 81e7201..2bcc8ef 100644 --- a/otfl-font-dum.lua +++ b/otfl-font-dum.lua @@ -54,6 +54,12 @@ fonts.names.old_to_new = { } local data, loaded = nil, false +local synonyms = { + regular = {"normal", "roman", "plain", "book", "medium"}, + italic = {"regularitalic", "normalitalic", "oblique", "slant"}, + bolditalic = {"boldoblique", "boldslant"}, +} + local function sanitize(str) return string.gsub(string.lower(str), "[^%a%d]", "") end @@ -92,6 +98,17 @@ function fonts.names.resolve(specification) found = filename break end + else + if synonyms[style] then + for _,v in ipairs(synonyms[style]) do + if sanitize(subfamily) == v then + if not dsize or dsize == osize or dsize == ssize then + found = filename + break + end + end + end + end end end end -- cgit v1.2.3