summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/font-log.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/font-log.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/font-log.lua74
1 files changed, 48 insertions, 26 deletions
diff --git a/Master/texmf-dist/tex/context/base/font-log.lua b/Master/texmf-dist/tex/context/base/font-log.lua
index 97cb4ff7c1a..8bc12a2159a 100644
--- a/Master/texmf-dist/tex/context/base/font-log.lua
+++ b/Master/texmf-dist/tex/context/base/font-log.lua
@@ -8,9 +8,16 @@ if not modules then modules = { } end modules ['font-log'] = {
local next, format, lower, concat = next, string.format, string.lower, table.concat
-local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end)
+local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end)
+local report_defining = logs.reporter("fonts","defining")
-fonts.logger = fonts.logger or { }
+local basename = file.basename
+
+local fonts = fonts
+local loggers = { }
+fonts.loggers = loggers
+local usedfonts = utilities.storage.allocate()
+----- loadedfonts = utilities.storage.allocate()
--[[ldx--
<p>The following functions are used for reporting about the fonts
@@ -19,40 +26,55 @@ we now have several readers it may be handy to know what reader is
used for which font.</p>
--ldx]]--
-function fonts.logger.save(tfmtable,source,specification) -- save file name in spec here ! ! ! ! ! !
- if tfmtable and specification and specification.specification then
- local name = lower(specification.name)
- if trace_defining and not fonts.used[name] then
- logs.report("define font","registering %s as %s (used: %s)",file.basename(specification.name),source,file.basename(specification.filename))
+function loggers.onetimemessage(font,char,message,reporter)
+ local tfmdata = fonts.hashes.identifiers[font]
+ local shared = tfmdata.shared
+ local messages = shared.messages
+ if not messages then
+ messages = { }
+ shared.messages = messages
+ end
+ local category = messages[message]
+ if not category then
+ category = { }
+ messages[message] = category
+ end
+ if not category[char] then
+ if not reporter then
+ reporter = report_defining
end
- specification.source = source
- fonts.loaded[lower(specification.specification)] = specification
- -- fonts.used[name] = source
- fonts.used[lower(specification.filename or specification.name)] = source
+ reporter("char U+%05X in font '%s' with id %s: %s",char,tfmdata.properties.fullname,font,message)
+ category[char] = true
end
end
-function fonts.logger.report(complete)
- local t = { }
- for name, used in table.sortedhash(fonts.used) do
- if complete then
- t[#t+1] = used .. "->" .. file.basename(name)
- else
- t[#t+1] = file.basename(name)
+function loggers.register(tfmdata,source,specification) -- save file name in spec here ! ! ! ! ! !
+ if tfmdata and specification and specification.specification then
+ local name = lower(specification.name)
+ if trace_defining and not usedfonts[name] then
+ report_defining("registering %s as %s (used: %s)",file.basename(specification.name),source,file.basename(specification.filename))
end
+ specification.source = source
+ -- loadedfonts[lower(specification.specification)] = specification
+ usedfonts[lower(specification.filename or specification.name)] = source
end
- return t
end
-function fonts.logger.format(name)
- return fonts.used[name] or "unknown"
+function loggers.format(name) -- should be avoided
+ return usedfonts[name] or "unknown"
end
statistics.register("loaded fonts", function()
- if next(fonts.used) then
- local t = fonts.logger.report()
- return (#t > 0 and format("%s files: %s",#t,concat(t,separator or " "))) or "none"
- else
- return nil
+ if next(usedfonts) then
+ local t, n = { }, 0
+ for name, used in table.sortedhash(usedfonts) do
+ n = n + 1
+ if complete then
+ t[n] = used .. "->" .. basename(name)
+ else
+ t[n] = basename(name)
+ end
+ end
+ return (n > 0 and format("%s files: %s",n,concat(t," "))) or "none"
end
end)