summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/relenc/reldemo.tex
blob: c918a900308e837e5f5194b0c31ae4b7884b6c15 (plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
\documentclass{article}

\usepackage{relenc}
\usepackage[T1R,OT1]{fontenc}
 % ot1enc.def is inputed since I still want OT1 to be the default 
 % encoding in this document.


\makeatletter

% General font parameters:
\newdimen\demofontem \newdimen\demofontex \newskip\demofontspace

 % This macro sets the font parameters for the current font, using 
 % default values if the \fontdimen values are too strange (probably 
 % because the font is a raw font not meant for typesetting).
\def\setfontparams{%
%    \sbox{\letterbox}{a}%  Make sure the font really is loaded (?)
   \ifdim 0.1pt<\fontdimen6\font  % Quad width
      \setlength\demofontem{1em}%
   \else
      \demofontem=\f@size\p@
   \fi
   \ifdim0.1pt<\fontdimen5\font  % x-height
      \setlength\demofontex{1ex}%
   \else
      \demofontex=0.4\demofontem
   \fi
   \ifdim0.1pt<\fontdimen2\font  % Interword space natural width
      \setlength\demofontspace{\fontdimen2\font plus\fontdimen3\font
         minus\fontdimen4\font
      }%
   \else
      \setlength\demofontspace{0.2222\demofontem
         plus0.1111\demofontem minus0.05555\demofontem
      }%
   \fi
}

% Generating the font table:
\newcount\slotnbr \newcount\rownbr \newcount\colnbr
\newdimen\thinlinesize \newdimen\thicklinesize \newdimen\squarewidth
\newsavebox\letterbox
\setlength\thinlinesize{0.24pt}
\setlength\thicklinesize{0.75pt}
\mathchardef\tablecolumns=16

\def\linespreadstrut{\vrule height2.5\demofontex depth1.5\demofontex width0pt}
\def\emptyrowrule{\rlap{\vrule height2.5\demofontex depth-2\demofontex 
   width\thinlinesize}\vrule height-1\demofontex depth1.5\demofontex 
   width\thinlinesize
}
\def\stdtext#1{{\normalfont#1}}
\def\tttext#1{{\normalfont\ttfamily#1}}
  % Used on things that should not be typeset in the demo font.

\def\nextslot{%
   \sbox{\letterbox}{\unhbox\letterbox
      \hb@xt@\squarewidth{\hss\linespreadstrut\char\slotnbr\hss}%
      \vrule width\thinlinesize
   }%
   \global\advance \slotnbr \@ne
}
\def\rowheading{%
   \hb@xt@1.5\demofontem{\hss
      \linespreadstrut
      \stdtext{\strut\the\slotnbr}\hskip0.2\demofontem
   }%
}
\def\makebodyrow{\colnbr=\z@
   \sbox{\letterbox}{%
      \rowheading
      \vrule width\thicklinesize
   }%
   \loop
      \nextslot
      \advance \colnbr \@ne
   \ifnum \tablecolumns>\colnbr \repeat
   \box\letterbox
}
\def\emptybodyrow{%
   \hbox{%
      \sbox\letterbox{%
         \colnbr=\z@
         \loop
            \hskip\squarewidth
            \advance \colnbr \@ne
         \ifnum \tablecolumns>\colnbr
            \vrule width\thinlinesize height\demofontex depth\z@
         \repeat
      }%
      \tabskip=\z@skip
      \valign{\vfil##\vfil\cr
         \rowheading\cr
         \noalign{\vrule width\thicklinesize}%
         \relax\offinterlineskip
         \halign{\hfil##\hfil\cr \copy\letterbox\cr
            \noalign{\vfill}\stdtext{\strut These slots are empty}\cr
            \noalign{\vfill}\box\letterbox\cr
         }\cr
         \noalign{\vrule width\thinlinesize}%
         \cr
      }%
   }%
   \global\advance \slotnbr \tablecolumns
}
\def\bodyrow{%
   \setbox\letterbox=\hbox{%
      \colnbr=\z@
      \penalty\@ne
      \loop
         \char\slotnbr
         \advance \slotnbr \@ne %Note: Non-global advancement
         \advance \colnbr \@ne
      \ifnum \tablecolumns>\colnbr \repeat
      \ifnum \@ne=\lastpenalty % Are all characters in the row missing?
         \def\next{iffalse}% Yes
      \else
         \def\next{iftrue}% No
      \fi
      \expandafter
   }%
   \csname\next\endcsname % Will be either \iftrue or \iffalse.
      \makebodyrow
   \else
      \emptybodyrow
   \fi
   \hrule height\thinlinesize
}
\def\toprow{%
   \colnbr=\z@
   \sbox{\letterbox}{%
      \hb@xt@1.5\demofontem{\hss\linespreadstrut}%
      \vrule width\thicklinesize
   }%
   \loop
      \sbox{\letterbox}{%
         \unhbox\letterbox
         \hb@xt@\squarewidth{\hss\linespreadstrut
            \stdtext{\the\colnbr}\hss
         }%
         \vrule width\thinlinesize
      }%
      \advance \colnbr \@ne
   \ifnum \tablecolumns>\colnbr \repeat
   \box\letterbox
   \hrule height\thicklinesize
}
\def\MakeFontTable{%
   \medskip
   \setlength{\squarewidth}{1.6\demofontem}%
   \hb@xt@\linewidth{\hss
      \vbox{%
         \tracinglostchars=\z@
         \global\slotnbr=\z@
         \toprow
         \rownbr=\z@
         \loop
           \begingroup\bodyrow\endgroup
           \advance \rownbr \@ne
         \ifnum 16>\rownbr \repeat
      }%
      \hss
   }
   \par\bigskip
}


% Lists of symbols:

% A list of symbols consists of a sequence of \do{<symbol>} units, 
% where <symbol> can be one (or possibly several) of the following: 
% a category 11 or 12 token, such as `a' or `!'; a \chardef control 
% sequence such as `\&'; a LaTeX symbol command such as \textsterling. 
% (You can actually use a lot of stupid things in a <symbol> and still 
% have it work, but don't be surprised if it won't for something 
% that does not fit the above description.)

\newcommand\AddToList[2]{%
   \relax % Can't hurt.
   \ifx\relax#1
      \def#1{\do{#2}}%
   \else
      \expandafter\def \expandafter#1\expandafter{#1\do{#2}}%
   \fi
}

\def\OTOneBasicLettersListUC{%
   \do{A}\do{B}\do{C}\do{D}\do{E}\do{F}\do{G}\do{H}\do{I}\do{J}\do{K}%
   \do{L}\do{M}\do{N}\do{O}\do{P}\do{Q}\do{R}\do{S}\do{T}\do{U}\do{V}%
   \do{W}\do{X}\do{Y}\do{Z}\do{\AE}\do{\OE}\do{\O}%
}
\let\TOneBasicLettersListUC=\OTOneBasicLettersListUC
\AddToList\TOneBasicLettersListUC{\DH}
\AddToList\TOneBasicLettersListUC{\DJ}
\AddToList\TOneBasicLettersListUC{\L}
\AddToList\TOneBasicLettersListUC{\NG}
\AddToList\TOneBasicLettersListUC{\SS}
\AddToList\TOneBasicLettersListUC{\TH}

\def\OTOneBasicLettersListLC{%
   \do{a}\do{b}\do{c}\do{d}\do{e}\do{f}\do{g}\do{h}\do{i}\do{j}\do{k}%
   \do{l}\do{m}\do{n}\do{o}\do{p}\do{q}\do{r}\do{s}\do{t}\do{u}\do{v}%
   \do{w}\do{x}\do{y}\do{z}\do{\ae}\do{\i}\do{\j}\do{\oe}\do{\o}%
   \do{\ss}%
}
\let\TOneBasicLettersListLC=\OTOneBasicLettersListLC
\AddToList\TOneBasicLettersListLC{\dh}
\AddToList\TOneBasicLettersListLC{\dj}
\AddToList\TOneBasicLettersListLC{\l}
\AddToList\TOneBasicLettersListLC{\ng}
\AddToList\TOneBasicLettersListLC{\th}

\def\OTOneAccentsList{%
   \do{\@firstofone}% This is a "no accent" accent.
   \do{\`}\do{\'}\do{\^}\do{\~}\do{\"}\do{\H}\do{\r}%
   \do{\v}\do{\u}\do{\=}\do{\.}\do{\b}\do{\c}\do{\d}%
} 
\let\TOneAccentsList=\OTOneAccentsList
\AddToList\TOneAccentsList{\k}

\newcommand\ApplyListToList[3]{%
  % The first list here, which is given as #1, should really be a list 
  % of one-parameter commands. The second list, which should be given 
  % as #2, should be a normal list of symbols. Each command of the first 
  % list is applied to the symbols in the second list. #3 is inserted 
  % after every such application.
   \def\do##1{{\def\do####1{##1{####1}#3}#2}}%
   #1%
}

\newcommand\MakeTOneAccentedTable{%
   \medskip
   \ApplyListToList{\TOneAccentsList}{%
      \TOneBasicLettersListLC\par\TOneBasicLettersListUC\par
   }{\-}%
   \bigskip
}
\newcommand\MakeOTOneAccentedTable{%
   \medskip
   \ApplyListToList{\OTOneAccentsList}{%
      \OTOneBasicLettersListLC\par\OTOneBasicLettersListUC\par
   }{\-}%
   \bigskip
}


\let\TOneLeftGlyphsListLC=\TOneBasicLettersListLC
\AddToList\TOneLeftGlyphsListLC{ff}

\let\OTOneLeftGlyphsListLC=\OTOneBasicLettersListLC
\AddToList\OTOneLeftGlyphsListLC{ff}

\newcommand\ListTimesList[3]{%
  % This "generates" the Cartesian product of two lists: For each \do in 
  % the first list a copy of the second list appears, and for each \do 
  % in the second list the current element from the first list is 
  % inserted. As with \ApplyListToList, #3 is inserted at the end of each 
  % \do from the second list.
   \def\do##1{{\def\do####1{##1####1#3}#2}}%
   #1%
}

\newcommand\MakeTOnePairsTable{%
   \medskip
   \ListTimesList{\TOneLeftGlyphsListLC}{\TOneBasicLettersListLC\par}{%
      \hskip\demofontspace
   }%
   \smallskip
   \ListTimesList{\TOneBasicLettersListUC}{\TOneBasicLettersListLC\par}{%
      \hskip\demofontspace
   }%
   \smallskip
   \ListTimesList{\TOneBasicLettersListUC}{\TOneBasicLettersListUC\par}{%
      \hskip\demofontspace
   }%
   \bigskip
}   

\newcommand\MakeOTOnePairsTable{%
   \medskip
   \ListTimesList{\OTOneLeftGlyphsListLC}{\OTOneBasicLettersListLC\par}{%
      \hskip\demofontspace
   }%
   \smallskip
   \ListTimesList{\OTOneBasicLettersListUC}{\OTOneBasicLettersListLC\par}{%
      \hskip\demofontspace
   }%
   \smallskip
   \ListTimesList{\OTOneBasicLettersListUC}{\OTOneBasicLettersListUC\par}{%
      \hskip\demofontspace
   }%
   \bigskip
}   


\def\OTOneSymbolsList{\do{\textemdash}\do{\textendash}%
   \do{\textexclamdown}\do{\textquestiondown}\do{\textquotedblleft}%
   \do{\textquotedblright}\do{\textquoteleft}\do{\textquoteright}%
   \do{\textdollar}\do{\textsterling}%
}
\let\TOneSymbolsList=\OTOneSymbolsList
\AddToList\TOneSymbolsList{\guillemotleft}
\AddToList\TOneSymbolsList{\guillemotright}
\AddToList\TOneSymbolsList{\guilsinglleft}
\AddToList\TOneSymbolsList{\guilsinglright}
\AddToList\TOneSymbolsList{\quotedblbase}
\AddToList\TOneSymbolsList{\quotesinglbase}
\AddToList\TOneSymbolsList{\textasciicircum}
\AddToList\TOneSymbolsList{\textasciitilde}
\AddToList\TOneSymbolsList{\textbackslash}
\AddToList\TOneSymbolsList{\textbar}
\AddToList\TOneSymbolsList{\textbraceleft}
\AddToList\TOneSymbolsList{\textbraceright}
\AddToList\TOneSymbolsList{\textcompwordmark}
\AddToList\TOneSymbolsList{\textgreater}
\AddToList\TOneSymbolsList{\textless}
\AddToList\TOneSymbolsList{\textperthousand}
\AddToList\TOneSymbolsList{\textpertenthousand}
\AddToList\TOneSymbolsList{\textquotedbl}
\AddToList\TOneSymbolsList{\textsection}
\AddToList\TOneSymbolsList{\textunderscore}
\AddToList\TOneSymbolsList{\textvisiblespace}


\newcommand\MakeOTOneSymbolsTable{\MakeSymbolsTable\OTOneSymbolsList}
\newcommand\MakeTOneSymbolsTable{\MakeSymbolsTable\TOneSymbolsList}
\newcommand\MakeSymbolsTable[1]{%
   \begingroup
      \def\do##1{\tttext{\string##1}&##1\cr}%
      \tabskip=\hideskip
      \halign to\linewidth{##\hfil \tabskip=\ht\strutbox&
         \hfil##\hfil \tabskip=\hideskip\cr
         \stdtext{\TeX\ code}&\stdtext{Symbol}\cr
         #1%
      }%
   \endgroup
   \par\bigskip
}


% Combining it all

\newcommand\DemoTOneLaTeXFont[4]{%
   \vfil\penalty0\vfilneg
   \markright{\stdtext{Demo of \LaTeX\ font \ttfamily #1/#2/#3/#4}\hss}%
   \begingroup
      \usefont{#1}{#2}{#3}{#4}%
      \setfontparams
      \noindent\stdtext{\textbf{Font table}}\par
      \MakeFontTable
      \noindent\stdtext{\textbf{Accents/letters table}}\par
      \MakeTOneAccentedTable
      \noindent\stdtext{\textbf{Pairs tables}}\par
      \MakeTOnePairsTable
      \noindent\stdtext{\textbf{Symbols table}}\par
      \MakeTOneSymbolsTable
      \ifx \TOneDemoText\@undefined \else
         \medskip\TOneDemoText\medskip
      \fi
   \endgroup
}
\newcommand\DemoOTOneLaTeXFont[4]{
   \vfil\penalty0\vnegfil
   \markright{\stdtext{Demo of \LaTeX\ font \ttfamily #1/#2/#3/#4}\hss}%
   \begingroup
      \usefont{#1}{#2}{#3}{#4}%
      \setfontparams
      \noindent\stdtext{\textbf{Font table}}\par
      \MakeFontTable
      \noindent\stdtext{\textbf{Accents/letters table}}\par
      \MakeOTOneAccentedTable
      \noindent\stdtext{\textbf{Pairs tables}}\par
      \MakeOTOnePairsTable
      \noindent\stdtext{\textbf{Symbols table}}\par
      \MakeOTOneSymbolsTable
      \ifx \OTOneDemoText\@undefined \else
         \medskip\OTOneDemoText\medskip
      \fi
   \endgroup
}
\newcommand\DemoRawTeXFont[1]{\begingroup
   \font\demofont=#1\relax
   \demofont
   \setfontparams
   \MakeFontTable
   \endgroup
}

\makeatother

\pagestyle{myheadings}

\begin{document}
\errorcontextlines=999\relax

You should at least read Appendix C of the package documentation 
before viewing this example, but if you prefer not to then I must at 
least point out that the fonts in the \texttt{zcm} family are mainly 
\texttt{cmr10} that has been completed with various ``faked'' 
characters. As a result, many of the characters does not look very 
good and some look downright ugly, but there is no particular harm in 
that since the \texttt{zcm} fonts are not intended to be used in any 
serious typesetting anyway.

The first font in the \texttt{zcm} family---the \texttt{T1R}\slash 
\texttt{zcm}\slash\texttt{m}\slash\texttt{n} font---has a coding scheme 
identical to that used for fonts in the \texttt{T1} encoding. It 
shows the default setup for the \texttt{T1R} encoding.

The font table shows the contents of each slot. The accents/letters 
table shows the result of the non-accented letters as they are and 
their appearence after having been subjected to each accenting command 
in turn. The pairs tables shows all the ligatures and the symbols 
table finally shows the symbol commands and their effect.

\bigskip
\DemoTOneLaTeXFont{T1R}{zcm}{m}{n}

The second font in the \texttt{zcm} family---the \texttt{T1R}\slash 
\texttt{zcm}\slash\texttt{m}\slash\texttt{a} font---has four extra 
ligatures: ct, fj, ffj, and st. These appear in the font table at 
positions 128, 130, 131, and 161. Despite the fact that four of the 
characaters that were used for making accented letters in the 
\texttt{T1R}\slash\texttt{zcm}\slash\texttt{m}\slash\texttt{n} font are 
missing however, the accents/letters table for the \texttt{T1R}\slash
\texttt{zcm}\slash\texttt{m}\slash\texttt{a} font display the same accented 
letters as the ditto table for the \texttt{T1R}\slash\texttt{zcm}\slash
\texttt{m}\slash\texttt{n} font did. Under the \texttt{T1} encoding, 
the result would instead have been that some of the accented letters 
would incorrectly have been replaced by the ligatures.

The pairs tables show that the four extra ligatures work as ligatures 
and the symbols table looks exactly as for the \texttt{T1R}\slash
\texttt{zcm}\slash\texttt{m}\slash\texttt{n} font.

\bigskip
\DemoTOneLaTeXFont{T1R}{zcm}{m}{a}

\end{document}