s-fonts-complete.mkiv /size: 7976 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [      file=s-fnt-01,
3%D        version=2006.10.10, % guess
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Listing Glyphs in Large Fonts,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D This module is sort of obsolete as other moduels give nicer overviews.
15
16\startluacode
17    moduledata.fonts          = moduledata.fonts          or { }
18    moduledata.fonts.complete = moduledata.fonts.complete or { }
19
20    local fontdata = fonts.hashes.identifiers
21
22    local context = context
23    local escaped = context.escaped
24
25    function moduledata.fonts.complete.all()
26        local tfmdata = fontdata[true]
27        if tfmdata then
28            local NC, NR, HL, char, bold, tttf = context.NC, context.NR, context.HL, context.char, context.bold, context.tttf
29            local descriptions = tfmdata.descriptions or { }
30            local data = characters.data
31         -- context.setuptabulate { header = "repeat" }
32         -- context.starttabulatehead()
33         --     NC() bold("unicode")
34         --     NC() bold("visual")
35         --     NC() bold("index")
36         --     NC() bold("tounicode")
37         --     NC() bold("unicodes")
38         --     NC() bold("glyph")
39         --     NC() bold("adobe")
40         --     NC() bold("context")
41         --     NC() NR()
42         -- context.stoptabulatehead()
43         -- context.starttabulate { "|l|c|p(8em)|l|l|p|p|p|" }
44            context.starttabulate { "|l|c|p(8em)|l|l|p|p|" }
45            NC() bold("unicode")
46            NC() bold("visual")
47            NC() bold("unicodes")
48            NC() bold("tounicode")
49            NC() bold("index")
50            NC() bold("glyph")
51         -- NC() bold("adobe")
52            NC() bold("context")
53            NC() NR()
54            for unicode, chr in fonts.iterators.characters(tfmdata) do
55                local des, dat = descriptions[unicode], data[unicode]
56                local index     = chr.index or 0
57                local tounicode = chr.tounicode
58                local isunicode = chr.unicode
59                local cname     = (dat and dat.contextname) or ""
60             -- local aname     = (dat and dat.adobename) or ""
61                local gname     = (des and des.name) or ""
62                local mname     = dat and dat.mathname
63                if type(mname) ~= "string" then
64                    mname = ""
65                end
66                local mspec = dat and dat.mathspec
67                if mspec then
68                    for m=1,#mspec do
69                        local n = mspec[m].name
70                        if n then
71                            if mname == "" then
72                                mname = n
73                            else
74                                mname = mname .. " " .. n
75                            end
76                        end
77                    end
78                end
79                if mname ~= "" then
80                    mname = "m: " .. mname
81                    if cname ~= "" then
82                        cname = cname .. " " .. mname
83                    else
84                        cname = mname
85                    end
86                end
87                NC()
88                    tttf()
89                    context("%05X",unicode)
90                NC()
91                    char(unicode)
92                NC()
93                    if isunicode then
94                        tttf()
95                        if type(isunicode) == "table" then
96                            for i=1,#isunicode do
97                                if i > 1 then
98                                    if i % 2 ~= 0 then
99                                        context.crlf()
100                                    else
101                                        context.space()
102                                    end
103                                end
104                                context("%05X",isunicode[i])
105                            end
106                        else
107                            context("%05X",isunicode)
108                        end
109                    end
110                NC()
111                    if tounicode then
112                        tttf()
113                        context(tounicode)
114                    end
115                NC()
116                    tttf()
117                    context("%05X",index)
118                NC()
119                if gname ~= "" then
120                    tttf()
121                    escaped(gname)
122                end
123             -- NC()
124             -- if aname ~= "" then
125             --     tttf()
126             --     context(aname)
127             -- end
128                NC()
129                if cname ~= "" then
130                    tttf()
131                    context(cname)
132                end
133                NC() NR()
134            end
135            context.stoptabulate()
136        else
137            context("problems")
138        end
139    end
140
141    function moduledata.fonts.complete.glyphs()
142        local tfmdata = fontdata[true]
143        if tfmdata then
144            for unicode, chr in fonts.iterators.characters(tfmdata) do
145                context.showglyph(unicode)
146            end
147        end
148    end
149\stopluacode
150
151\unexpanded\def\ShowCompleteFont#1#2#3%
152  {\begingroup
153   \page
154   \font\TestFont=#1 at #2
155   \setuplayout[style=\TestFont]
156   \setupheadertexts[]
157   \setupfootertexts[#1\space\endash\space\pagenumber]
158   \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm]
159   \TestFont
160   \nonknuthmode
161   \startcolumns[n=#3]
162       \TestFont
163       \ctxlua { moduledata.fonts.complete.all() }
164   \stopcolumns
165   \page
166   \endgroup}
167
168\unexpanded\def\ShowAllGlyphs#1#2#3%
169  {\begingroup
170   \page
171   \def\showglyph##1{\dontleavehmode\strut\char##1\relax\par}
172   \font\TestFontA=#1 at 12pt
173   \font\TestFontB=#1 at #2
174   \setuplayout[style=\TestFontA]
175   \setupheadertexts[]
176   \setupfootertexts[#1\space\endash\space\pagenumber]
177   \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm,header=1cm,footer=2cm]
178   \TestFontB \setupinterlinespace[line=1.2\dimexpr#2\relax] \raggedcenter
179   \nonknuthmode
180   \startcolumns[n=#3]
181       \TestFontB
182       \ctxlua { moduledata.fonts.complete.glyphs() }
183   \stopcolumns
184   \page
185   \endgroup}
186
187\continueifinputfile{s-fonts-complete.mkiv}
188
189\usemodule[art-01] \setuplayout[overview] \setupbodyfont[8pt]
190
191\starttext
192
193% \ShowCompleteFont{name:dejavusansmono}{10pt}{1}
194% \ShowCompleteFont{name:dejavuserif}{10pt}{2}
195% \ShowCompleteFont{name:officinasansbookitcregular}{10pt}{2}
196% \ShowCompleteFont{name:officinaserifbookitcregular}{10pt}{2}
197% \ShowCompleteFont{name:serpentineserifeflight}{10pt}{2}
198% \ShowCompleteFont{name:lmroman10-regular}{10pt}{1}
199% \ShowCompleteFont{name:lmtypewriter10-regular}{10pt}{2}
200% \ShowCompleteFont{lt55485}{10pt}{2}
201% \ShowCompleteFont{lmr10}{10pt}{2}
202% \ShowCompleteFont{lbr}{10pt}{2}
203% \ShowCompleteFont{name:Cambria}{10pt}{2}
204% \ShowCompleteFont{name:CambriaMath}{10pt}{2}
205% \ShowCompleteFont{name:texgyrepagella-regular}{10pt}{2}
206% \ShowCompleteFont{name:texgyrechorus-mediumitalic}{10pt}{2}
207% \ShowAllGlyphs   {name:texgyrepagella-regular}    {48pt}{2}
208% \ShowAllGlyphs   {name:texgyrechorus-mediumitalic}{48pt}{2}
209% \ShowCompleteFont{name:euler10-regular}{10pt}{2}
210
211% \ShowCompleteFont{name:palatinosansinformalcombold}{20pt}{2}
212% \ShowCompleteFont{name:palatinonovaregular}{11pt}{2}
213% \ShowCompleteFont{pirat.ttf}{12pt}{1}
214
215\setuplayout[overview][footer=1cm] \setuplayout[overview]%  \setupheadertexts[aegean.ttf]
216
217\ShowCompleteFont{file:aegean}               {8pt}{1}
218% \ShowCompleteFont{file:tsukurimashouminchops}{8pt}{1}
219% \ShowCompleteFont{file:tsukurimashoumincho}  {8pt}{1}
220% \ShowCompleteFont{file:tsukurimashoukakups}  {8pt}{1}
221% \ShowCompleteFont{file:tsukurimashoukaku}    {8pt}{1}
222% \ShowCompleteFont{file:akkadian}             {8pt}{1}
223
224\stoptext
225