summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-09-15 22:58:52 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-09-15 22:58:52 +0200
commitb8f01ab3aa15499ab7f883e9dfce47a235a3e9dd (patch)
treee83f0902ff988c82fa2b3c550243939ccc49b407
parent9ab1917e9b492abaef43a9d9a45ceba23391003f (diff)
downloadluaotfload-b8f01ab3aa15499ab7f883e9dfce47a235a3e9dd.tar.gz
[db] order design sizes
-rw-r--r--luaotfload-database.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index bb7f17e..6c52b5e 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -2791,6 +2791,27 @@ local collect_families = function (mappings)
return families
end
+local cmp_sizes = function (a, b)
+ return a [1] < b [1]
+end
+
+local order_design_sizes = function (families)
+
+ report ("info", 2, "db", "Ordering design sizes.")
+
+ for location, data in next, families do
+ for format, data in next, data do
+ for familyname, data in next, data do
+ for style, data in next, data do
+ tablesort (data, cmp_sizes)
+ end
+ end
+ end
+ end
+
+ return families
+end
+
local retrieve_namedata = function (currentnames,
targetnames,
dry_run,
@@ -3005,6 +3026,9 @@ update_names = function (currentnames, force, dry_run)
report ("both", 2, "db", "Updating the font names database"
.. (force and " forcefully" or ""))
+ --- pass 1 get raw data: read font files (normal case) or reuse
+ --- information present in index
+
if luaotfloadconfig.skip_read == true then
--- the difference to a “dry run” is that we don’t search
--- for font files entirely. we also ignore the “force”
@@ -3041,6 +3065,7 @@ update_names = function (currentnames, force, dry_run)
n_rawnames, n_newnames)
end
+ --- pass 2 (optional): collect some stats about the raw font info
if luaotfloadconfig.statistics == true then
targetnames.meta.statistics = collect_statistics
(targetnames.mappings)
@@ -3050,9 +3075,16 @@ update_names = function (currentnames, force, dry_run)
--- non-texmf entries are redirected there and the mapping
--- needs to be 100% consistent
+ --- pass 3: build filename table
targetnames.files = generate_filedata (targetnames.mappings)
+
+ --- pass 4: build family lookup table
targetnames.families = collect_families (targetnames.mappings)
+ --- pass 5: order design size tables
+ targetnames.families = order_design_sizes (targetnames.families)
+
+
report ("info", 3, "db",
"Rebuilt in %0.f ms.",
1000 * (osgettimeofday () - starttime))