summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2010-01-28 07:48:20 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2010-01-28 15:48:27 +0200
commitcb96f3ca17901a91c33119ae8ba9c3487188fb59 (patch)
treef2caee9161394978563a28761a9459c5ac2e7962
parent3c7d9c8997c6bdb0539dc832fafccdf449878506 (diff)
downloadluaotfload-cb96f3ca17901a91c33119ae8ba9c3487188fb59.tar.gz
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.
-rw-r--r--otfl-font-dum.lua17
1 files changed, 17 insertions, 0 deletions
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