\magnification=\magstep1
\input nice
\def\mynum#1{\ifnum #1<10 0\the#1\else \the#1\fi}
\def\mymonth#1{\ifcase#1 \or January \or February \or March \or April
   \or May \or June \or July \or August
   \or September \or October
   \or November \or December \fi}

\def \Flib {Flib}
\def \DVIprint {DVIprint}
\def \ShowDVI {ShowDVI}

\def\tbw {\hskip 10pt \it to be written $\ldots$}

\article
\contentslevel=1
\contfill={\dotfill}
\contskip=6pt
\let\scstyle=\bf

\titlepage
\vskip 1in
\title{\Flib{}, the Fontlibrary program}
\removelastskip
\smallskip
\title{for the AMIGA}
\bigskip
\release{Version 1.03}
\smallskip
\release{vom}
\release {\mynum{\day}. \mymonth{\month}\mynum{\year}}
\bigskip
\author{by}
\author{Georg He\ss{}mann}
\author{translation by Thomas Tavoly}
\vfill
\abstract{
  \Flib{} is a program for making and administration of
  fontlibraries. These are libraries, in which many PK-Fonts
  are bundled together. The advantage of libraries in respect to
  single files is the space savings on disk or harddisk,
  the better overview and the faster access to the particular
  elements. These libraries are useb by the \TeX{}-drivers \ShowDVI{}
  and \DVIprint{}.
}
\vskip 1.2in
\endtitlepage



\medskip
\plainsection{Table of contents:}
\medskip
\makecontents
\bigskip

\section{Copyright and similar}
The program \Flib{} is ``copyrighted Public Domain''. This means
anyone can distribute the program and change it considering some
limitations. Firstly, the program retains my Copyright.
The Copyright must not be deleted from the program text.
and the Copyright mention must be further at least per option
be displayable. All alterations, which have been made to the program,
must be conferred to me, as for me to be able
to adjust the versions as possible.
These Copyright stipulations are also present on the beginning of the file
``flib.c'' and must not be deleted from there either. Also, the files
flib.c, flib.tex as well as the corresponding README file must
always be distributed together.
In return anyone can use the program as he/she likes and distribute
it commercially or non-commercially\footnote{This goes only
for the \Flib{} program and {\it not} for the other programs}.

For further explanation see the README file.

\section{\Flib{} - generals}
\Flib{} is a utility program for the \TeX-drivers \ShowDVI{} and
\DVIprint{}. It is there for bundling the PK-Fonts of a particular
resolution in one file, since this has some convincing advantages.

Firstly, you could name the space savings. As every single
file always consists of a multiple of the block size of the current
File System, on average half a block is thrown away at each file too.
On certain operating systems, an entire block is needed for every directory
entry also. That means, that per file a waste of one and a half blocks
is to be expected. In case of about 100 modules per library, approximately
150 blocks are saved in this manner.

But there are other advantages. There are the better overview and also
the faster access just to name a few. As you mostly need several fonts
of one reslution, you only need to open one file,
and read the directory there. After that every access to
a font is only an ``fseek'' command. As this way for each
resolution only one file has to be opened, you can keep this
open all the time the program is running. Thus you avoid
a constant opening and closing of files.

The \Flib{} program is however not only specialized in PK-Fonts.
In theory you can archive every type of file in a library.
As the program source is available for the \Flib program,
other programs could be adjusted to it, who load a lot of help
files.

\section{Calling Flib}

The syntax for calling is as follows:

\hskip 1cm {\tt usage: flib c$|$a$|$x$|$d$|$z$|$p$|$l$|$t[v] library [-$|$[modules]*]}
\smallskip

\staggered{\quad\tt c,a}
\key{\quad\tt c\rm ,\tt a}
 appends a module to a library. Does the library not yet
 exist, then it is created. If the module is already in
 the library, it is replaced.
\key{\quad\tt x}
 copies the module from the library to an own file with the name
 of the module. If no module is supplied, then all modules
 are copied from the library.
\key{\quad\tt d}
 deletes a module from a library. If the module was the last
 one in the library, then the library is deleted.
\key{\quad\tt t}
 ouputs the list of all modules in the library.
\key{\quad\tt r}
 renames all indicated modules. To this end the new name
 is expected from the console (stdin).
\key{\quad\tt z}
 transforms fontlibraries of the old type to the current
 version. All newly created libraries are automatically
 of the new type.
\key{\quad\tt p}
 tests all modules, whether they are still correct. To this end
 a checksum is created at the creation of the library and
 stored in the directory of the library.
\key{\quad\tt l}
 creates a library-link. The call looks
 in this case like this:\parwithoutskip
 \centerline{flib l \it link-name dest-name}
 At this, a library {\it link-name} is created, which is actually a pointer
 to a library with the name {\it dest-name}.
 This is used for example in case you need fontlibraries of
 the resolutions 109 dpi and 110 dpi, but due to memory
 limitations you only want one of them to be held on the harddisk.
 As the difference between the both fontlibraries is not so
 big, you could decide to hold only one of them on harddisk,
 and create the other only as a link.
\key{\quad\tt v}
 switches verbose mode on. This flag can be switched with
 every one of the above otions. Normally only error
 messages are displayed. With the {\tt v} option all actions
 are protocolled. This is especially useful in case of
 more complicated operations.
\endstaggered

In case of all commands you can indicate an arbitrary number of
modules behind the library name. The possibility exists however, to
supply on a minus (--). Then all module names are read from the
console (stdin) (one module per line),
until an end of file character comes.

\section{The structure of the libraries}
In case of the libraries, two different types must be recognized:
Firstly the library, in which the modules are actually stored, and
secondly all the other libraries, which consist of only a link to another
library.

\subsection{Real libraries}
The fontlibraries consist of three parts. At the beginning of the library
a library header is present, then comes the library-directory and then
the modules themselves.

The library header exists from two 32-bit words (longwords). The first one
is the ``magic-number'', which consists of the four characters ``FLIB''.
After that the directory size. It has not have to be exactly equal to the
number of modules in the library. Directory entries can be shown as unused.

The directory of the library consists of the directory entries.
The number is stored in two longwords. A directory entry looks
like this:
\beginverbatim
  struct new_flib_dirent { char  mname[22];          /* module name   */
                           unsigned short checksum;  /* checksum      */
                           long  size;               /* size in bytes */
                           long  where;              /* position      */
                         };
\endverbatim
At which {\tt mname} is the modulename, {\tt checksum} the checksum,
{\tt size} the size of the module and {\tt where} the position of
the module inside the library. When {\tt where} is equal zero, then
the directory entry is unused.

In case of all these number indications, the byte order is to be
paid attention to. The 680x0 processor format is used. Thus first always
the ``least significant byte'' and then the ``most significant byte''.
The output routines of the \Flib{} program are written in a way that
they create and read the wanted format on other processors,
too.

The third and last (largest) part of the library are the particular
modules, which are simply put behind one another.

\subsection{Library Links}
Library links have a very simple structure, which can in theory
also be created with a text editor. For example:
$$\hbox{``{\tt FLNK<\it PK0110\tt >}''}$$
This is a library link to a library with the name {\it PK0110}.

So, the magic word is here {\tt FLNK}. After that the actual name
of the directory is coming, to which the link should be pointing,
enclosed between smaller than and greater than signs.

\section{Portability}
The program is written in ANSI-C, but can be compiled with a normal
C-Compiler by altering a define.
The program has been compiled and tested on the Amiga, Atari, Sun 3,
Sun SPARC and a DECstation under AMIGA DOS, ATARI TOS and UNIX
(SunOS/ULTRIX).

Translation from German to English by Thomas Tavoly -Sep.'90.
\bye
