diff options
Diffstat (limited to 'otfl-font-nms.lua')
-rw-r--r-- | otfl-font-nms.lua | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index d708f5b..935500c 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -37,6 +37,14 @@ local function sanitize(str) end end +local function fontnames_init() + return { + mappings = { }, + status = { }, + version = names.version, + } +end + function names.load() local localpath = names.path.localdir .. names.path.basename local systempath = names.path.systemdir .. names.path.basename @@ -55,8 +63,15 @@ function names.load() "loaded font names database: %s", foundname) end - return data + else + logs.report("load font", + "no font names database found, generating new one") + local fontnames = fontnames_init() + local savepath = names.path.localdir .. names.path.basename + data = names.update(fontnames, false) + io.savedata(savepath, table.serialize(data, true)) end + return data end local loaded = false @@ -81,10 +96,6 @@ local synonyms = { }, } --- a small hack to get the log message "no font names database loaded" only --- once in the log -local log_message_shown = false - function names.resolve(specification) local tfm = resolvers.find_file(specification.name, "ofm") local name = sanitize(specification.name) @@ -197,9 +208,6 @@ function names.resolve(specification) -- no font found so far, fallback to filename return specification.name, false end - elseif not log_message_shown then - logs.report("load font", "no font names database loaded") - log_message_shown = true end end @@ -517,14 +525,6 @@ local function scan_os_fonts(fontnames, newfontnames) end end -local function fontnames_init() - return { - mappings = { }, - status = { }, - version = names.version, - } -end - local function update(fontnames, force) --[[ The main function, scans everything |