1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23\startbuffer[samplefonttext]
24 a\\b\\c\\d\\e\\f\\g\\h\\i\\j\\k\\l\\m\\n\\o\\p\\q\\r\\s\\t\\u\\v\\w\\x\\y\\z\crlf
25 A\\B\\C\\D\\E\\F\\G\\H\\I\\J\\K\\L\\M\\N\\O\\P\\Q\\R\\S\\T\\U\\V\\W\\X\\Y\\Z\crlf
26 @\\1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\(\\)\\[\\]\\\{\\\}\\\\\\\\=\\<\\>\\
27 \textslash\\\textbackslash\\\texthash\\\textpercent\\\\\\*\\!\\?\\,\\.\\:\\;
28\stopbuffer
29
30\startbuffer[samplefont]
31 \framed
32 [offset=overlay,
33 frame=off,
34 align=middle]
35 {\def\\{\kern.2\emwidth}
36 \getbuffer[samplefonttext]}
37\stopbuffer
38
39\startMPdefinitions
40
41presetparameters "samplefont" [
42 name = "",
43 labels = false,
44 buffer = "samplefont"
45] ;
46
47def lmt_samplefont = applyparameters "samplefont" "lmt_do_samplefont" enddef ;
48
49vardef lmt_do_samplefont =
50 image (
51 pushparameters "samplefont" ;
52
53 save sample ; string sample ; sample := "\getbuffer[" & (getparameter "buffer") & "]" ;
54 save banner ; string banner ; banner := "\strut\tttf " & (getparameter "name") ;
55
56 save p ; picture p[] ;
57
58 p[1] := lmt_outline [ text = sample ] ;
59 p[2] := textext(sample) ;
60 p[3] := textext.ulft(banner) ;
61
62 p[1] := (p[1] shifted center p[1]) scaled 20 ;
63 p[2] := (p[2] shifted center p[2]) scaled 20 ;
64 p[3] := p[3] scaled 4 ;
65
66 save c ; string c[] ;
67
68 c[1] := "middlered" ; c[4] := "middlemagenta" ;
69 c[2] := "middlegreen" ; c[5] := "middlecyan" ;
70 c[3] := "middleblue" ; c[6] := "middleyellow" ;
71
72 save n ; numeric n ; n := 1 ;
73
74 for i within p[1] :
75 drawpath pathpart i ;
76 drawpoints pathpart i withcolor c[n] ;
77 n := if n == 6 : 1 else : n 1 fi ;
78 endfor ;
79
80 if (getparameter "labels") :
81
82 save defaultfont ; string defaultfont ; defaultfont := "Mono" ;
83 save defaultscale ; numeric defaultscale ; defaultscale := .4 ;
84
85 c[1] := "darkred" ; c[4] := "darkmagenta" ;
86 c[2] := "darkgreen" ; c[5] := "darkcyan" ;
87 c[3] := "darkblue" ; c[6] := "darkyellow" ;
88
89 n := 1 ;
90
91 for i within p[1] :
92 drawpointlabels pathpart i withcolor c[n] ;
93 n := if n == 6 : 1 else : n 1 fi ;
94 endfor ;
95
96 fi ;
97
98 draw p[2]
99 shifted (0,-1.1bbheight(p2)) ;
100
101 draw p[3]
102 shifted urcorner currentpicture ;
103
104 popparameters ;
105 )
106enddef ;
107
108\stopMPdefinitions
109
110\starttexdefinition protected samplefont[#1]
111 \begingroup
112 \getdummyparameters[name=dejavuserif.otf,buffer=samplefont,labels=no,#1]
113 \writestatus{fontfile}{\dummyparameter{name}}
114 \definedfont[\dummyparameter{name}]
115 \iffontchar\fonta\relax
116 \startMPpage[offset=2ts]
117 draw lmt_samplefont [
118 buffer = "\dummyparameter{buffer}",
119 name = "\dummyparameter{name}",
120 labels = \ifcstok{\dummyparameter{labels}}{yes}true\else false\fi
121 ] ;
122 \stopMPpage
123 \else
124 \writestatus{fontfile}{\dummyparameter{name} has no a}
125 \fi
126 \endgroup
127\stoptexdefinition
128
129\continueifinputfile{sfontsoutlines.mkxl}
130
131
132
133\starttext
134
135
136
137
138
139\samplefont[name=sab.afm]
140\samplefont[name=creditsuissetyperoman.ttf]
141\samplefont[name=calibri.ttf]
142
143
144
145
146
147
148
149
150
151
152
153\stoptext
154
155
156
157
158
159
160\starttext
161
162\startluacode
163 local todo = {
164
165 ["adobeblank.otf"] = "useless",
166 ["adobeblank2.otf"] = "useless",
167 ["lastresort.ttf"] = "useless",
168
169 ["sourcecodevariableitalic.otf"] = "crash",
170 ["sourcecodevariableroman.otf"] = "crash",
171 ["sourcehansansextralight.otf"] = "crash",
172 ["sourceserif4displaylight.otf"] = "crash",
173 ["notosanscjkkrlight.otf"] = "crash",
174 ["notosanscjkscdemilight.otf"] = "crash",
175 ["notosanscjktclight.otf"] = "crash",
176 ["junicodetwobetaregularvf.otf"] = "crash",
177 ["junicodetwobetabold.otf"] = "crash",
178 ["dfminchopstdw5.otf"] = "crash",
179 ["alegreyasansthin.otf"] = "crash",
180 ["alegreyasansthinitalic.otf"] = "crash",
181
182
183 ["lte52172.ttf"] = "crash",
184 ["avkv.ttf"] = "crash",
185 ["tirekv.ttf"] = "crash",
186
187 ["bhb.afm"] = "crash",
188 ["bhd.afm"] = "crash",
189 ["bhh.afm"] = "crash",
190 ["bhl.afm"] = "crash",
191 ["bhm.afm"] = "crash",
192 ["a.afm"] = "crash",
193 ["myriadmmitweight400width600.afm"] = "crash",
194 ["myriadmmitweight700width600.afm"] = "crash",
195 ["myriadmmweight400width600.afm"] = "crash",
196 ["myriadmmweight700width600.afm"] = "crash",
197
198 }
199
200 local skip = {
201 ["^arial"] = "bugged",
202 ["^myriad"] = "bugged",
203 ["^junicode"] = "bugged",
204 ["^noto"] = "big",
205 ["^source"] = "big",
206 ["^amiri"] = "bugged",
207 }
208
209 local function isbad(name)
210 if todo[name] then
211 return todo[name]
212 else
213 for k, v in next, skip do
214 if string.find(name,k) then
215 return v
216 end
217 end
218 end
219 return false
220 end
221
222 fonts.names.load()
223 local data = fonts.names.data
224 for k, v in table.sortedhash(data.files) do
225 local bad = isbad(k)
226 if bad then
227 context.writestatus("fontfile","skipping '" .. k .. "' : " .. bad)
228 else
229 local s = string.lower(file.suffix(k))
230 if s == "otf" or s == "ttf" or s == "afm" then
231
232
233
234 context.showsampleFont { name = k }
235 end
236 end
237 end
238\stopluacode
239
240\stoptext
241 |