summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYan Zhou <zhouyan@me.com>2017-02-02 19:50:32 +0800
committerYan Zhou <zhouyan@me.com>2017-02-02 19:50:32 +0800
commit228e15f4a8452e3120e1fca4f5cdcda3bdf8bf82 (patch)
tree39ad9db4813ab8773fe51d1b70cc66c2d4a6a7fe /src
parent90acbbce3ff2b50929e18cb685961a1168f84075 (diff)
downloadluaotfload-228e15f4a8452e3120e1fca4f5cdcda3bdf8bf82.tar.gz
use design size to calculate the distance for `inrange`
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-database.lua11
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