summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-04-27 22:26:01 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2016-04-27 22:58:32 +0200
commitd6b1caf014582edd216efab7ab47fd5193591ae3 (patch)
tree96a7ffc86f613d8a298912120820e4b4b857b00e /src
parent05c1a1f336a3148f9f8e3b02e3944deaebb0357f (diff)
downloadluaotfload-d6b1caf014582edd216efab7ab47fd5193591ae3.tar.gz
[db] restrict bold style fallback heuristic
@dohyunkim pointed out that due to the too broad criteria, secondary style variants like “heavy”, “black” ended up getting picked over the actual “bold”.
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-database.lua22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index 0c2fd40..437091f 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -2608,8 +2608,17 @@ do
end
pick_fallback_style = function (italicangle, weight, pfmweight)
- --- more aggressive, but only to determine bold faces
- if pfmweight == bold_weight or bold_synonym [weight] then --- bold spectrum matches
+ --[[--
+ More aggressive, but only to determine bold faces.
+ Note: Before you make this test more inclusive, ensure
+ no fonts are matched in the bold synonym spectrum over
+ a literally “bold[italic]” one. In the past, heuristics
+ been tried but ultimately caused unwanted modifiers
+ polluting the lookup table. What doesn’t work is, e. g.
+ treating weights > 500 as bold or allowing synonyms like
+ “heavy”, “black”.
+ --]]--
+ if pfmweight == bold_weight then --- bold spectrum matches
if italicangle == 0 then
return "b"
end
@@ -2753,13 +2762,12 @@ local collect_families = function (mappings)
pfmweight)
end
+ if not modifier then
+ modifier = pick_fallback_style (italicangle, weight, pfmweight)
+ end
+
if modifier then
add_family (familyname, subtable, modifier, entry)
- elseif pfmweight >= bold_spectrum_low then -- in bold spectrum
- modifier = pick_fallback_style (italicangle, weight, pfmweight)
- if modifier then
- add_family (familyname, subtable, modifier, entry)
- end
end
end