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