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 |
|
9984
|
11 |
Basic symbolic output is enabled by activating the ``\ttindex{symbols}'' print
|
|
12 |
mode. User interfaces (e.g.\ \texttt{isa-xterm}, see \S\ref{sec:interface})
|
|
13 |
usually do this already by default. More advanced support is provided by
|
|
14 |
Proof~General~\cite{proofgeneral} when used together with the X-Symbol package
|
|
15 |
\cite{x-symbol}; the corresponding print mode is ``\ttindex{xsymbols}'' (plain
|
|
16 |
``\ttindex{symbols}'' is activated as well).
|
3188
|
17 |
|
7882
|
18 |
\medskip Displaying non-standard characters requires special screen fonts. The
|
|
19 |
\texttt{installfonts} utility takes care of this (see
|
|
20 |
\S\ref{sec:tool-installfonts}). Furthermore, some {\ML} systems disallow
|
|
21 |
non-\textsc{ascii} characters in literal string constants. This problem is
|
|
22 |
avoided by appropriate input filtering (see \S\ref{sec:tool-symbolinput}).
|
3217
|
23 |
|
7882
|
24 |
These things usually happen behind the scenes. Users normally do not have to
|
|
25 |
read the explanations below, unless something really fails to work.
|
3217
|
26 |
|
|
27 |
|
3262
|
28 |
\section{Telling X11 about the Isabelle fonts --- \texttt{isatool installfonts}}
|
3217
|
29 |
\label{sec:tool-installfonts}
|
|
30 |
|
7882
|
31 |
The \tooldx{installfonts} utility ensures that your currently running X11
|
|
32 |
display server (as determined by the \texttt{DISPLAY} environment variable)
|
|
33 |
knows about the Isabelle fonts. Its usage is:
|
3188
|
34 |
\begin{ttbox}
|
9984
|
35 |
Usage: installfonts [OPTIONS]
|
|
36 |
|
|
37 |
Options are:
|
|
38 |
-x install X-Symbol fonts
|
3188
|
39 |
|
9984
|
40 |
Installs symbol fonts on the current X11 server.
|
3217
|
41 |
\end{ttbox}
|
9984
|
42 |
|
|
43 |
The \texttt{-x} option installs fonts for the X-Symbol package
|
|
44 |
\cite{x-symbol}, rather than the basic Isabelle ones.
|
|
45 |
|
7882
|
46 |
Note that this need not be called manually under normal circumstances --- user
|
|
47 |
interfaces depending on the Isabelle fonts usually invoke
|
3262
|
48 |
\texttt{installfonts} automatically.
|
3217
|
49 |
|
7882
|
50 |
\medskip As simple as this might appear to be, it is not! X11 fonts are a
|
|
51 |
surprisingly complicated matter. Depending on your network structure, fonts
|
|
52 |
might have to be installed differently. This has to be specified via the
|
9984
|
53 |
\settdx{ISABELLE_INSTALLFONTS} (or \settdx{XSYMBOL_INSTALLFONTS}) variables in
|
|
54 |
your local settings.
|
3217
|
55 |
|
7882
|
56 |
\medskip In the simplest situation, X11 is used only locally, i.e.\ the client
|
|
57 |
program (Isabelle) and the display server are run on the same machine. In that
|
|
58 |
case, most X11 display servers should be happy by being told about the
|
|
59 |
Isabelle fonts directory as follows:
|
3217
|
60 |
\begin{ttbox}
|
11616
|
61 |
ISABELLE_INSTALLFONTS="xset fp+ $ISABELLE_HOME/lib/fonts; xset fp rehash"
|
|
62 |
\end{ttbox}%$
|
7882
|
63 |
The same also works for remote X11 sessions in a largely homogeneous network,
|
|
64 |
where any X11 display machine also mounts the Isabelle distribution under the
|
|
65 |
\emph{same} name as the client side.
|
3217
|
66 |
|
7882
|
67 |
\medskip Above method fails, though, if the display machine does have the font
|
|
68 |
files at the same location as the client. In case your server is a full
|
|
69 |
workstation with its own file system, you could in principle just copy the
|
|
70 |
fonts there and do an appropriate \texttt{xset~fp+} manually before running
|
|
71 |
the Isabelle interface. This is very awkward, of course. It is even impossible
|
|
72 |
for proper X11 terminals that do not have their own file system.
|
3217
|
73 |
|
7882
|
74 |
A much better solution is to have a \emph{font server} offer the Isabelle
|
|
75 |
fonts to any X11 display on the network. There are already suitable servers
|
|
76 |
running at Munich and Cambridge. So in case you have a permanent Internet
|
|
77 |
connection to either site, you may just attach yourself as follows:
|
3217
|
78 |
\begin{ttbox}
|
|
79 |
ISABELLE_INSTALLFONTS="xset fp+ tcp/isafonts.informatik.tu-muenchen.de:7200"
|
3188
|
80 |
\end{ttbox}
|
3695
|
81 |
or
|
|
82 |
\begin{ttbox}
|
|
83 |
ISABELLE_INSTALLFONTS="xset fp+ tcp/font-serv.cl.cam.ac.uk:7100"
|
|
84 |
\end{ttbox}
|
3188
|
85 |
|
7882
|
86 |
\medskip In the unfortunate case that neither local fonts work, nor accessing
|
|
87 |
our world-wide font service is practical, it might be best to start your own
|
|
88 |
in-house font service. This is in principle quite easy to setup. The program
|
|
89 |
is called \texttt{xfs} (sometimes just \texttt{fs)}, see the \texttt{man}
|
|
90 |
pages of your system. There is an example fontserver configuration available
|
|
91 |
in the \texttt{lib/fontserver} directory of the Isabelle distribution.
|
4540
|
92 |
|
|
93 |
|
|
94 |
\section{Check for non-ASCII characters --- \texttt{isatool nonascii}}
|
4555
|
95 |
\label{sec:tool-nonascii}
|
3262
|
96 |
|
7882
|
97 |
The \tooldx{nonascii} utility checks files for non-\textsc{ascii} characters:
|
4540
|
98 |
\begin{ttbox}
|
|
99 |
Usage: nonascii [FILES|DIRS...]
|
|
100 |
|
|
101 |
Recursively find .thy/.ML files and check for non-\textsc{ascii}
|
|
102 |
characters.
|
|
103 |
\end{ttbox}
|
7882
|
104 |
Under normal circumstances, non-\textsc{ascii} characters do not appear in
|
|
105 |
theories and proof scripts.
|
3188
|
106 |
|
3217
|
107 |
|
|
108 |
\section{Filtering non-ASCII characters --- \texttt{isatool symbolinput}}
|
|
109 |
\label{sec:tool-symbolinput}
|
3188
|
110 |
|
7882
|
111 |
Processing non-\textsc{ascii} text is notoriously difficult. In particular,
|
|
112 |
some {\ML} systems reject character codes outside the range 32--127 as part of
|
|
113 |
literal string constants. In order to circumvent such restrictions, Isabelle
|
|
114 |
employs a general notation where glyphs are referred by some symbolic name
|
|
115 |
instead of their actual encoding: the general form is
|
|
116 |
\verb|\<|$charname$\verb|>|.
|
3262
|
117 |
|
7882
|
118 |
The \tooldx{symbolinput} utility converts an input stream encoded according to
|
|
119 |
the standard Isabelle font layout into pure \textsc{ascii} text. There is no
|
|
120 |
usage --- \texttt{symbolinput} just works from standard input to standard
|
|
121 |
output, without any options available.
|
3262
|
122 |
|
7882
|
123 |
\medskip For example, the non-\textsc{ascii} input string \texttt{"A $\land$ B
|
|
124 |
$\lor$ C"} will be replaced by \verb|"A \\<and> B \\<or> C"|. Note that the
|
|
125 |
\verb|\| are escaped, accommodating concrete {\ML} string syntax.
|
3262
|
126 |
|
7882
|
127 |
\medskip In many cases, it might be wise not to rely on symbolic characters
|
|
128 |
and avoid non-\textsc{ascii} text in files altogether (see also
|
|
129 |
\S\ref{sec:tool-nonascii}). Then symbolic syntax would be really optional,
|
|
130 |
with always suitable \textsc{ascii} representations available. In syntax
|
|
131 |
definitions, symbols appear only in mixfix annotations (using the
|
|
132 |
\verb|\<|$charname$\verb|>| form), while proof texts are left in plain
|
|
133 |
\textsc{ascii}. Thus users with \textsc{ascii}-only facilities will still be
|
|
134 |
able to read your files.
|
5364
|
135 |
|
10862
|
136 |
|
|
137 |
\section{Remove unreadable symbol names from sources --- \texttt{isatool unsymbolize}}
|
|
138 |
|
|
139 |
The \tooldx{unsymbolize} utility tunes Isabelle theory sources to improve
|
|
140 |
readability for plain ASCII output (e.g.\ in mail communication). Most
|
|
141 |
notably, \texttt{unsymbolize} replaces arrow symbols such as
|
|
142 |
\verb|\<Longrightarrow>| by \verb|==>|.
|
|
143 |
\begin{ttbox}
|
|
144 |
Usage: unsymbolize [FILES|DIRS...]
|
|
145 |
|
|
146 |
Recursively find .thy/.ML files, removing unreadable symbol names.
|
|
147 |
Note: this is an ad-hoc script; there is no systematic way to replace
|
|
148 |
symbols independently of the inner syntax of a theory!
|
|
149 |
|
|
150 |
Renames old versions of FILES by appending "~~".
|
|
151 |
\end{ttbox}
|
|
152 |
|
5364
|
153 |
%%% Local Variables:
|
|
154 |
%%% mode: latex
|
|
155 |
%%% TeX-master: "system"
|
|
156 |
%%% End:
|