1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
%D \module
%D [ file=s-fnt-11,
%D version=2006.02.01, % or so
%D title=\CONTEXT\ Style File,
%D subtitle=Listing Installed Fonts,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
%D This code usd to be in the kernel but since it's hardly used
%D it's now a module.
%D
%D \starttyping
%D \showinstalledfonts[officinasans.*][all]
%D \showinstalledfonts[officinaserif.*][all]
%D \showinstalledfonts[officina.*itc.*][all]
%D
%D \showinstalledfonts[officina.*itc.*][all,new]
%D \stoptyping
\startluacode
function fonts.names.table(pattern,reload,all)
local t = fonts.names.list(pattern,reload)
if t then
local NC, NR, HL = context.NC, context.NR, context.HL
context.start()
context.nonknuthmode()
context.starttabulate { "|T|T|T|T|T|" }
NC(false,hashname)
NC(false,type)
NC(false,fontname)
NC(false,filename)
NC() NR() HL()
for v,tv in table.sortedpairs(t) do
local kind, name, file = tv[1], tv[2], tv[3]
if all or v == string.lower(name) then
if kind and name and file then
NC(false,v)
NC(false,kind)
NC(false,name)
NC(false,file)
NC() NR()
else
logs.report("font table", "skipping %s", v)
end
end
end
context.stoptabulate()
context.stop()
end
end
\stopluacode
\unprotect
\def\showinstalledfonts
{\dodoubleempty\doshowinstalledfonts}
\def\doshowinstalledfonts[#1][#2]%
{\bgroup
\def\pattern{#1}%
\def\all{false}%
\def\reload{false}%
\doifnothing\pattern{\def\pattern{.*}}%
\processallactionsinset[#2][\v!new=>\def\reload{true},\v!all=>\def\all{true}]%
\ctxlua{fonts.names.table("#1",\reload,\all)}%
\egroup}
\protect \endinput
|