diff options
-rw-r--r-- | src/luaotfload-database.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 5e4fd7a..c494318 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -938,10 +938,19 @@ local choose_size = function (sizes, askedsize) norange [#norange + 1] = { d, index } else --- range match - local d = ((low + high) / 2) - askedsize + local d = 0 + + -- should always be true. Just in case there's some + -- weried fonts out there + if dsnsize > low and dsnsize < high then + d = dsnsize - askedsize + else + d = ((low + high) / 2) - askedsize + end if d < 0 then d = -d end + inrange [#inrange + 1] = { d, index } end end |