summaryrefslogtreecommitdiff
path: root/luaotfload-database.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-08-04 09:58:23 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-08-04 09:58:23 +0200
commita0d59a1cf91675a18f7062e11053aedf52585b2d (patch)
treebdcec2940d69550af8316445123b9d1d247d6d65 /luaotfload-database.lua
parent51ac04816f89f7d38ce499d3ce81b34621e1869e (diff)
downloadluaotfload-a0d59a1cf91675a18f7062e11053aedf52585b2d.tar.gz
[db] pre-resolve style synonyms when matching
Diffstat (limited to 'luaotfload-database.lua')
-rw-r--r--luaotfload-database.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 8da0713..0fbbd44 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -823,12 +823,15 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C
return specification.name, false, false
end
+ local synonym_set = style_synonyms.set
+ local stylesynonyms = synonym_set[style]
+ local regularsynonyms = synonym_set.regular
+
local exact = { } --> collect exact style matches
local synonymous = { } --> collect matching style synonyms
local fallback --> e.g. non-matching style (fontspec is anal about this)
local candidates = { } --> secondary results, incomplete matches
- local synonym_set = style_synonyms.set
for n, face in next, data.mappings do
local family, subfamily, fullname, prefmodifiers
local psname, fontname, pfullname, metafamily
@@ -856,8 +859,8 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C
if continue == false then break end
elseif style == subfamily then
exact = add_to_match(exact, askedsize, face)
- elseif synonym_set[style] and synonym_set[style][prefmodifiers]
- or synonym_set.regular[prefmodifiers]
+ elseif stylesynonyms and stylesynonyms[prefmodifiers]
+ or regularsynonyms[prefmodifiers]
then
--- treat synonyms for prefmodifiers as first-class
--- (needed to prioritize DejaVu Book over Condensed)
@@ -868,8 +871,8 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C
or name == psname
then
synonymous = add_to_match(synonymous, askedsize, face)
- elseif synonym_set[style] and synonym_set[style][subfamily]
- or synonym_set.regular[subfamily]
+ elseif stylesynonyms and stylesynonyms[subfamily]
+ or regularsynonyms[subfamily]
then
synonymous = add_to_match(synonymous, askedsize, face)
elseif prefmodifiers == "regular"