From 34774e11c1d67860db9cc6812af49c1df1761eb6 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Tue, 2 Feb 2010 22:05:24 +0200 Subject: Support design size ranges --- otfl-font-dum.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/otfl-font-dum.lua b/otfl-font-dum.lua index 2bcc8ef..2cc8aeb 100644 --- a/otfl-font-dum.lua +++ b/otfl-font-dum.lua @@ -86,15 +86,14 @@ function fonts.names.resolve(specification) for _,v in ipairs(family) do local face = data.mappings[v] local subfamily = face.names.subfamily - local dsize = face.size[1] and face.size[1] / 10 - local ssize = specification.size and specification.size / 65536 - local osize = tonumber(specification.optsize) - local maxsize = face.design_range_bottom - local minsize = face.design_range_top + local rqssize = tonumber(specification.optsize) or specification.size and specification.size / 65536 + local dsnsize = face.size[1] and face.size[1] / 10 + local maxsize = face.size[2] and face.size[2] / 10 + local minsize = face.size[3] and face.size[3] / 10 local filename = face.filename if subfamily then if sanitize(subfamily) == style then - if not dsize or dsize == osize or dsize == ssize then + if not dsnsize or dsnsize == rqssize or (rqssize > minsize and rqssize <= maxsize) then found = filename break end @@ -102,7 +101,7 @@ function fonts.names.resolve(specification) if synonyms[style] then for _,v in ipairs(synonyms[style]) do if sanitize(subfamily) == v then - if not dsize or dsize == osize or dsize == ssize then + if not dsnsize or dsnsize == rqssize or (rqssize > minsize and rqssize <= maxsize) then found = filename break end -- cgit v1.2.3