s-fonts-complete.mkiv /size: 7915 b    last modification: 2020-07-01 14:35
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            NC() bold("unicode")
45            NC() bold("visual")
46            NC() bold("unicodes")
47            NC() bold("tounicode")
48            NC() bold("index")
49            NC() bold("glyph")
50            NC() bold("adobe")
51            NC() bold("context")
52            NC() NR()
53            for unicode, chr in fonts.iterators.characters(tfmdata) do
54                local des, dat = descriptions[unicode], data[unicode]
55                local index     = chr.index or 0
56                local tounicode = chr.tounicode
57                local isunicode = chr.unicode
58                local cname     = (dat and dat.contextname) or ""
59                local aname     = (dat and dat.adobename) or ""
60                local gname     = (des and des.name) or ""
61                local mname     = dat and dat.mathname
62                if type(mname) ~= "string" then
63                    mname = ""
64                end
65                local mspec = dat and dat.mathspec
66                if mspec then
67                    for m=1,#mspec do
68                        local n = mspec[m].name
69                        if n then
70                            if mname == "" then
71                                mname = n
72                            else
73                                mname = mname .. " " .. n
74                            end
75                        end
76                    end
77                end
78                if mname ~= "" then
79                    mname = "m: " .. mname
80                    if cname ~= "" then
81                        cname = cname .. " " .. mname
82                    else
83                        cname = mname
84                    end
85                end
86                NC()
87                    tttf()
88                    context("%05X",unicode)
89                NC()
90                    char(unicode)
91                NC()
92                    if isunicode then
93                        tttf()
94                        if type(isunicode) == "table" then
95                            for i=1,#isunicode do
96                                if i > 1 then
97                                    if i % 2 ~= 0 then
98                                        context.crlf()
99                                    else
100                                        context.space()
101                                    end
102                                end
103                                context("%05X",isunicode[i])
104                            end
105                        else
106                            context("%05X",isunicode)
107                        end
108                    end
109                NC()
110                    if tounicode then
111                        tttf()
112                        context(tounicode)
113                    end
114                NC()
115                    tttf()
116                    context("%05X",index)
117                NC()
118                if gname ~= "" then
119                    tttf()
120                    escaped(gname)
121                end
122                NC()
123                if aname ~= "" then
124                    tttf()
125                    context(aname)
126                end
127                NC()
128                if cname ~= "" then
129                    tttf()
130                    context(cname)
131                end
132                NC() NR()
133            end
134            context.stoptabulate()
135        else
136            context("problems")
137        end
138    end
139
140    function moduledata.fonts.complete.glyphs()
141        local tfmdata = fontdata[true]
142        if tfmdata then
143            for unicode, chr in fonts.iterators.characters(tfmdata) do
144                context.showglyph(unicode)
145            end
146        end
147    end
148\stopluacode
149
150\unexpanded\def\ShowCompleteFont#1#2#3%
151  {\begingroup
152   \page
153   \font\TestFont=#1 at #2
154   \setuplayout[style=\TestFont]
155   \setupheadertexts[]
156   \setupfootertexts[#1\space\endash\space\pagenumber]
157   \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm]
158   \TestFont
159   \nonknuthmode
160   \startcolumns[n=#3]
161       \TestFont
162       \ctxlua { moduledata.fonts.complete.all() }
163   \stopcolumns
164   \page
165   \endgroup}
166
167\unexpanded\def\ShowAllGlyphs#1#2#3%
168  {\begingroup
169   \page
170   \def\showglyph##1{\dontleavehmode\strut\char##1\relax\par}
171   \font\TestFontA=#1 at 12pt
172   \font\TestFontB=#1 at #2
173   \setuplayout[style=\TestFontA]
174   \setupheadertexts[]
175   \setupfootertexts[#1\space\endash\space\pagenumber]
176   \setuplayout[width=middle,height=middle,topspace=1cm,backspace=1cm,header=1cm,footer=2cm]
177   \TestFontB \setupinterlinespace[line=1.2\dimexpr#2\relax] \raggedcenter
178   \nonknuthmode
179   \startcolumns[n=#3]
180       \TestFontB
181       \ctxlua { moduledata.fonts.complete.glyphs() }
182   \stopcolumns
183   \page
184   \endgroup}
185
186\continueifinputfile{s-fonts-complete.mkiv}
187
188\usemodule[art-01] \setuplayout[overview] \setupbodyfont[8pt]
189
190\starttext
191
192% \ShowCompleteFont{name:dejavusansmono}{10pt}{1}
193% \ShowCompleteFont{name:dejavuserif}{10pt}{2}
194% \ShowCompleteFont{name:officinasansbookitcregular}{10pt}{2}
195% \ShowCompleteFont{name:officinaserifbookitcregular}{10pt}{2}
196% \ShowCompleteFont{name:serpentineserifeflight}{10pt}{2}
197% \ShowCompleteFont{name:lmroman10-regular}{10pt}{1}
198% \ShowCompleteFont{name:lmtypewriter10-regular}{10pt}{2}
199% \ShowCompleteFont{lt55485}{10pt}{2}
200% \ShowCompleteFont{lmr10}{10pt}{2}
201% \ShowCompleteFont{lbr}{10pt}{2}
202% \ShowCompleteFont{name:Cambria}{10pt}{2}
203% \ShowCompleteFont{name:CambriaMath}{10pt}{2}
204% \ShowCompleteFont{name:texgyrepagella-regular}{10pt}{2}
205% \ShowCompleteFont{name:texgyrechorus-mediumitalic}{10pt}{2}
206% \ShowAllGlyphs   {name:texgyrepagella-regular}    {48pt}{2}
207% \ShowAllGlyphs   {name:texgyrechorus-mediumitalic}{48pt}{2}
208% \ShowCompleteFont{name:euler10-regular}{10pt}{2}
209
210% \ShowCompleteFont{name:palatinosansinformalcombold}{20pt}{2}
211% \ShowCompleteFont{name:palatinonovaregular}{11pt}{2}
212% \ShowCompleteFont{pirat.ttf}{12pt}{1}
213
214\setuplayout[overview][footer=1cm] \setuplayout[overview]%  \setupheadertexts[aegean.ttf]
215
216\ShowCompleteFont{file:aegean}               {8pt}{1}
217% \ShowCompleteFont{file:tsukurimashouminchops}{8pt}{1}
218% \ShowCompleteFont{file:tsukurimashoumincho}  {8pt}{1}
219% \ShowCompleteFont{file:tsukurimashoukakups}  {8pt}{1}
220% \ShowCompleteFont{file:tsukurimashoukaku}    {8pt}{1}
221% \ShowCompleteFont{file:akkadian}             {8pt}{1}
222
223\stoptext
224