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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
%D \module
%D [ file=symb-run,
%D version=2010.12.08, % 1998.07.20,
%D title=\CONTEXT\ Symbol Libraries,
%D subtitle=Runtime Macros,
%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.
% todo: implementor
\startluacode
function commands.showsymbolset(collection,symbols,fontid)
if type(symbols) == "string" then
symbols = utilities.parsers.settings_to_array(symbols)
end
local options = { framecolor = "orange", rulethickness = ".8pt", offset = interfaces.variables.overlay }
local list = table.tohash(symbols)
local alsofont = fontid > 0
local defined = #symbols > 0
local byname = false
if alsofont then
local is_symbol = characters.is_symbol
local chardata = characters.data
local resources = fonts.hashes.resources [fontid]
local characters = fonts.hashes.characters[fontid]
if resources and characters then
local unicodes = resources.unicodes
if unicodes then
for name, unicode in next, unicodes do
if not list[name] and name ~= ".notdef" then
local c = rawget(chardata,unicode)
if not c or is_symbol[c.category] then
list[name] = false
byname = true
end
end
end
end
end
end
local detail = defined and byname
context.start()
context.setupsymbolset { collection }
context.starttabulate { detail and "|lT|l|l|lT|" or "|lT|l|l|"}
for symbol, how in table.sortedhash(list) do
if detail and how then
context.BC()
else
context.NC()
end
context(symbol)
context.NC()
context.symbol(symbol)
context.NC()
context.framed(options,context.nested.symbol(symbol))
if detail and how then
context.BC()
context("defined")
else
context.NC()
end
context.NC()
context.NR()
end
context.stoptabulate()
context.stop()
end
\stopluacode
\unprotect
\permanent\protected\tolerant\gdef\showsymbolset[#1]%
{\begingroup
\edef\p_font{\begincsname\??symboldefault#1\endcsname}%
\begingroup
\ifx\p_font\empty
\global\globalscratchcounter\zerocount
\else
\definedfont[\p_font]%
\global\globalscratchcounter\fontid\font\relax
\fi
\endgroup
\ctxcommand {
showsymbolset (
"#1",
"\symbolset{#1}",
\the\globalscratchcounter
) }%
\endgroup}
\protect
\continueifinputfile{s-symbols-show.mkxl}
\usesymbols[cc]
\starttext
\showsymbolset[cc]
\symbol[cc][cc-by-sa-nc]
\stoptext
|