diff options
Diffstat (limited to 'tex/context/modules/mkiv/s-fonts-system.lua')
-rw-r--r-- | tex/context/modules/mkiv/s-fonts-system.lua | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/tex/context/modules/mkiv/s-fonts-system.lua b/tex/context/modules/mkiv/s-fonts-system.lua index 5b58a4a53..b91b3e75d 100644 --- a/tex/context/modules/mkiv/s-fonts-system.lua +++ b/tex/context/modules/mkiv/s-fonts-system.lua @@ -36,8 +36,7 @@ local context = context local NC, NR, HL = context.NC, context.NR, context.HL local bold = context.bold -function moduledata.fonts.system.showinstalled(specification) - specification = interfaces.checkedspecification(specification) +local function allfiles(specification) local pattern = lower(specification.pattern or "") local list = fonts.names.list(pattern,false,true) if list then @@ -45,6 +44,14 @@ function moduledata.fonts.system.showinstalled(specification) for k, v in next, list do files[file.basename(string.lower(v.filename))] = v end + return files + end +end + +function moduledata.fonts.system.showinstalled(specification) + specification = interfaces.checkedspecification(specification) + local files = allfiles(specification) + if files then context.starttabulate { "|Tl|Tl|Tl|Tl|Tl|Tl|" } HL() NC() bold("filename") @@ -67,3 +74,31 @@ function moduledata.fonts.system.showinstalled(specification) context.stoptabulate() end end + +function moduledata.fonts.system.cacheinstalled(specification) + specification = interfaces.checkedspecification(specification) + local files = allfiles(specification) + if files then + local threshold = tonumber(specification.threshold) + for filename, data in table.sortedpairs(files) do + if string.find(filename," ") then + -- skip this one + else + local s = file.suffix(filename) + if s == "otf" or s == "ttf" then + local fullname = resolvers.findfile(filename) + context.start() + context.type(fullname) + context.par() + if threshold and file.size(fullname) > threshold then + logs.report("fonts","ignoring : %s",fullname) + else + logs.report("fonts","caching : %s",fullname) + context.definedfont { filename } + end + context.stop() + end + end + end + end +end |