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