4540
|
1 |
|
4555
|
2 |
%$Id$
|
3188
|
3 |
|
|
4 |
\chapter{Fonts and character encodings}
|
|
5 |
|
7882
|
6 |
Using the print mode mechanism of Isabelle, variant forms of output become
|
9695
|
7 |
very easy. As the canonical application of this feature, Pure and major
|
|
8 |
object-logics (FOL, ZF, HOL, HOLCF) support optional input and output of
|
7882
|
9 |
proper mathematical symbols as built-in option.
|
3217
|
10 |
|
7882
|
11 |
Symbolic output is enabled by activating the ``\ttindex{symbols}'' print mode.
|
|
12 |
User interfaces (e.g.\ \texttt{isa-xterm}, see \S\ref{sec:interface}) usually
|
|
13 |
do this already by default.
|
3188
|
14 |
|
7882
|
15 |
\medskip Displaying non-standard characters requires special screen fonts. The
|
|
16 |
\texttt{installfonts} utility takes care of this (see
|
|
17 |
\S\ref{sec:tool-installfonts}). Furthermore, some {\ML} systems disallow
|
|
18 |
non-\textsc{ascii} characters in literal string constants. This problem is
|
|
19 |
avoided by appropriate input filtering (see \S\ref{sec:tool-symbolinput}).
|
3217
|
20 |
|
7882
|
21 |
These things usually happen behind the scenes. Users normally do not have to
|
|
22 |
read the explanations below, unless something really fails to work.
|
3217
|
23 |
|
|
24 |
|
3262
|
25 |
\section{Telling X11 about the Isabelle fonts --- \texttt{isatool installfonts}}
|
3217
|
26 |
\label{sec:tool-installfonts}
|
|
27 |
|
7882
|
28 |
The \tooldx{installfonts} utility ensures that your currently running X11
|
|
29 |
display server (as determined by the \texttt{DISPLAY} environment variable)
|
|
30 |
knows about the Isabelle fonts. Its usage is:
|
3188
|
31 |
\begin{ttbox}
|
|
32 |
Usage: isatool installfonts
|
|
33 |
|
|
34 |
Install the isabelle fonts into your X11 server.
|
3217
|
35 |
(May be safely called repeatedly.)
|
|
36 |
\end{ttbox}
|
7882
|
37 |
Note that this need not be called manually under normal circumstances --- user
|
|
38 |
interfaces depending on the Isabelle fonts usually invoke
|
3262
|
39 |
\texttt{installfonts} automatically.
|
3217
|
40 |
|
7882
|
41 |
\medskip As simple as this might appear to be, it is not! X11 fonts are a
|
|
42 |
surprisingly complicated matter. Depending on your network structure, fonts
|
|
43 |
might have to be installed differently. This has to be specified via the
|
|
44 |
\settdx{ISABELLE_INSTALLFONTS} variable in your local settings.
|
3217
|
45 |
|
7882
|
46 |
\medskip In the simplest situation, X11 is used only locally, i.e.\ the client
|
|
47 |
program (Isabelle) and the display server are run on the same machine. In that
|
|
48 |
case, most X11 display servers should be happy by being told about the
|
|
49 |
Isabelle fonts directory as follows:
|
3217
|
50 |
\begin{ttbox}
|
7849
|
51 |
ISABELLE_INSTALLFONTS="xset fp+ $ISABELLE_HOME/lib/fonts; xset fp rehash"%$
|
3217
|
52 |
\end{ttbox}
|
7882
|
53 |
The same also works for remote X11 sessions in a largely homogeneous network,
|
|
54 |
where any X11 display machine also mounts the Isabelle distribution under the
|
|
55 |
\emph{same} name as the client side.
|
3217
|
56 |
|
7882
|
57 |
\medskip Above method fails, though, if the display machine does have the font
|
|
58 |
files at the same location as the client. In case your server is a full
|
|
59 |
workstation with its own file system, you could in principle just copy the
|
|
60 |
fonts there and do an appropriate \texttt{xset~fp+} manually before running
|
|
61 |
the Isabelle interface. This is very awkward, of course. It is even impossible
|
|
62 |
for proper X11 terminals that do not have their own file system.
|
3217
|
63 |
|
7882
|
64 |
A much better solution is to have a \emph{font server} offer the Isabelle
|
|
65 |
fonts to any X11 display on the network. There are already suitable servers
|
|
66 |
running at Munich and Cambridge. So in case you have a permanent Internet
|
|
67 |
connection to either site, you may just attach yourself as follows:
|
3217
|
68 |
\begin{ttbox}
|
|
69 |
ISABELLE_INSTALLFONTS="xset fp+ tcp/isafonts.informatik.tu-muenchen.de:7200"
|
3188
|
70 |
\end{ttbox}
|
3695
|
71 |
or
|
|
72 |
\begin{ttbox}
|
|
73 |
ISABELLE_INSTALLFONTS="xset fp+ tcp/font-serv.cl.cam.ac.uk:7100"
|
|
74 |
\end{ttbox}
|
3188
|
75 |
|
7882
|
76 |
\medskip In the unfortunate case that neither local fonts work, nor accessing
|
|
77 |
our world-wide font service is practical, it might be best to start your own
|
|
78 |
in-house font service. This is in principle quite easy to setup. The program
|
|
79 |
is called \texttt{xfs} (sometimes just \texttt{fs)}, see the \texttt{man}
|
|
80 |
pages of your system. There is an example fontserver configuration available
|
|
81 |
in the \texttt{lib/fontserver} directory of the Isabelle distribution.
|
4540
|
82 |
|
|
83 |
|
|
84 |
\section{Check for non-ASCII characters --- \texttt{isatool nonascii}}
|
4555
|
85 |
\label{sec:tool-nonascii}
|
3262
|
86 |
|
7882
|
87 |
The \tooldx{nonascii} utility checks files for non-\textsc{ascii} characters:
|
4540
|
88 |
\begin{ttbox}
|
|
89 |
Usage: nonascii [FILES|DIRS...]
|
|
90 |
|
|
91 |
Recursively find .thy/.ML files and check for non-\textsc{ascii}
|
|
92 |
characters.
|
|
93 |
\end{ttbox}
|
7882
|
94 |
Under normal circumstances, non-\textsc{ascii} characters do not appear in
|
|
95 |
theories and proof scripts.
|
3188
|
96 |
|
3217
|
97 |
|
|
98 |
\section{Filtering non-ASCII characters --- \texttt{isatool symbolinput}}
|
|
99 |
\label{sec:tool-symbolinput}
|
3188
|
100 |
|
7882
|
101 |
Processing non-\textsc{ascii} text is notoriously difficult. In particular,
|
|
102 |
some {\ML} systems reject character codes outside the range 32--127 as part of
|
|
103 |
literal string constants. In order to circumvent such restrictions, Isabelle
|
|
104 |
employs a general notation where glyphs are referred by some symbolic name
|
|
105 |
instead of their actual encoding: the general form is
|
|
106 |
\verb|\<|$charname$\verb|>|.
|
3262
|
107 |
|
7882
|
108 |
The \tooldx{symbolinput} utility converts an input stream encoded according to
|
|
109 |
the standard Isabelle font layout into pure \textsc{ascii} text. There is no
|
|
110 |
usage --- \texttt{symbolinput} just works from standard input to standard
|
|
111 |
output, without any options available.
|
3262
|
112 |
|
7882
|
113 |
\medskip For example, the non-\textsc{ascii} input string \texttt{"A $\land$ B
|
|
114 |
$\lor$ C"} will be replaced by \verb|"A \\<and> B \\<or> C"|. Note that the
|
|
115 |
\verb|\| are escaped, accommodating concrete {\ML} string syntax.
|
3262
|
116 |
|
7882
|
117 |
\medskip In many cases, it might be wise not to rely on symbolic characters
|
|
118 |
and avoid non-\textsc{ascii} text in files altogether (see also
|
|
119 |
\S\ref{sec:tool-nonascii}). Then symbolic syntax would be really optional,
|
|
120 |
with always suitable \textsc{ascii} representations available. In syntax
|
|
121 |
definitions, symbols appear only in mixfix annotations (using the
|
|
122 |
\verb|\<|$charname$\verb|>| form), while proof texts are left in plain
|
|
123 |
\textsc{ascii}. Thus users with \textsc{ascii}-only facilities will still be
|
|
124 |
able to read your files.
|
5364
|
125 |
|
|
126 |
%%% Local Variables:
|
|
127 |
%%% mode: latex
|
|
128 |
%%% TeX-master: "system"
|
|
129 |
%%% End:
|