From a914c23b674ff6bacb85a9701a828e03ec24cbc0 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 13 Nov 2013 00:32:35 +0100 Subject: [tool,man,db] add --max-fonts option to restrict db size --- luaotfload-database.lua | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'luaotfload-database.lua') diff --git a/luaotfload-database.lua b/luaotfload-database.lua index a12cdd1..4ee07f4 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -533,6 +533,7 @@ local set_font_filter --- state of the database local fonts_reloaded = false +local fonts_read = 0 --- limit output when approximate font matching (luaotfload-tool -F) local fuzzy_limit = 1 --- display closest only @@ -2112,15 +2113,20 @@ local scan_dir = function (dirname, currentnames, targetnames, local fullname = found[j] fullname = path_normalize(fullname) local new - if dry_run == true then - report_status ("both", "db", - "Would have been loading %q", fullname) - else - report_status ("both", "db", "Loading font %q", fullname) - local new = read_font_names (fullname, currentnames, - targetnames, texmf) - if new == true then - n_new = n_new + 1 + if not luaotfloadconfig.max_fonts + or luaotfloadconfig.max_fonts and fonts_read < luaotfloadconfig.max_fonts + then + if dry_run == true then + report_status ("both", "db", + "Would have been loading %q", fullname) + else + report_status ("both", "db", "Loading font %q", fullname) + local new = read_font_names (fullname, currentnames, + targetnames, texmf) + if new == true then + fonts_read = fonts_read + 1 + n_new = n_new + 1 + end end end end -- cgit v1.2.3