This guide considers the issues of installation of the fonts in the X11 window system and the Ghostscript program used for printing.
To simplify this installation the distribution package of the converter contains a number of scripts written in shell and Perl. So, to run them you will need a shell interpreter (Bourne-shell, POSIX-shell, Korn-shell are OK, ba-shell is probably also OK but not tested yet). The Perl scripts were tested with Perl5 but probably should work with Perl4 too. All the scripts are located in the `scripts' subdirectory.
*8* There are two ways of dealing with this problem:
1. To make the encoding described in the font look like the Latin-1
encoding as much as possible, so that in the worst case only
the characters with codes 127-160 will be lost
2. To fix the library
This distribution supports both of them. First, here is a script named `forceiso' that forces the font to have the encoding bottom-up compatible to Latin-1. Second there is a patch that can be applied to the X11 library.
NOTE: Some manufacturers (such as Hewlett Packard) provide their own versions of the font libraries/servers, and this case should be treated separately and with caution. Incidentally the font server from HP-UX 10.20 works well enough as it is, it just has to be configured properly. A short description of the HP font server configuration is provided in the file INSTALL.hpux.
*8* To fix the X11 font library, you have to get the X11 sources. I can recommend the ftp sites of the XFree86 project ftp://ftp.xfree86.org or of the Open Group ftp://ftp.x.org. This patch was made on the sources of XFree86 so you may have better success with applying it to the XFree86 distribution. After you have got the sources, make sure that you can compile them. Then apply the patch by a command like:
(cd /usr/X11R6/xc && patch; ) <Xpatch.dfMake sure that it was applied properly. Compile the sources again (actually, you need only the fonts library, the fonts server, and possibly the X server). It would be prudent now to save your old font library, font server and, possibly, X server. Then install the new recently compiled versions of these files. Of course, if you know someone who already has compiled these files for the same OS as yours, you can just copy the binary fles from him.
Let's suppose that you have already compiled the ttf2pt1 converted and also obtained and compiled the Type 1 utilities.
Put all the TTF fonts you want to convert into some directory (this may be just the directory that already contains all the Windows fonts on a mounted FAT filesystem).
*8* Another interesting thing is that some languages have more than one widely used character encodings. For example, the widely used encodings for Russian are IBM CP-866 (MS-DOS and Unix), KOI-8 (Unix and VAX, also the standard Internet encoding), IBM CP-1251 (MS Windows). That's why I have provided the means to generate the converted fonts in more than one encoding. See the file encodings/README for details about the encoding tables.
Now it's time to look at the contents of the `script' directory. The script named `convert' is the master one. It includes the configuration file `convert.cfg' with the most often changed configuration variables. The distribution contains no file `convert.cfg' but don't despair yet. It has instead the sample file `convert.cfg.sample'. Please copy it to `convert.cfg', look inside it and change the configuration variables. The more stable configuration variables, such as the path names of the scripts and encoding files are located in `convert' itself.
They are:
SRCDIRS - the list of directories (with absolute paths) with TTF fonts. Each line contains 3 fields: the name of the directory, the language of the fonts in it (if you have fonts for different languages you have to put them into the separate directories) and the encoding of the fonts. Again, if you have some of the TTF typefaces in one encoding, and some in another (say, CP-1251 and KOI-8), you have to put them into the separate source directories.
DSTDIR - directory for the resulting Type1 fonts. Be careful ! This directory gets completely wiped out before conversion, so don't use any already existing directory for this purpose.
DSTENC{language} - the list of encodings in which the destination fonts will be generated for each language. Each font of that language will be generated in each of the specified encodings. If you don't want any translation, just specify both SRCENC and DSTENC as iso8859-1 (or if you want any other encoding specified in the fonts.dir, copy the description of 8859-1 with new name and use this new name for SRCENC and DSTENC).
FOUNDRY - the foundry name to be used in the fonts.dir file. I have set it to `ttf' to avoid name conflicts with any existing font for sure. But this foundry name is not registered in X11 standards and if you want to get the full standard compliance or have a font server that enforces such a compliance, use `misc'.
The next few parameters control the general behavior of the converter.
DONTCORRECTWIDTH - if the value is set to YES then don't use the
converter option -w, otherwise use it. See the description of
this option in the
REMOVET1A - if the value is set to YES then after conversion remove the un-encoded .t1a font files and the intermediate .xpfa font metric files.
INSTALLFONTMAP - a Ghostscript parameter, if the value is set to YES then install the entries for the new fonts right into the main Fontmap file. Otherwise just leave the file Fontmap.ttf in the Ghostscript configuration directory.
The following parameters are used to locate the other scripts and configuration files. By default they get the values that suppose that you are running `convert' with `scripts' subdirectory being the current directory.
ENCDIR - directory containing the descriptions of encodings T1ASM, TTF2PT1, TRANS, T1FDIR, FORCEISO - paths to the other script
Also there are a few parameters controlling the installation of fonts for Ghostscript. Please look at their description in the Ghostscript section before running `convert'.
Finally, run the `convert' script. Look at the result and the log file in DSTDIR.
Add the directory with newly converted fonts to the configuration of X server or font server. For most of the systems this step is very straightforward. For HP-UX it's rather tricky and poorly documented, so the file INSTALL.hpux gives a short description.
If you don't have the privileges of the root user, you still can configure your private font server. Just use some non-standard port number (see INSTALL.hpux for an example, exept that you won't need all the HP-related stuff on any other system).
DSTDIR - the X11 font directory used by `x2gs' as the source of the fonts. This parameter common with the X11 configuration.
GSDIR - the base directory of Ghostsript. If this parameter is set to an empty string then `convert' won't call `x2gs'. So if you want to get only the X11 fonts installed then set this parameter to an empty string. This directory may vary on various system, so please check your system and set this value accordingly before running the script.
GSFONTDIR - the font directory of Ghostscript. In the standard Ghostscript installation it's a subdirectory of GSDIR but some systems may use completely different directories.
GSCONFDIR - the configuration subdirectory of Ghostscript that contains the Fontmap file.
INSTALLFONTMAP - if the value is set to YES then install the entries for the new fonts right into the main Fontmap file. Otherwise just leave the file Fontmap.ttf in the Ghostscript configuration directory.
Run the script. It symbolicaly links all the font files and creates the description file Fontmap.ttf in GSCONDFIR. After that there are two choices.
If the option INSTALLFONTMAP was set to YES then the font descriptions are also automatically installed into the master Fontmap file. The script is clever enough to detect if it was run multiple times with the same directories and if so it replaces the old Fontmap entries with the new ones instead of just accumulating all of them. You may also run it multiple times for multiple X11 directories and all the results will be properly collected in the Fontmap. But it's your responsibility to watch that the names of the font files don't overlap. If the X11 font directory gets renamed then you have to remove its font entries from the Fontmap and only after that re-run `x2gs' for the new directory.
On the other hand if the option INSTALLFONTMAP was set to NO then go to the GSCONFDIR directory and insert the contents of Fontmap.ttf into the Fontmap file manually. This step may be left manual to make the installation a little bit more safe.
After that you may also want to redefine some of the aliases in Fontmap to refer to the newly installed fonts. But the redefinition of the aliases may be dangerous if the width of characters in the new font will be different from the old font. Alas, there is no visible solution of this problem yet.
*8* Netscape is known to generate the PostScript files that force the fonts to have ISO Latin-1 encoding. If the characters in range 127-160 are not used, this does not make a trouble. But if they are neccessary (for example, to print some russian text in CP-866), the script `nsfilter' can be used to filter the files created by Netscape from their ideas about encodings.
- The Type1 font library from the standard X11 distribution does not work on HP-UX (at least, up to 10.01). The font server supplied with HP-UX up to 10.01 is also broken. Starting from HP-UX 10.20 (I don't know about 10.10) they supply a proprietary font library and the converted fonts work fine with it, provided that they are configured properly (see the file INSTALL.hpux).
- The fonts.scale files created by the previous version of the ttf2pt1 installation program (up to 3.1r) have conflicted with the language definitions of the Xfsft font server and parts of it included into XFree86. To overcome this incompatibility this version creates the fonts.scale file describing all the fonts as belonging to the adobe-fontspecific encoding and the fonts.alias file with the proper names. The drawback of this solution is that xlsfonts gives the list of twice more fonts.