From cd5707a41b61198d0a53ab7cd4acbcc9240d0487 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 15 Sep 2013 22:12:42 +0200 Subject: [db] handle design sizes --- luaotfload-database.lua | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 5032955..d3f2f08 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -2457,7 +2457,7 @@ end local generate_filedata = function (mappings) - report ("both", 2, "db", "Creating filename map") + report ("both", 2, "db", "Creating filename map.") local nmappings = #mappings @@ -2685,6 +2685,8 @@ end local collect_families = function (mappings) + report ("info", 2, "db", "Analyzing families, sizes, and styles.") + local families = { ["local"] = { }, system = { }, @@ -2716,7 +2718,7 @@ local collect_families = function (mappings) local fontname = info.fontname local fontstyle_name = names.sanitized.fontstyle_name - local prefmodifiers = english.prefmodifiers or "regular" + local prefmodifiers = english.prefmodifiers local subfamily = english.subfamily local weight = style.weight @@ -2755,13 +2757,35 @@ local collect_families = function (mappings) if modifier then --- stub; here we will continue building a list of optical sizes --- no size -> hash “normal” - --- other sizes -> indexed tuples { dsnsize, idx } + --- other sizes -> indexed tuples { dsnsize, high, low, idx } local familytable = subtable [familyname] if not familytable then familytable = { } subtable [familyname] = familytable end - familytable [modifier] = entry.index + + --- the style table is treated as an unordered list + local styletable = familytable [modifier] + if not styletable then + styletable = { } + familytable [modifier] = styletable + end + + if not prefmodifiers then --- default size for this style/family combo + styletable.default = entry.index + end + + local size = style.size --- dsnsize * high * low + if size then + styletable [#styletable + 1] = { + size [1], + size [2], + size [3], + entry.index, + } + else + styletable.default = entry.index + end end end -- cgit v1.2.3