summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2017-02-02 23:06:14 +0100
committerPhilipp Gesang <phg@phi-gamma.net>2017-02-02 23:06:14 +0100
commitaf4355dc4406482a04b0a23a44969f55fcb0de37 (patch)
tree38231325d39a0f6dd5868033528a365abc428b6c /src
parenta3a28ee74faca63bbba07e045906a36b4e967e98 (diff)
parent228e15f4a8452e3120e1fca4f5cdcda3bdf8bf82 (diff)
downloadluaotfload-af4355dc4406482a04b0a23a44969f55fcb0de37.tar.gz
Merge remote-tracking branch 'canonical/pr/402'
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 e8d6e7b..199eca8 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