1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16\startluacode
17 function commands.showsymbolset(collection,symbols,fontid)
18 if type(symbols) == "string" then
19 symbols = utilities.parsers.settings_to_array(symbols)
20 end
21 local options = { framecolor = "orange", rulethickness = ".8pt", offset = interfaces.variables.overlay }
22 local list = table.tohash(symbols)
23 local alsofont = fontid > 0
24 local defined = #symbols > 0
25 local byname = false
26 if alsofont then
27 local is_symbol = characters.is_symbol
28 local chardata = characters.data
29 local resources = fonts.hashes.resources [fontid]
30 local characters = fonts.hashes.characters[fontid]
31 if resources and characters then
32 local unicodes = resources.unicodes
33 if unicodes then
34 for name, unicode in next, unicodes do
35 if not list[name] and name ~= ".notdef" then
36 local c = rawget(chardata,unicode)
37 if not c or is_symbol[c.category] then
38 list[name] = false
39 byname = true
40 end
41 end
42 end
43 end
44 end
45 end
46 local detail = defined and byname
47 context.start()
48 context.setupsymbolset { collection }
49 context.starttabulate { detail and "|lT|l|l|lT|" or "|lT|l|l|"}
50 for symbol, how in table.sortedhash(list) do
51 if detail and how then
52 context.BC()
53 else
54 context.NC()
55 end
56 context(symbol)
57 context.NC()
58 context.symbol(symbol)
59 context.NC()
60 context.framed(options,context.nested.symbol(symbol))
61 if detail and how then
62 context.BC()
63 context("defined")
64 else
65 context.NC()
66 end
67 context.NC()
68 context.NR()
69 end
70 context.stoptabulate()
71 context.stop()
72 end
73\stopluacode
74
75\unprotect
76
77\permanent\protected\tolerant\gdef\showsymbolset[#1]
78 {\begingroup
79 \edef\p_font{\begincsname\??symboldefault#1\endcsname}
80 \begingroup
81 \ifx\p_font\empty
82 \global\globalscratchcounter\zerocount
83 \else
84 \definedfont[\p_font]
85 \global\globalscratchcounter\fontid\font\relax
86 \fi
87 \endgroup
88 \ctxcommand {
89 showsymbolset (
90 "#1",
91 "\symbolset{#1}",
92 \the\globalscratchcounter
93 ) }
94 \endgroup}
95
96\protect
97
98\continueifinputfile{ssymbolsshow.mkxl}
99
100\usesymbols[cc]
101
102\starttext
103
104 \showsymbolset[cc]
105
106 \symbol[cc][ccbysanc]
107
108\stoptext
109
110
111 |