From 0e51cff12b24d264b8e17d8bd7f9a00763699963 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 23 Jun 2013 22:23:12 +0200 Subject: treat subfamily match as exact, but not final match --- luaotfload-database.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 0903404..4554711 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -743,17 +743,15 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C fontname = fontname or sanitize_string(face.fontname) pfullname = pfullname or sanitize_string(face.fullname) - if name == family or name == metafamily then - if style == prefmodifiers then -- exact + if style == prefmodifiers then local continue exact, continue = add_to_match(exact, askedsize, face) if continue == false then break end - elseif prefmodifiers == "regular" then - --- TODO this match should be performed when building the db - fallback = face + elseif style == subfamily then + exact = add_to_match(exact, askedsize, face) elseif name == fullname or name == pfullname or name == fontname @@ -762,15 +760,16 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C local continue exact, continue = add_to_match(exact, askedsize, face) if continue == false then break end - elseif style == subfamily --- unreliable (see Ad. Garm. Pro) - or subfamily == "regular" - or synonym_set[style] and + elseif synonym_set[style] and (synonym_set[style][prefmodifiers] or synonym_set[style][subfamily]) or synonym_set.regular[prefmodifiers] or synonym_set.regular[subfamily] then synonymous = add_to_match(synonymous, askedsize, face) + elseif prefmodifiers == "regular" + or subfamily == "regular" then + fallback = face else --- mark as last straw but continue candidates[#candidates+1] = face end @@ -793,7 +792,6 @@ resolve = function (_, _, specification) -- the 1st two parameters are used by C found = synonymous end - --- this is a monster if #found == 1 then --- “found” is really synonymous with “registered in the db”. -- cgit v1.2.3