summaryrefslogtreecommitdiff
path: root/luaotfload-database.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-11-13 00:32:35 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2013-11-13 00:32:35 +0100
commita914c23b674ff6bacb85a9701a828e03ec24cbc0 (patch)
tree8db9f9aef2cc694e4c494f7b75912795bb4357ef /luaotfload-database.lua
parent14834c9ea172588cc6cd4f111cdb16ce88ce2c2f (diff)
downloadluaotfload-a914c23b674ff6bacb85a9701a828e03ec24cbc0.tar.gz
[tool,man,db] add --max-fonts option to restrict db size
Diffstat (limited to 'luaotfload-database.lua')
-rw-r--r--luaotfload-database.lua24
1 files changed, 15 insertions, 9 deletions
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