From 28ccc96aebdab61174f667df5a343ba051dacbcf Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Mon, 26 Aug 2013 11:09:18 +0200 Subject: [db] make approximate matching operate on fullname field --- luaotfload-database.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 9bf6823..755ad52 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -1112,20 +1112,20 @@ find_closest = function (name, limit) local cnames = current.sanitized --[[ This is simplistic but surpisingly fast. - Matching is performed against the “family” name - of a db record. We then store its “fullname” at - it edit distance. + Matching is performed against the “fullname” field + of a db record in preprocessed form. We then store the + raw “fullname” at its edit distance. We should probably do some weighting over all the font name categories as well as whatever agrep does. --]] if cnames then - local fullname, family = cnames.fullname, cnames.family + local fullname, sfullname = current.fullname, cnames.fullname - local dist = cached[family]--- maybe already calculated + local dist = cached[sfullname]--- maybe already calculated if not dist then - dist = iterative_levenshtein(name, family) - cached[family] = dist + dist = iterative_levenshtein(name, sfullname) + cached[sfullname] = dist end local namelst = by_distance[dist] if not namelst then --- first entry -- cgit v1.2.3