1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
|
%----------------------------------------------------------------------------
% ----- File: intro.tex
% ----- Author: Rainer Menzner (rmz@neuroinformatik.ruhr-uni-bochum.de)
% ----- Date: 04/19/1998
% ----- Description: This file is part of the t1lib-documentation.
% ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-1998.
% As of version 0.5, t1lib is distributed under the
% GNU General Public Library Lincense. The
% conditions can be found in the files LICENSE and
% LGPL, which should reside in the toplevel
% directory of the distribution. Please note that
% there are parts of t1lib that are subject to
% other licenses:
% The parseAFM-package is copyrighted by Adobe Systems
% Inc.
% The type1 rasterizer is copyrighted by IBM and the
% X11-consortium.
% ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-)
% ----- Credits: I want to thank IBM and the X11-consortium for making
% their rasterizer freely available.
% Also thanks to Piet Tutelaers for his ps2pk, from
% which I took the rasterizer sources in a format
% independ from X11.
% Thanks to all people who make free software living!
%----------------------------------------------------------------------------
\newpage
\section{Introduction}
\subsection{What Does \tonelib\ Do?}
\tonelib\ is a library written in the C programming language
allowing a programmer to generate bitmaps from Adobe (TM) Type 1 fonts
quite easily. These bitmaps are returned in a data structure
with type {\ttfamily GLYPH}. This special
{\ttfamily GLYPH}-type is also used in the X11 window system to
describe character bitmaps. It contains the bitmap data as well as
some metric information. But \tonelib\ is in itself entirely independent
of the X11-system or any other graphical user interface.
Given that the X11-system is probably the most frequently used
window system in the UNIX-world, and furthermore assuming that most
graphical applications run under window systems, it appears that
\tonelib\ implements functionality already provided by the
graphical user interface,
the X11-system. Thus the question arises: Why not use X11 directly for
rastering characters? Well, the answer is quite simple; the X11 Font
machinery appears to be too {\em static} in order to use it for
certain purposes. Moreover X11-calculations and positioning of
characters are based on bitmap
dimensions and are thus subject to error accumulation.
Here is a list of features which are supported in the current release
of \tonelib.
\begin{itemize}
\item Rasterizing is done as characters get requested. The X11-server,
in contrast,
rasters a font completely at a given size
when it is loaded. {\em Rastering on demand} saves time when the
font is loaded the first time and saves memory since often only the
alphabetic letters and a few other characters are needed.
\item The encoding mechanism of PostScript is fully supported. The
user may use the fonts' internal or some other encoding.
Additional encoding files can be loaded at runtime and fonts can be
reencoded at runtime. The syntax of encoding files is
straight-forward and simple.
\item The library makes use of Adobe Font Metric data in the form of
AFM files. This may seem a disadvantage, but in order
to make decent typesetting possible, some more information than that
contained in Type 1 font files is needed. Besides, Adobe makes
these AFM files freely available on their ftp-server for all
registered Type 1 fonts.
\item In case AFM files are missing, \tonelib\ is able to generate
metrics information in charspace accuracy by rastering each
character at 1000~bp.
\item In addition to generation of character bitmaps, there is a way
to directly raster strings of any length in a given font.
The space-width may explicitly be corrected by the user. This
may be needed by word processing applications.
\item Strings may be rastered
optionally using pairwise kerning information from
the AFM file. Kerning is an important feature of good
quality typesetting.
Kerning information can also be requested by the user without
rasterization.
\item Ligature information is made available to the user in an
efficient way. Use of Ligatures is another characteristic of good
typesetting. As to my
knowledge, only \TeX\ and all related macro-packages are able to
handle ligatures in a natural and efficient way.
\item Rotation is supported. Characters and strings may be rastered at
arbitrary angles specified in degrees. The rotation is done before
rastering for optimal quality.
\item \tonelib\ supports antialiasing. In this case, a pixel is
represented as a byte, word or double word. Antialiasing is
implemented by subsampling with factor 2 only. But this seems
sufficient for the moment. If you use the X11-interface introduced in
\tonelib\ V.\ 0.3-beta,
even colored antialiasing between any pair of colors is provided in a
completely transparent way.
\item To a certain degree, fonts may be transformed. Horizontal
expansion of fonts is fully supported and since version 0.3-beta
also {\em slanting} of fonts is nearly fully supported.
For restrictions and drawbacks of slanting fonts see
\ref{transformations} on page \pageref{transformations}.
\item Paths, the library searches for the different needed file types
are specified at runtime by means of a
configuration file. They may thus be changed without needing to
recompile the application. For example, the directories of the
X11-system's Type 1 font files may be specified there in order to use
these fonts with the library. A user may have his own configuration file and
as a fallback/default there is a system wide configuration file. This should
be setup when the library is installed.
\item Since of version 0.3-beta a special set of functions is provided which
implements a more comfortable X11-interface. This is due to the fact that
X11 is the only standard window system in the UNIX world. However, as before
\tonelib\ may be compiled and used without even having X11 installed.
\end{itemize}
There are also some problems and features not yet
implemented, but likely to be implemented in the future.
The main problem up to now is:
\begin{itemize}
\item The font cache isn't a font cache really. At this time all
bitmaps are saved by always allocating more memory from the
system. No automatic removal of bitmaps no longer needed is
done. However, the user has the possibility of explicitly
removing data, if he thinks it is not needed anymore.
\end{itemize}
\subsection{Copyrights and Credits}
There are some copyrights on parts of the library and there are some
programmers (or corporations) which I want to give credit.
The library uses:
\begin{itemize}
\item[--] all internal parts of the X11-rasterizer donated to
the X11-project by IBM. This rasterizer does the {\em real} hard
work of scan-conversion.
\item[--] the modifications to the rasterizer done by Piet
Tutelaers in his ps2pk-package. The main purpose was decoupling the
sources from the X11-system sources.
\item[--] the \verb+parse_AFM+ software which was made freely available
by Adobe. This is used to parse the AFM files (what
a surprise) and to generate the data structures the information is
saved in.
\end{itemize}
Raph Levien (\verb+raph@acm.org+) contributed an algorithm for
sampling down non-antialiased bitmaps to antialiased bitmaps in a very
efficient manor. This makes antialiasing a lot faster.
Fred L.\ Drake, Jr. (\verb+fdrake@acm.org+) wrote a Python interface to
\tonelib, which is distributed with \tonelib. This wrapper is called
\verb+t1python+ and allows Python-programmers to use Type 1 fonts. I
can not tell anything more on this topic since I do not know the
Python language. All questions concerning the Python interface should
thus be addressed to Fred L.\ Drake, Jr.
\begin{center}
\Large Thanks!
\end{center}
\subsection{Motivation}
The idea of writing this library was due to the SciTeXt-project which
was founded in 1996. They needed a font raster system with some more
functionality than X11 provided. You may find that some things (for
example the format of the font database file) is really closely
related to SciTeXt. In February '{}97 the SciTeXt developers decided to
migrate from C to Java and did not need a font rasterizer any more. Since I
thought there could be other applications for this library I continued the
work on it and voila.
\subsection{About Version 0.4-beta}
Version 0.4-beta is improved mainly in two directions:
\begin{itemize}
\item There are many memory (re)allocating bugs corrected which had
not shown up before but which were present, nonetheless. \tonelib\
is now tested against \verb+libefence+, which should reduce the
probability of remaining errors a lot.
\item \tonelib\ should be somewhat faster with this release. I did some
profiling and it turned out that dealing with character names was
really an executiontime-hog. Metrics- and kerning-handling are now
rewritten and work on the encoding-vector index. This requires more
time when fonts are loaded and reencoded, but speeds up execution
of the corresponding functions up to 10 times, depending on data
context.
Antialiasing is also improved in performance thanks to Raph Levien
(see above). Furthermore, padding bitmaps to 16 and 32 bit scanlines
is now also implemented. Depending on rendersize, machine
architecture and data, padding to higher levels might also speed up
execution by some amount.
\end{itemize}
Aside of this, a few functions have been added to the interface
because they have been reported to be of interest by users.
The internals of the X11 interface have completely changed from
V.~0.3-beta to V.~0.4-beta. See \ref{x11interface} for a discussion on
this.
\subsection{About Version 0.5-beta}
0.5 beta is improved in several directions.
Aside from the usual bug
fixing work the following topics are of importance:
\begin{itemize}
\item \tonelib\ is now distributed under the LGPL. A definitive
license was needed and I found LGPL to be the best.
\item Dealing without AFM files. This is important because
many freeware fonts come completely without AFM
information. Moreover, having unreliable or incomplete AFM
information has proven to be prone to result in segmentation
violations. \tonelib\ is now able to generate AFM files (see
\ref{type1afm}).
\item The initialization machinery is somewhat more flexible, allowing
small applications not to depend on a font database file and configuration
file. Fonts may now be added to the database at runtime. See again
section \ref{type1afm} for a typical example for such kind of applications.
\item The FontInfo data is now completely accessible.
\item \tonelib\ now compiles and runs on 64 bit
systems. In this context, large parts have been adapted so that
\tonelib\ (the \verb+t1lib+-subdirectory) should now be more ANSI-C
compliant and should thus compile on more systems.
\end{itemize}
\subsection{About Version 0.6-beta}
This is a bug fix and clean-up release that brings no new features. In
particular,
\begin{itemize}
\item the sources in \verb+T1-.../lib/type1+ have been cleaned up to
come closer to ANSI-C and compile without many warnings.
\item The X11 interface has been completely separated from the rest of
the stuff. There are now distinct libraries and include files for
\tonelib\ and the X11 wrapper.
\item Support for compilers other than gcc is better with this version.
\end{itemize}
\subsection{About Version 0.7-beta}
This version brings several new features and enhancements:
\begin{itemize}
\item A modified \verb+glyph+-structure which simplifies handling and placing
rotated glyphs.
\item A global variable \verb+T1_errno+ is introduced which simplifies error
handling.
\item \tonelib\ compiles and runs on VMS.
\item Underlining, overlining and overstriking is implemented.
\end{itemize}
\subsection{How to Reach the Author/How to Get \tonelib}
If you have questions, comments or bug reports, you can reach me by
email. The address is
\begin{center}
\verb+Rainer.Menzner@neuroinformatik.ruhr-uni-bochum.de+
\end{center}
If you have bug-reports, it would be best if you could reproduce the error
using the test program \verb+xglyph+ (see \ref{xglyph}).
\tonelib\ is available by anonymous ftp as\\[5mm]
\verb+ftp://ftp.neuroinformatik.ruhr-uni-bochum.de/pub/software/t1lib/t1lib-0.7-beta.tar.gz+
\\[5mm]
and \\[5mm]
\verb+ftp://sunsite.unc.edu/pub/Linux/libs/graphics/t1lib-0.7-beta.tar.gz+
|