summaryrefslogtreecommitdiff
path: root/luaotfload-database.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-08-26 11:09:18 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-08-26 11:09:18 +0200
commit28ccc96aebdab61174f667df5a343ba051dacbcf (patch)
tree3188857d7a8a883cf2c301565fabd98601721c09 /luaotfload-database.lua
parent8da961e02fd2a9443f243828ae1af6074cdfe90e (diff)
downloadluaotfload-28ccc96aebdab61174f667df5a343ba051dacbcf.tar.gz
[db] make approximate matching operate on fullname field
Diffstat (limited to 'luaotfload-database.lua')
-rw-r--r--luaotfload-database.lua14
1 files 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