summaryrefslogtreecommitdiff
path: root/luaotfload-database.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-11-05 17:15:26 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2013-11-05 17:15:26 +0100
commitbbb62449eb4d64284ec6f9c70663b43cb4945939 (patch)
treea756a3817a7221d719d10d31e50351b2c9156e2b /luaotfload-database.lua
parent58acd9e4271e17cd9d8073d4de69f6f68048adb4 (diff)
downloadluaotfload-bbb62449eb4d64284ec6f9c70663b43cb4945939.tar.gz
[db] add further synonyms for regular
Diffstat (limited to 'luaotfload-database.lua')
-rw-r--r--luaotfload-database.lua128
1 files changed, 64 insertions, 64 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 5c60046..aaba68d 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -521,57 +521,65 @@ load_lookups = function ( )
return data
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.
- ---
- --- 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 (variants):
- --- “regular”, “italic”, “bold”, and “bolditalic”. As a result,
- --- some of the styles are lumped together although they can differ
- --- significantly (like “medium” and “bold”).
-
- --- Xetex (XeTeXFontMgr.cpp) appears to recognize only “plain”,
- --- “normal”, and “roman” as synonyms for “regular”.
- local list = {
- regular = { "normal", "roman",
- "plain", "book",
- "light", "extralight",
- "ultralight", },
- bold = { "demi", "demibold",
- "semibold", "boldregular",
- "medium", "mediumbold",
- "ultrabold", "extrabold",
- "heavy", "black",
- "bold", },
- italic = { "regularitalic", "normalitalic",
- "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
-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.
+-- ---
+-- --- 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 (variants):
+-- --- “regular”, “italic”, “bold”, and “bolditalic”. As a result,
+-- --- some of the styles are lumped together although they can differ
+-- --- significantly (like “medium” and “bold”).
+--
+-- --- Xetex (XeTeXFontMgr.cpp) appears to recognize only “plain”,
+-- --- “normal”, and “roman” as synonyms for “regular”.
+-- local list = {
+-- regular = { "normal", "roman",
+-- "plain", "book",
+-- "light", "extralight",
+-- "ultralight", },
+-- bold = { "demi", "demibold",
+-- "semibold", "boldregular",
+-- "medium", "mediumbold",
+-- "ultrabold", "extrabold",
+-- "heavy", "black",
+-- "bold", },
+-- italic = { "regularitalic", "normalitalic",
+-- "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
+--end
+
+local regular_synonym = {
+ book = true,
+ normal = true,
+ plain = true,
+ regular = true,
+ roman = true,
+}
local type1_formats = { "tfm", "ofm", }
@@ -2908,19 +2916,11 @@ do
subfamily,
splitstyle)
- if fontstyle_name == "regular" or fontstyle_name == "book" then
- return "r"
- end
-
- if prefmodifiers == "regular" or prefmodifiers == "book" then
- return "r"
- end
-
- if subfamily == "regular" or subfamily == "book" then
- return "r"
- end
-
- if splitstyle == "regular" or splitstyle == "book" then
+ if regular_synonym [fontstyle_name]
+ or regular_synonym [prefmodifiers]
+ or regular_synonym [subfamily]
+ or regular_synonym [splitstyle]
+ then
return "r"
end