summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-06-23 00:38:44 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-06-23 00:38:44 +0200
commit310fa29531fd6003ed840165b8041105827040cb (patch)
treec25651ebb6d807abe78ee8633e750626284fe5d8
parentbd0a8039e89b9403b58ac5a9827a333276a6fbf6 (diff)
downloadluaotfload-310fa29531fd6003ed840165b8041105827040cb.tar.gz
refine list of style synonyms
-rw-r--r--luaotfload-database.lua43
1 files changed, 35 insertions, 8 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 4c45d21..f374617 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -326,22 +326,49 @@ end
local style_synonyms = { set = { } }
do
+ local combine = function (ta, tb)
+ local result = { }
+ for i=1, #ta do
+ for j=1, #tb do
+ result[#result+1] = ta[i] .. tb[j]
+ end
+ end
+ return result
+ end
+
--- read this: http://blogs.adobe.com/typblography/2008/05/indesign_font_conflicts.html
--- tl;dr: font style synonyms are unreliable.
- style_synonyms.list = {
+ ---
+ --- Context matches font names against lists of known identifiers
+ --- for weight, style, width, and variant, so that including
+ --- the family name there are five dimensions for choosing a
+ --- match. The sad thing is, while this is a decent heuristic it
+ --- makes no sense to imitate it in luaotfload because the user
+ --- interface must fit into the much more limited Xetex scheme that
+ --- distinguishes between merely four style categories: “regular”,
+ --- “italic”, “bold”, and “bolditalic”. As a result, some of the
+ --- styles are lumped together although they can differ
+ --- significantly (like “medium” and “bold”).
+
+ local list = {
regular = { "normal", "roman",
- "plain", "book", },
+ "plain", "book",
+ "light", "extralight",
+ "ultralight", },
bold = { "demi", "demibold",
"semibold", "boldregular",
- "medium" },
+ "medium", "mediumbold",
+ "ultrabold", "extrabold",
+ "heavy", "black",
+ "bold", },
italic = { "regularitalic", "normalitalic",
- "oblique", "slanted", },
- bolditalic = { "boldoblique", "boldslanted",
- "demiitalic", "demioblique",
- "demislanted", "demibolditalic",
- "semibolditalic", },
+ "oblique", "slanted",
+ "italic", },
}
+ list.bolditalic = combine(list.bold, list.italic)
+ style_synonyms.list = list
+
for category, synonyms in next, style_synonyms.list do
style_synonyms.set[category] = tabletohash(synonyms, true)
end