diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-09-15 22:12:42 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-09-15 22:12:42 +0200 |
commit | cd5707a41b61198d0a53ab7cd4acbcc9240d0487 (patch) | |
tree | ba29611d3ab4b5b77f8fc20bca391ba15163f180 | |
parent | b3fa18a7d99d55d2daaeebd7f17db664719ef690 (diff) | |
download | luaotfload-cd5707a41b61198d0a53ab7cd4acbcc9240d0487.tar.gz |
[db] handle design sizes
-rw-r--r-- | luaotfload-database.lua | 32 |
1 files 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 |