(http://www.faximum.com/technotes/217)
*** DRAFT *** DRAFT *** DRAFT *** DRAFT *** DRAFT *** DRAFT *** DRAFT *** TITLE: #217 - Notes on Adding Fonts to the X11 Font Server KEYWORDS: X11 font server fontserver glyph adobe scalable type 1 RELEASE: All CLASSIFICATION: All PROBLEM: This TN documents how to add a new scalable font to the X11 font server so that the asciitiff utility that is part of many Faximum Software packages can utilise fonts that may not be available to it. CAUSE: N/A SOLUTION: Although Faximum's asciitiff conversion program has access to all of the scalable fonts available from a server's X11 font server, it may be the case that the user wishes to generate faxes using fonts that are not available from the font server. This TN outlines the steps to add a new font. The general procedure is to: i) obtain the necessary scalable fonts in Type 1 format; ii) convert (if necessary) .pfb files to .pfa files; iii) edit your X11 font server configuration files and add the new fonts; iv) restart the font server and test; and v) redefine (if desired) the default font(s) used by asciitiff. I. Finding Fonts ------------------ There are, broadly speaking, two methods for obtaining fonts: 1) purchase the necessary fonts from a type foundry; or 2) locate public domain or free fonts on the Internet. In either case what you are looking for are fonts that are in Adobe Type 1 format. The font files themselves will have either a .pfb or .pfa extension. For the purposes of this TechNote we will illustrate the process by using as an example the need for Greek fonts. If you wish to download the files that we used to add Greek fonts to a Faximum fax server, please download: ftp://ftp.faximum.com/pub/technotes/217-files.tar or ftp://ftp.faximum.com/pub/technotes/217-files.tgz (The first is a tar file, the second a gzip-compressed tar file.) A search of the Internet revealed that the best source of free Type 1 (scalable) Greek fonts was a package that was part of the Debian Linux distribution (the package we used was called "xfonts-greek-ph-scalable_1.1-2.deb"). After unpacking this archive file (using "ar" and "cpio") we obtained 12 Type 1 font files: grkarib.pfb grkaribi.pfb grkarii.pfb grkarip.pfb grkcurb.pfb grkcurbi.pfb grkcuri.pfb grkcurp.pfb grktimb.pfb grktimbi.pfb grktimi.pfb grktimp.pfb along with the all-important font.dir file which contained (all of the data between the ===== lines): =========================================================================== 12 grkcurp.pfb -grinet-greek courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 grkcurb.pfb -grinet-greek courier-bold-r-normal--0-0-0-0-m-0-iso8859-1 grkcuri.pfb -grinet-greek courier-medium-i-normal--0-0-0-0-m-0-iso8859-1 grkcurbi.pfb -grinet-greek courier-bold-i-normal--0-0-0-0-m-0-iso8859-1 grktimp.pfb -grinet-greek times-medium-r-normal--0-0-0-0-p-0-iso8859-1 grktimb.pfb -grinet-greek times-bold-r-normal--0-0-0-0-p-0-iso8859-1 grktimi.pfb -grinet-greek times-medium-i-normal--0-0-0-0-p-0-iso8859-1 grktimbi.pfb -grinet-greek times-bold-i-normal--0-0-0-0-p-0-iso8859-1 grkarip.pfb -grinet-greek arial-medium-r-normal--0-0-0-0-p-0-iso8859-1 grkarib.pfb -grinet-greek arial-bold-r-normal--0-0-0-0-p-0-iso8859-1 grkarii.pfb -grinet-greek arial-medium-i-normal--0-0-0-0-p-0-iso8859-1 grkaribi.pfb -grinet-greek arial-bold-i-normal--0-0-0-0-p-0-iso8859-1 =========================================================================== II. Converting the Font Files ============================== Some X11 font servers can handle binary Type 1 font files (i.e. .pfb files) directly while others require the files to be in ASCII (i.e. .pfa) format. If your font server can use .pfb file you can skip to the next part of this TechNote. If, on the otherhand, you need to convert your .pfb files to .pfa format then you either need to have access to a copy of the Adobe Acrobat Distiller or be a brave soul and try to use GhostScript. The tool we used to convert our .pfb files to .pfa is called pfb2pfa.ps and was written by Don Lancaster. Free copies of this utility are available from his website at www.tinaja.com Since his utility is well documented we will not spend any more time discussing how to use it other than to say that the files it produces have the lines of each .pfa file terminated with a carriage return character. Since UNIX and Linux systems prefer lines terminated with a newline character we found we had to run the "tr" utility on the resulting .pfa files to make them digestible to the X11 font server. For example: mv grkarib.pfa grkarib.cr tr '\015' '\012' < grkarib.cr > grkarib.pfa III. Configuring the X11 Font Server ==================================== Now that you have your fonts you need to tell your X11 font server about them. The first step is to find where on your system your X11 font server stores its configuration file. Looking at the man pages for the "fs" or "xfs" utility may provide some guidance. Otherwise look in the obvious places such as: /etc/X11/fs/config /usr/lib/X11/fs/config /usr/openwin/X11/fs/config Once you have found the config file look in it to see where the Type 1 fonts are stored. Once such config file we looked at contained (in part): =========================================================================== catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled, /usr/X11R6/lib/X11/fonts/75dpi:unscaled, /usr/X11R6/lib/X11/fonts/100dpi:unscaled, /usr/X11R6/lib/X11/fonts/misc, /usr/X11R6/lib/X11/fonts/Type1, /usr/X11R6/lib/X11/fonts/Speedo =========================================================================== It is obvious that in this example the Type 1 fonts are stored in /usr/X11R6/lib/X11/fonts/Type1. So we copied all of our .pfa files into this directory. Then we edited the fonts.dir file in the Type1 directory and added the contents of our fonts.dir file (see above in Part I), without the first line (containing the number of fonts in the directory, 12 in this case). Then we updated the first line of the original fonts.dir file in the Type1 directory to contain the new count of the number of fonts in the file. Note that since we had converted our original .pfb format fonts into .pfa format, we had to change both the names of the files (from, for exampe, grkarib.pfb to grkarib.pfa) and the names of the font files in the fonts.dir file. IV. Restarting the Font Server and Testing the Fonts ===================================================== How you restart your font server will depend on the system you are using. For example, on Red Hat Linux we used: /etc/rc.d/init.d/fs stop /etc/rc.d/init.d/fs start Your mileage will vary and you will need to consult the documentation for your system. Or, you could just reboot :-) To test the new font(s) you will need to create a file that tells asciitiff to set a new font. For example, a simple such as: =========================================================================== $[font "-grinet-greek times-medium-r-normal-*-*-100-200-200-p-0-iso8859-1"] 20 |21 ! |22 " |23 # |24 $ |25 % |26 & |27 ' | 28 ( |29 ) |2a * |2b + |2c , |2d - |2e . |2f / | 30 0 |31 1 |32 2 |33 3 |34 4 |35 5 |36 6 |37 7 | 38 8 |39 9 |3a : |3b ; |3c < |3d = |3e > |3f ? | 40 @ |41 A |42 B |43 C |44 D |45 E |46 F |47 G | 48 H |49 I |4a J |4b K |4c L |4d M |4e N |4f O | 50 P |51 Q |52 R |53 S |54 T |55 U |56 V |57 W | 58 X |59 Y |5a Z |5b [ |5c \ |5d ] |5e ^ |5f _ | 60 ` |61 a |62 b |63 c |64 d |65 e |66 f |67 g | 68 h |69 i |6a j |6b k |6c l |6d m |6e n |6f o | 70 p |71 q |72 r |73 s |74 t |75 u |76 v |77 w | 78 x |79 y |7a z |7b { |7c | |7d } |7e ~ |7f | a0 |a1 ¡ |a2 ¢ |a3 £ |a4 ¤ |a5 ¥ |a6 ¦ |a7 § | a8 ¨ |a9 © |aa ª |ab « |ac ¬ |ad |ae ® |af ¯ | b0 ° |b1 ± |b2 ² |b3 ³ |b4 ´ |b5 µ |b6 ¶ |b7 · | b8 ¸ |b9 ¹ |ba º |bb » |bc ¼ |bd ½ |be ¾ |bf ¿ | c0 À |c1 Á |c2 Â |c3 Ã |c4 Ä |c5 Å |c6 Æ |c7 Ç | c8 È |c9 É |ca Ê |cb Ë |cc Ì |cd Í |ce Î |cf Ï | d0 Ð |d1 Ñ |d2 Ò |d3 Ó |d4 Ô |d5 Õ |d6 Ö |d7 × | d8 Ø |d9 Ù |da Ú |db Û |dc Ü |dd Ý |de Þ |df ß | e0 à |e1 á |e2 â |e3 ã |e4 ä |e5 å |e6 æ |e7 ç | e8 è |e9 é |ea ê |eb ë |ec ì |ed í |ee î |ef ï | f0 ð |f1 ñ |f2 ò |f3 ó |f4 ô |f5 õ |f6 ö |f7 ÷ | f8 ø |f9 ù |fa ú |fb û |fc ü |fd ý |fe þ |ff ÿ | =========================================================================== V. Redefine the Default Font(s) for Asciitiff =============================================== For information on how to set the default fonts for asciitiff please see TechNote 217 (http://www.faximum.com/technotes/217). TechNote: 217 - Copyright 2000 Faximum Software Inc., All Rights Reserved. Last Updated: Thu Jun 22 21:26:25 PDT 2000 The complete set of Faximum TechNotes are available on the Internet at http://www.faximum.com/TechSupport© Copyright 2001 Faximum Software Inc. All Rights Reserved.