summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/dialogl/fontmenu.tex
blob: 8812fab1fa191319030f9fa294ac6a790361a420 (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
% Copyright 1994 Michael John Downes
% Copyright 2013 TeX Users Group
% This file is part of the dialogl package, released under the LPPL;
% see dialogl.ins for details.

\def\ComputerModern{\gdef\fontbase{Times}\gobble}
\def\Garamond{\gdef\fontbase{Computer Modern}\gobble}
\def\Helvetica{\gdef\fontbase{Garamond}\gobble}
\def\Malibu{\gdef\fontbase{Helvetica}\gobble}
\def\Times{\gdef\fontbase{Malibu}\gobble}

\def\gobble#1\endgobble{}

%    Make sure we have a reasonable \newlinechar
\newlinechar=`\^^J \catcode\newlinechar=12

\begingroup
\catcode`\<=1 \catcode`\ =2\relax
\gdef\menustart{\errmessage<%
....................................... }%
\endlinechar\newlinechar\catcode`\ =12\relax
\gdef\menutext{
 .......................................
 .......................................

  Select the font base you wish to use:

  [1] Computer Modern        [4] Malibu
  [2] Garamond               [5] Times
  [3] Helvetica

  (Default: Times)}%
\endgroup% percent here to avoid extra \newlinechar

\begingroup
\immediate\write16{\menutext}
%    If the user accidentally types 33 instead of 3 they will get past
%    all the legitimate menu choices. So to keep that from causing
%    trouble, we throw in a bunch of ~ characters below to perform
%    error recovery. The standard maximum number of tokens that TeX
%    will delete at one time is 99.
\catcode`\~=\active % just to make sure
\def~{\newlinechar`\^^J% restore normal value
  \message{%
Whoops! Well, you got Times as your font base, I think}%
  \gobble}
%    Minimize unwanted error context (note: setting
%    this to -1 doesn't suppress any more information)
\errorcontextlines 0
\newlinechar=`\! % to hide the automatic ! from \errmessage
\gdef\fontbase{Times}
%    Inside the next group we make the space character
%    active so that we can  use it to call \menustart,
%    and then we use \expandafter so that the first
%    space on the next line gets that catcode before
%    the \endgroup makes it revert to normal. All this
%    so that the user does not see `\menustart' on
%    screen, only a space.
\begingroup
\catcode`\ =\active\let =\menustart\expandafter\endgroup%
 % Enter a number (1...5) and press Return TWICE
\ComputerModern% Press Return to continue
\Garamond% Press Return to continue
\Helvetica% Press Return to continue
\Malibu% Press Return to continue
\Times% Press Return to continue
\gobble%
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
\endgobble\endgroup%
\show\fontbase
\end