diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-10-02 23:41:59 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-10-02 23:41:59 +0200 |
commit | 551c89289d267c2d8901f3375e57ed1fe2508de5 (patch) | |
tree | 937be4d873b1762d93fcce75ecca3cfea07b2ca4 /tex/context/modules/mkiv/s-fonts-system.lua | |
parent | e3ad6b783e6162de6dad5531299e69c3d3079b9c (diff) | |
download | context-551c89289d267c2d8901f3375e57ed1fe2508de5.tar.gz |
2018-10-02 23:25:00
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 |