diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-30 02:33:21 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-30 02:33:21 +0200 |
commit | 54c49bfbc560fccaaf0330221e7af6d9153122cb (patch) | |
tree | 7b1d32a3d34e40bf80f38cd6d0cf44ae6695ef5f /luaotfload-database.lua | |
parent | 49ed6facc71c3db519d5baa3723090e086d832aa (diff) | |
download | luaotfload-54c49bfbc560fccaaf0330221e7af6d9153122cb.tar.gz |
collect second-tier candidates when matching fontnames
Diffstat (limited to 'luaotfload-database.lua')
-rw-r--r-- | luaotfload-database.lua | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 4e7d5fb..d5e2a7b 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -611,9 +611,11 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con return specification.name, false, false end - local found = { } + local found = { } --> collect results + local candidates = { } --> secondary results, incomplete matches + local synonym_set = style_synonyms.set - for _, face in next, data.mappings do + for n, face in next, data.mappings do local family, subfamily, fullname, psname, fontname, pfullname local facenames = face.sanitized @@ -653,6 +655,7 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con minsize, maxsize, face) if continue == false then break end elseif subfamily == "regular" or + --- TODO this match should be performed when building the db synonym_set.regular[subfamily] then found.fallback = face elseif name == fullname @@ -665,6 +668,8 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con found, optsize, dsnsize, size, minsize, maxsize, face) if continue == false then break end + else --- mark as last straw but continue + candidates[#candidates+1] = face end else if name == fullname @@ -717,6 +722,17 @@ resolve = function (_,_,specification) -- the 1st two parameters are used by Con return found.fallback.filename[1], found.fallback.filename[2], true + elseif next(candidates) then + --- pick the first candidate encountered + local entry = candidates[1] + local filename = entry.filename[1] + if is_file(filename, entry.texmf) then + report("log", 0, "resolve", + "font family='%s', subfamily='%s' found: %s", + name, style, filename + ) + return filename, entry.filename[2], true + end end --- no font found so far |