Debian Codegraph @

texmf-dist/doc/latex/relenc/reldemo.tex

raw
1 \documentclass{article}
2
3 \usepackage{relenc}
4 \usepackage[T1R,OT1]{fontenc}
5 % ot1enc.def is inputed since I still want OT1 to be the default
6 % encoding in this document.
7
8
9 \makeatletter
10
11 % General font parameters:
12 \newdimen\demofontem \newdimen\demofontex \newskip\demofontspace
13
14 % This macro sets the font parameters for the current font, using
15 % default values if the \fontdimen values are too strange (probably
16 % because the font is a raw font not meant for typesetting).
17 \def\setfontparams{%
18 % \sbox{\letterbox}{a}% Make sure the font really is loaded (?)
19 \ifdim 0.1pt<\fontdimen6\font % Quad width
20 \setlength\demofontem{1em}%
21 \else
22 \demofontem=\f@size\p@
23 \fi
24 \ifdim0.1pt<\fontdimen5\font % x-height
25 \setlength\demofontex{1ex}%
26 \else
27 \demofontex=0.4\demofontem
28 \fi
29 \ifdim0.1pt<\fontdimen2\font % Interword space natural width
30 \setlength\demofontspace{\fontdimen2\font plus\fontdimen3\font
31 minus\fontdimen4\font
32 }%
33 \else
34 \setlength\demofontspace{0.2222\demofontem
35 plus0.1111\demofontem minus0.05555\demofontem
36 }%
37 \fi
38 }
39
40 % Generating the font table:
41 \newcount\slotnbr \newcount\rownbr \newcount\colnbr
42 \newdimen\thinlinesize \newdimen\thicklinesize \newdimen\squarewidth
43 \newsavebox\letterbox
44 \setlength\thinlinesize{0.24pt}
45 \setlength\thicklinesize{0.75pt}
46 \mathchardef\tablecolumns=16
47
48 \def\linespreadstrut{\vrule height2.5\demofontex depth1.5\demofontex width0pt}
49 \def\emptyrowrule{\rlap{\vrule height2.5\demofontex depth-2\demofontex
50 width\thinlinesize}\vrule height-1\demofontex depth1.5\demofontex
51 width\thinlinesize
52 }
53 \def\stdtext#1{{\normalfont#1}}
54 \def\tttext#1{{\normalfont\ttfamily#1}}
55 % Used on things that should not be typeset in the demo font.
56
57 \def\nextslot{%
58 \sbox{\letterbox}{\unhbox\letterbox
59 \hb@xt@\squarewidth{\hss\linespreadstrut\char\slotnbr\hss}%
60 \vrule width\thinlinesize
61 }%
62 \global\advance \slotnbr \@ne
63 }
64 \def\rowheading{%
65 \hb@[email protected]\demofontem{\hss
66 \linespreadstrut
67 \stdtext{\strut\the\slotnbr}\hskip0.2\demofontem
68 }%
69 }
70 \def\makebodyrow{\colnbr=\z@
71 \sbox{\letterbox}{%
72 \rowheading
73 \vrule width\thicklinesize
74 }%
75 \loop
76 \nextslot
77 \advance \colnbr \@ne
78 \ifnum \tablecolumns>\colnbr \repeat
79 \box\letterbox
80 }
81 \def\emptybodyrow{%
82 \hbox{%
83 \sbox\letterbox{%
84 \colnbr=\z@
85 \loop
86 \hskip\squarewidth
87 \advance \colnbr \@ne
88 \ifnum \tablecolumns>\colnbr
89 \vrule width\thinlinesize height\demofontex depth\z@
90 \repeat
91 }%
92 \tabskip=\z@skip
93 \valign{\vfil##\vfil\cr
94 \rowheading\cr
95 \noalign{\vrule width\thicklinesize}%
96 \relax\offinterlineskip
97 \halign{\hfil##\hfil\cr \copy\letterbox\cr
98 \noalign{\vfill}\stdtext{\strut These slots are empty}\cr
99 \noalign{\vfill}\box\letterbox\cr
100 }\cr
101 \noalign{\vrule width\thinlinesize}%
102 \cr
103 }%
104 }%
105 \global\advance \slotnbr \tablecolumns
106 }
107 \def\bodyrow{%
108 \setbox\letterbox=\hbox{%
109 \colnbr=\z@
110 \penalty\@ne
111 \loop
112 \char\slotnbr
113 \advance \slotnbr \@ne %Note: Non-global advancement
114 \advance \colnbr \@ne
115 \ifnum \tablecolumns>\colnbr \repeat
116 \ifnum \@ne=\lastpenalty % Are all characters in the row missing?
117 \def\next{iffalse}% Yes
118 \else
119 \def\next{iftrue}% No
120 \fi
121 \expandafter
122 }%
123 \csname\next\endcsname % Will be either \iftrue or \iffalse.
124 \makebodyrow
125 \else
126 \emptybodyrow
127 \fi
128 \hrule height\thinlinesize
129 }
130 \def\toprow{%
131 \colnbr=\z@
132 \sbox{\letterbox}{%
133 \hb@[email protected]\demofontem{\hss\linespreadstrut}%
134 \vrule width\thicklinesize
135 }%
136 \loop
137 \sbox{\letterbox}{%
138 \unhbox\letterbox
139 \hb@xt@\squarewidth{\hss\linespreadstrut
140 \stdtext{\the\colnbr}\hss
141 }%
142 \vrule width\thinlinesize
143 }%
144 \advance \colnbr \@ne
145 \ifnum \tablecolumns>\colnbr \repeat
146 \box\letterbox
147 \hrule height\thicklinesize
148 }
149 \def\MakeFontTable{%
150 \medskip
151 \setlength{\squarewidth}{1.6\demofontem}%
152 \hb@xt@\linewidth{\hss
153 \vbox{%
154 \tracinglostchars=\z@
155 \global\slotnbr=\z@
156 \toprow
157 \rownbr=\z@
158 \loop
159 \begingroup\bodyrow\endgroup
160 \advance \rownbr \@ne
161 \ifnum 16>\rownbr \repeat
162 }%
163 \hss
164 }
165 \par\bigskip
166 }
167
168
169 % Lists of symbols:
170
171 % A list of symbols consists of a sequence of \do{<symbol>} units,
172 % where <symbol> can be one (or possibly several) of the following:
173 % a category 11 or 12 token, such as `a' or `!'; a \chardef control
174 % sequence such as `\&'; a LaTeX symbol command such as \textsterling.
175 % (You can actually use a lot of stupid things in a <symbol> and still
176 % have it work, but don't be surprised if it won't for something
177 % that does not fit the above description.)
178
179 \newcommand\AddToList[2]{%
180 \relax % Can't hurt.
181 \ifx\relax#1
182 \def#1{\do{#2}}%
183 \else
184 \expandafter\def \expandafter#1\expandafter{#1\do{#2}}%
185 \fi
186 }
187
188 \def\OTOneBasicLettersListUC{%
189 \do{A}\do{B}\do{C}\do{D}\do{E}\do{F}\do{G}\do{H}\do{I}\do{J}\do{K}%
190 \do{L}\do{M}\do{N}\do{O}\do{P}\do{Q}\do{R}\do{S}\do{T}\do{U}\do{V}%
191 \do{W}\do{X}\do{Y}\do{Z}\do{\AE}\do{\OE}\do{\O}%
192 }
193 \let\TOneBasicLettersListUC=\OTOneBasicLettersListUC
194 \AddToList\TOneBasicLettersListUC{\DH}
195 \AddToList\TOneBasicLettersListUC{\DJ}
196 \AddToList\TOneBasicLettersListUC{\L}
197 \AddToList\TOneBasicLettersListUC{\NG}
198 \AddToList\TOneBasicLettersListUC{\SS}
199 \AddToList\TOneBasicLettersListUC{\TH}
200
201 \def\OTOneBasicLettersListLC{%
202 \do{a}\do{b}\do{c}\do{d}\do{e}\do{f}\do{g}\do{h}\do{i}\do{j}\do{k}%
203 \do{l}\do{m}\do{n}\do{o}\do{p}\do{q}\do{r}\do{s}\do{t}\do{u}\do{v}%
204 \do{w}\do{x}\do{y}\do{z}\do{\ae}\do{\i}\do{\j}\do{\oe}\do{\o}%
205 \do{\ss}%
206 }
207 \let\TOneBasicLettersListLC=\OTOneBasicLettersListLC
208 \AddToList\TOneBasicLettersListLC{\dh}
209 \AddToList\TOneBasicLettersListLC{\dj}
210 \AddToList\TOneBasicLettersListLC{\l}
211 \AddToList\TOneBasicLettersListLC{\ng}
212 \AddToList\TOneBasicLettersListLC{\th}
213
214 \def\OTOneAccentsList{%
215 \do{\@firstofone}% This is a "no accent" accent.
216 \do{\`}\do{\'}\do{\^}\do{\~}\do{\"}\do{\H}\do{\r}%
217 \do{\v}\do{\u}\do{\=}\do{\.}\do{\b}\do{\c}\do{\d}%
218 }
219 \let\TOneAccentsList=\OTOneAccentsList
220 \AddToList\TOneAccentsList{\k}
221
222 \newcommand\ApplyListToList[3]{%
223 % The first list here, which is given as #1, should really be a list
224 % of one-parameter commands. The second list, which should be given
225 % as #2, should be a normal list of symbols. Each command of the first
226 % list is applied to the symbols in the second list. #3 is inserted
227 % after every such application.
228 \def\do##1{{\def\do####1{##1{####1}#3}#2}}%
229 #1%
230 }
231
232 \newcommand\MakeTOneAccentedTable{%
233 \medskip
234 \ApplyListToList{\TOneAccentsList}{%
235 \TOneBasicLettersListLC\par\TOneBasicLettersListUC\par
236 }{\-}%
237 \bigskip
238 }
239 \newcommand\MakeOTOneAccentedTable{%
240 \medskip
241 \ApplyListToList{\OTOneAccentsList}{%
242 \OTOneBasicLettersListLC\par\OTOneBasicLettersListUC\par
243 }{\-}%
244 \bigskip
245 }
246
247
248 \let\TOneLeftGlyphsListLC=\TOneBasicLettersListLC
249 \AddToList\TOneLeftGlyphsListLC{ff}
250
251 \let\OTOneLeftGlyphsListLC=\OTOneBasicLettersListLC
252 \AddToList\OTOneLeftGlyphsListLC{ff}
253
254 \newcommand\ListTimesList[3]{%
255 % This "generates" the Cartesian product of two lists: For each \do in
256 % the first list a copy of the second list appears, and for each \do
257 % in the second list the current element from the first list is
258 % inserted. As with \ApplyListToList, #3 is inserted at the end of each
259 % \do from the second list.
260 \def\do##1{{\def\do####1{##1####1#3}#2}}%
261 #1%
262 }
263
264 \newcommand\MakeTOnePairsTable{%
265 \medskip
266 \ListTimesList{\TOneLeftGlyphsListLC}{\TOneBasicLettersListLC\par}{%
267 \hskip\demofontspace
268 }%
269 \smallskip
270 \ListTimesList{\TOneBasicLettersListUC}{\TOneBasicLettersListLC\par}{%
271 \hskip\demofontspace
272 }%
273 \smallskip
274 \ListTimesList{\TOneBasicLettersListUC}{\TOneBasicLettersListUC\par}{%
275 \hskip\demofontspace
276 }%
277 \bigskip
278 }
279
280 \newcommand\MakeOTOnePairsTable{%
281 \medskip
282 \ListTimesList{\OTOneLeftGlyphsListLC}{\OTOneBasicLettersListLC\par}{%
283 \hskip\demofontspace
284 }%
285 \smallskip
286 \ListTimesList{\OTOneBasicLettersListUC}{\OTOneBasicLettersListLC\par}{%
287 \hskip\demofontspace
288 }%
289 \smallskip
290 \ListTimesList{\OTOneBasicLettersListUC}{\OTOneBasicLettersListUC\par}{%
291 \hskip\demofontspace
292 }%
293 \bigskip
294 }
295
296
297 \def\OTOneSymbolsList{\do{\textemdash}\do{\textendash}%
298 \do{\textexclamdown}\do{\textquestiondown}\do{\textquotedblleft}%
299 \do{\textquotedblright}\do{\textquoteleft}\do{\textquoteright}%
300 \do{\textdollar}\do{\textsterling}%
301 }
302 \let\TOneSymbolsList=\OTOneSymbolsList
303 \AddToList\TOneSymbolsList{\guillemotleft}
304 \AddToList\TOneSymbolsList{\guillemotright}
305 \AddToList\TOneSymbolsList{\guilsinglleft}
306 \AddToList\TOneSymbolsList{\guilsinglright}
307 \AddToList\TOneSymbolsList{\quotedblbase}
308 \AddToList\TOneSymbolsList{\quotesinglbase}
309 \AddToList\TOneSymbolsList{\textasciicircum}
310 \AddToList\TOneSymbolsList{\textasciitilde}
311 \AddToList\TOneSymbolsList{\textbackslash}
312 \AddToList\TOneSymbolsList{\textbar}
313 \AddToList\TOneSymbolsList{\textbraceleft}
314 \AddToList\TOneSymbolsList{\textbraceright}
315 \AddToList\TOneSymbolsList{\textcompwordmark}
316 \AddToList\TOneSymbolsList{\textgreater}
317 \AddToList\TOneSymbolsList{\textless}
318 \AddToList\TOneSymbolsList{\textperthousand}
319 \AddToList\TOneSymbolsList{\textpertenthousand}
320 \AddToList\TOneSymbolsList{\textquotedbl}
321 \AddToList\TOneSymbolsList{\textsection}
322 \AddToList\TOneSymbolsList{\textunderscore}
323 \AddToList\TOneSymbolsList{\textvisiblespace}
324
325
326 \newcommand\MakeOTOneSymbolsTable{\MakeSymbolsTable\OTOneSymbolsList}
327 \newcommand\MakeTOneSymbolsTable{\MakeSymbolsTable\TOneSymbolsList}
328 \newcommand\MakeSymbolsTable[1]{%
329 \begingroup
330 \def\do##1{\tttext{\string##1}&##1\cr}%
331 \tabskip=\hideskip
332 \halign to\linewidth{##\hfil \tabskip=\ht\strutbox&
333 \hfil##\hfil \tabskip=\hideskip\cr
334 \stdtext{\TeX\ code}&\stdtext{Symbol}\cr
335 #1%
336 }%
337 \endgroup
338 \par\bigskip
339 }
340
341
342 % Combining it all
343
344 \newcommand\DemoTOneLaTeXFont[4]{%
345 \vfil\penalty0\vfilneg
346 \markright{\stdtext{Demo of \LaTeX\ font \ttfamily #1/#2/#3/#4}\hss}%
347 \begingroup
348 \usefont{#1}{#2}{#3}{#4}%
349 \setfontparams
350 \noindent\stdtext{\textbf{Font table}}\par
351 \MakeFontTable
352 \noindent\stdtext{\textbf{Accents/letters table}}\par
353 \MakeTOneAccentedTable
354 \noindent\stdtext{\textbf{Pairs tables}}\par
355 \MakeTOnePairsTable
356 \noindent\stdtext{\textbf{Symbols table}}\par
357 \MakeTOneSymbolsTable
358 \ifx \TOneDemoText\@undefined \else
359 \medskip\TOneDemoText\medskip
360 \fi
361 \endgroup
362 }
363 \newcommand\DemoOTOneLaTeXFont[4]{
364 \vfil\penalty0\vnegfil
365 \markright{\stdtext{Demo of \LaTeX\ font \ttfamily #1/#2/#3/#4}\hss}%
366 \begingroup
367 \usefont{#1}{#2}{#3}{#4}%
368 \setfontparams
369 \noindent\stdtext{\textbf{Font table}}\par
370 \MakeFontTable
371 \noindent\stdtext{\textbf{Accents/letters table}}\par
372 \MakeOTOneAccentedTable
373 \noindent\stdtext{\textbf{Pairs tables}}\par
374 \MakeOTOnePairsTable
375 \noindent\stdtext{\textbf{Symbols table}}\par
376 \MakeOTOneSymbolsTable
377 \ifx \OTOneDemoText\@undefined \else
378 \medskip\OTOneDemoText\medskip
379 \fi
380 \endgroup
381 }
382 \newcommand\DemoRawTeXFont[1]{\begingroup
383 \font\demofont=#1\relax
384 \demofont
385 \setfontparams
386 \MakeFontTable
387 \endgroup
388 }
389
390 \makeatother
391
392 \pagestyle{myheadings}
393
394 \begin{document}
395 \errorcontextlines=999\relax
396
397 You should at least read Appendix C of the package documentation
398 before viewing this example, but if you prefer not to then I must at
399 least point out that the fonts in the \texttt{zcm} family are mainly
400 \texttt{cmr10} that has been completed with various ``faked''
401 characters. As a result, many of the characters does not look very
402 good and some look downright ugly, but there is no particular harm in
403 that since the \texttt{zcm} fonts are not intended to be used in any
404 serious typesetting anyway.
405
406 The first font in the \texttt{zcm} family---the \texttt{T1R}\slash
407 \texttt{zcm}\slash\texttt{m}\slash\texttt{n} font---has a coding scheme
408 identical to that used for fonts in the \texttt{T1} encoding. It
409 shows the default setup for the \texttt{T1R} encoding.
410
411 The font table shows the contents of each slot. The accents/letters
412 table shows the result of the non-accented letters as they are and
413 their appearence after having been subjected to each accenting command
414 in turn. The pairs tables shows all the ligatures and the symbols
415 table finally shows the symbol commands and their effect.
416
417 \bigskip
418 \DemoTOneLaTeXFont{T1R}{zcm}{m}{n}
419
420 The second font in the \texttt{zcm} family---the \texttt{T1R}\slash
421 \texttt{zcm}\slash\texttt{m}\slash\texttt{a} font---has four extra
422 ligatures: ct, fj, ffj, and st. These appear in the font table at
423 positions 128, 130, 131, and 161. Despite the fact that four of the
424 characaters that were used for making accented letters in the
425 \texttt{T1R}\slash\texttt{zcm}\slash\texttt{m}\slash\texttt{n} font are
426 missing however, the accents/letters table for the \texttt{T1R}\slash
427 \texttt{zcm}\slash\texttt{m}\slash\texttt{a} font display the same accented
428 letters as the ditto table for the \texttt{T1R}\slash\texttt{zcm}\slash
429 \texttt{m}\slash\texttt{n} font did. Under the \texttt{T1} encoding,
430 the result would instead have been that some of the accented letters
431 would incorrectly have been replaced by the ligatures.
432
433 The pairs tables show that the four extra ligatures work as ligatures
434 and the symbols table looks exactly as for the \texttt{T1R}\slash
435 \texttt{zcm}\slash\texttt{m}\slash\texttt{n} font.
436
437 \bigskip
438 \DemoTOneLaTeXFont{T1R}{zcm}{m}{a}
439
440 \end{document}