Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!news.mathworks.com!zombie.ncsc.mil!newsgate.duke.edu!news-feed-1.peachnet.edu!paperboy.wellfleet.com!news3.near.net!amber.ora.com!not-for-mail From: norm@ora.com (Norman Walsh) Newsgroups: comp.fonts,comp.answers,news.answers Subject: comp.fonts FAQ: MS-DOS Info Supersedes: Followup-To: poster Date: 14 Aug 1996 10:34:49 -0400 Organization: O'Reilly and Associates, Inc. Lines: 606 Sender: norm@ruby.ora.com Approved: news-answers-request@MIT.Edu Distribution: world Expires: 27 Sep 1996 14:34:08 GMT Message-ID: References: Reply-To: norm@ora.com (Norman Walsh) NNTP-Posting-Host: ruby.ora.com Summary: This posting answers frequently asked questions about fonts. It addresses both general font questions and questions that are specific to a particular platform. X-Web-Homepage: http://www.ora.com/homepages/comp.fonts/ Xref: senator-bedfellow.mit.edu comp.fonts:48306 comp.answers:20520 news.answers:79241 Archive-name: fonts-faq/part8 Version: 2.1.5 Subject: 3. MS-DOS Information The easiest way to get outline fonts under MS-DOS is with Microsoft Windows 3.x or OS/2 2.x. Microsoft Windows 3.0 with Adobe Type Manager (ATM) and OS/2 2.0 support PostScript Type1 fonts. Microsoft Windows 3.1 supports TrueType fonts natively. Bitmap fonts are available in a variety of formats: most formats are designed with the printer in mind and not the display since (prior to graphical environments like Windows, GEM, and OS/2) the majority of work under MS-DOS was done with a character-based interface. Subject: 3.1. Frequently Requested MS-DOS fonts Many fonts are available at various archives. The biggest font archive for MS-DOS format fonts is ftp.cica.indiana.edu. Note: you can use any Mac format Type1 font on your PC by converting it to PC format with the free/shareware as described below. The following fonts are in Type 1 format for MS-DOS. Some are also available in TrueType format. * Hebrew ShalomScript, ShalomOldStyle, ShalomStick * Japanese Shorai * Star Trek Crillee, TNG monitors * IBM OEM Line Drawing Characters Try Adobe PrestigeElite or Adobe LetterGothic. They have all the characters you want, but the `line draw' characters are unencoded -- you will need tools to reencode the outline font itself and make a new PFM metric files. Or try IBMExtended from Impramatur Systems in Cambridge, Mass. It already is encoded using IBM OEM encoding (some DOS code page). The IBM version of Courier distributed freely under the X11 Consortium also contains the appropriate characters. Again, the font will have to be reencoded for Windows. Appropriate AFM files for this font can be obtained from: http://www.ora.com/homepages/comp.fonts/FAQ-tools.html. Lee Cambell suggests the following alternative: Line Drawing characters are also available on ftp sites as gc0651.exe which is a self-expanding archive. It is on cica (and mirrors thereof). From the text file that comes with it, it looked like it was distributed by Microsoft. I printed some text in the normal A-z range and it looked identical to the truetype Courier font distributed with Windows. Perhaps it is an upgrade to that font. I didn't try the linedraw glyphs, so I can't say how they look. Subject: 3.2. MS-DOS Font Installation If you have any information that you feel belongs in this section, it would be greatly appreciated. * Windows * Pat Farrell contributes the following description of font installation under Windows. Installing Fonts into Windows: This only covers Windows 3.1 with ATM. Font is a four-letter word in Windows versions prior to 3.1 due to the distinctions between screen fonts and printer fonts. The upgrade price of Windows 3.1 is justified by the integration of TrueType into the package and the inclusion of useful fonts for all printers. Commercial fonts usually have installation instructions with their manuals. The approach may differ from the method used for PD and shareware fonts. To install PD and shareware fonts in Windows 3.1: 1. Copy the fonts onto a suitable scratch area (i.e. a floppy, or any temporary area of your hard disk. 2. Execute "Control Panel" by double-clicking on the icon in the Windows Program Manager's "main" group. 3. Double-click on the Fonts icon. 4. Double-click on the "Add" button. 5. Select the scratch directory holding the new fonts. 6. A list of the fonts will be displayed. You can manually select the fonts you like, or you can use the "Select All" button. 7. Make sure the "Copy Fonts to Windows Directory" check-box is checked. This will copy the fonts from the scratch area to your Windows directory. 8. Click on the "Ok" button. * Special notes for Windows applications: Word for Windows (W4W) stores font/printer information in its own initialization files. After you add new fonts, you have to tell W4W that the printer can use the new fonts. Do this by selecting "Printer Setup" from the W4W main "File" menu item, click on the "Setup" button, and then click on two "Ok" buttons to back out of the setup mode. * Note concerning Windows 3.1 upgrade: There are two upgrade packages available from Microsoft for Win3.1. There is the standard version which contains TrueType support, and about six font families (Times New Roman, Arial, Courier, Symbols, Wingdings, etc.). It costs something like $50 (US). The second version contains a number of TrueType fonts that includes equivalents for the 35 standard Postscript fonts. This adds an additional $50, which is a pretty good value. However, if you plan on buying Microsoft's PowerPoint, it includes the same additional fonts/typefaces. So you can save money by not buying the fonts twice. * More about Windows * [Q:] Why are don't the TrueType fonts that come with Microsoft products (Word-for-Windows, PowerPoint, Windows 3.1 TrueType Font Pack, etc.) display and print properly on my system? * [A:] The font matching algorithm in Win3.1 is fairly simplistic. If you install lots of TrueType fonts, the algorithm can get confused. In this case, "lots" is more than 50 or so. * According to Luann Vodder who supports Microsoft Word on CompuServ: "There is a procedure which Windows must go through when an application requests a font. Each font contains a list of attributes such as Family, FaceName, Height, Width, Orientation, Weight, Pitch, etc. When an application requests a font, it fills out a logical font for Windows containing the necessary attributes, then starts going through a font mapping algorithm to determine which of the installed fonts most closely matches the requested (logical) font. Penalties are applied against fonts whose attributes do not match the logical font, until the fonts with the fewest penalties are determined. If there is a "tie", Windows may need to rely on the order of the fonts in the WIN.INI file to determine the "winner". If the fonts you want are in your WIN.INI file, and show up in Windows' Control Panel, then try moving them higher in your WIN.INI file with a file edittor such as SYSEDIT." * Kesh Govinder suggested the following warning: CAUTION: While many Windows 3.1 users would like to have many TrueType fonts at their disposal (and they are many available in the PD) a word of caution. A large number (>50) TT fonts will slow down your windows startup time. This occurs as every installed font is listed in the win.ini file, and Windows has to go through the entire file before starting up. While this may not affect most users, it will especially affect users of CorelDraw!, so be warned. * Other Programs It is an unfortunate fact that almost all MS-DOS programs do things differently. Your best bet is to read the manual that comes with the program you want to use. Subject: 3.3. What exactly are the encodings of the DOS code pages? DOS uses `code pages' for `IBM OEM' encoding of fonts. There are six code pages supplied with DOS 5.0: 437 (English) 850 (Multilingual - Latin I) 852 (Slavic - Latin II) 860 (Portugal) 863 (Canadian French) 865 (Nordic) (The character code range 0 - 127 is the same in all code pages). The problem is that MS idea of how to define what a code page is, is to show a low resolution print out of the glyphs! Which is fine for the letters of the alphabet, numerals and the obvious punctuation marks, but worthless for accents (is it `cedilla' or `ogonek'? is it `caron' or `breve'?) and many other characters. For example, 249 is a small dot, while 250 is a slightly larger dot. Is one of these supposed to be `bullet' (which already occurs at 7)? Or is one of them maybe supposed to be `middot' or `dotcentered'? Is 228 supposed to be `Sigma' or `summation'. Is 225 supposed to be `beta' or `germandbls'? Etc etc And what is the character that looks like `Pt' in code position 158? Anyway, surely there is a table somewhere that defines precisely what these encodings are supposed to be. That is, a table that gives for each code number the name and/or a description of the character. Subject: 3.4. MS-DOS Font Utilities * PS2PK PS2PK allows you to convert PostScript Type1 fonts into bitmap fonts. The bitmap files produced are in TeX PK format. * PKtoSFP PKtoSFP allows you to convert TeX PK fonts into HP LaserJet softfonts. * PFBDir/PFBInfo PFBDir and PFBInfo format and display the "headers" in a binary Type1 font. Subject: 3.5. Converting fonts under MS-DOS Subject: 3.5.1. Converting Mac Type 1 fonts to MS-DOS format Converting Macintosh Type1 fonts into PC Type1 fonts can be done using purely free/shareware tools. I've outlined the procedure below. Make sure you read the "readme" files that accompany many fonts. Some font authors specifically deny permission to do cross-platform conversions. The tools you need ================== XBIN xbin23.zip in /pub/msdos/mac on oak.oakland.edu (or other mirrors) UNSIT unsit30.zip in /pub/msdos/mac on oak.oakland.edu UNSITI unsiti.exe in /pub/onset/util on ftp.std.com Peter Gentry indicates that this program can extract SIT archives that use the newer compression techniques that unsit doesn't recognize. UNCPT ext-pc.zip in /pub/pc/win3/util on ftp.cica.indiana.edu REFONT refont14.zip from http://www.ora.com/homepages/comp.fonts/FAQ-tools.html BMAP2AFM bm2af02.zip from http://www.ora.com/homepages/comp.fonts/FAQ-tools.html XBIN converts Mac "BinHex"ed files back into binary format. BinHex is the Mac equivalent of UUencoding, it translates files into ascii characters so that mailers can send them around without difficulty. It also aids in cross platform copying too, I'm sure. BinHexed files generally have filenames of the form "xxx.yyy.HQX". UNSIT explodes "Stuffit" archives. Stuffit archives generally have filenames of the form "xxx.SIT". UNSIT will ask if you want to seperate resource and data forks. Yes, you do. There has been some confusion about whether or not you want headers. I'm inclined to conclude that it can be made to work either way. Personally, I say no. UNCPT explodes "Compactor" archives. The ext-pc implementation is called "extract" and does not require windows (even thought it's in the windows section on cica). Compactor archives generally have filenames of the form "xxx.CPT". REFONT converts Mac type1 fonts into PC type1 fonts. It also converts Mac TrueType fonts to PC TrueType format. And vice-versa. BMAP2AFM constructs AFM files from the metric information contained in Mac screen fonts (.bmap files). The screen font files do not have any standard name (although they frequently have the extension .bmap). The screen fonts have file type "FFIL" which, in combination with some common sense, is usually sufficient to identify them. I've listed the tools that I've used and the sites that are reasonable for me to retrieve them from. It's probably a good idea to check with archie for closer sites if you're not in North America. These tools run under MS-DOS. XBIN and UNSIT can also be run under Unix. How to do it? ============= Collect the Mac fonts from the archive or BBS of your choice. Most of these files will be in BinHexed format. As a running example, I'm going to use the imaginary font "Plugh.cpt.hqx". When I download this font to my PC, I would use the name "PLUGH.CPX". The actual name you use is immaterial. Run XBIN on PLUGH.CPX. This will produce PLUGH.DAT, PLUGH.INF, and PLUGH.RSR. The data fork of the Mac file (the .DAT file) is the only one of interest to us, you can delete the others. If the original file had been "Plugh.sit.hqx", we would be using the UNSIT program. Since I chose a .cpt file for this example, I'm going to run UNCPT. Run UNCPT on PLUGH.DAT. You want to extract the AFM file (if present), the documentation or readme file (if present), and the Type1 outline file. The AFM and README files will be in the data fork of the archive file. The Type1 outline will be in the resource fork. The AFM and README files have Mac "TEXT" type. The Type1 outline file has "LWFN" type. I'm not trying to describe this part in a step-by-step fashion. Use the docs for UNCPT and UNSIT as a guide. If you got this far you probably won't have much difficulty. If you do, drop me a line and I'll try to help. If the font does not contain an AFM file, extract the screen font. Screen fonts frequently have the extension .bmap and are "FFIL" type files. Use Bmap2AFM to construct an AFM from the screen font. If the archive _does_ contain an AFM file, it's safe to bet that the author's AFM will be better than the one created by Bmap2AFM. Finally, run REFONT on the Type1 outline that you extracted above. The result should be an appropriate PC type1 outline. REFONT will create a PFM file for you from the AFM file, if you desire. Remember to register your shareware... Other comments ============== vkautto@snakemail.hut.FI makes the following observations: * UNCPT is easier to use than UNSIT * UNCPT has to be run twice. I usually do it like this extract *.cpt -f extract *.cpt -f -r * When using "unsit30" you probably want the outline file with the MacHeader and the others without it. I think that REFONT requires it but I am not sure. * REFONT works usually ok. You want a PFA (ASCII) file which is directly usable on NeXT (you may need to convert carriage-returns to newlines but I am not sure if it is necessary). The biggest problem is with the .afm files that are completely missing or generated by the tools that don't do their job properly. * BMAP2AFM requires some extra files (ie. other than bmap2afm.exe) to work properly. Subject: 3.5.2. Converting PC Type 1 and TrueType fonts to Mac format Refont ====== Refont (version 1.4) can convert (in both directions) between PC and Mac formats of Type1 and TrueType fonts. Note: it _cannot_ convert _between_ formats, only architectures. The procedure described above outlines how to convert a Mac archive into PC format so that you can get at the data. Presumably, the process can be reversed so that you can get at the data on the Mac side as well. Unfortunately, I don't have a Mac so I can't describe the process in detail. Font Manipulation Package ========================= The Y\&Y Font Manipulation package can convert PFA/B files into Mac format and AFM files into Mac screen fonts. Subject: 3.5.3. Converting PC Type 1 fonts into TeX PK bitmap fonts The release of PS2PK by Piet Tutelaers is a godsend to those of us without PostScript printers. PS2PK converts PC/Unix format Type 1 fonts into TeX PK files. Used in conjunction with the AFM2TFM utility for creating TeX metric files, this allows almost anyone to use Type 1 PostScript fonts. PS2PK is distributed under the GNU License and has been made to run under MS-DOS with DJGPP's free GNU C compiler. The PC version requires a 386 or more powerful processor. Check with Archie for a source near you. Note: if TeX PK files are not directly usable for you, there seems to be a fair possibility that LaserJet softfonts would be useful. If so, check below for instructions on converting TeX PK files to LaserJet softfonts. Subject: 3.5.4. Converting TeX PK bitmaps into HP LaserJet softfonts (and vice-versa) There is some possibility that someone will yell 'conflict of interest' here, but I don't think so. I wrote the following utilities: PKtoSFP: convert TeX PK files to LaserJet (bitmapped) softfonts SFPtoPK: convert LaserJet (bitmapped) softfonts to TeX PK files But they are completely free, so I don't gain anything by "advertising" them here. These are MS-DOS platform solutions only. If you know of other solutions, I would be happy to list them. This is Info file compfont.info, produced by Makeinfo-1.55 from the input file FAQ.texinfo. Subject: 3.5.5. TrueType to HP LaserJet bitmap softfonts (HACK!) If you have the tools, the following suggestion does work, but it isn't easy and it hasn't been automated. To be honest, I haven't really tested it. If you are using Windows 3.1, get a LaserJet printer driver (you don't need the printer, just the driver). Using the LaserJet driver, direct output to a file and print a simple file containing all the letters you want in the softfont in the font that you are converting. When the print job has completed, the output file will contain, among other things, a LaserJet softfont of the TrueType font you selected. If you know the LaserJet format, you can grab it out of there. I didn't say it was easy ;-) This method will not work with ATM [ed: as of 7/92] because ATM does not construct a softfont; it downloads the whole page as graphics. Here is an overview of the LaserJet bitmap softfont format. It should help you get started. If you have any questions, ask norm. If anyone wants to write better instructions... ;-) Many details are omitted from this description. They are thoroughly discussed in the HP Technical Reference for each model of laser printer. I recommend purchasing the Tech Ref. If you have additional questions and do not plan to purchase the Tech Ref (or do not wish to wait for its arrival), you can ask norm. An HP LaserJet softfont can occur almost anywhere in the output stream destined for the printer. In particular, it does _not_ have to be wholly contiguous within the output file. In fact, fonts can be "intermixed" at will. The following "pieces" make up a font: A begin font descriptor command (followed by the descriptor) and a series of begin character descriptor commands (followed by their associated data). When a new character descriptor is encountered, it is added to the current font (which may change between descriptors). In the discussion that follows, the following notational conventions are followed: Key elements are surrounded by quotation marks. The quotation marks are not part of the element. Spaces within the element are for clarity only, they are not part of the element. All characters (except ESC and #, described below, are literal and must be entered in the precise case shown). ESC means the escape character, ASCII character number 27 decimal. # means any decimal number. The meaning of the number is described in the commentary for that element. * What is a font descriptor? A font descriptor begins with a font descriptor command and is followed immediately by the data for the descriptor. Font descriptors define data global to the font. In general, more recent printers are less strict about these parameters than older printers. * What is the font descriptor command? "ESC ) s # W" In this command, # is the number of bytes in the descriptor. The first element of the descriptor indicates how many of these bytes should be interpreted as the font descriptor (the remaining bytes are commentary only-to the printer, at least). This area is frequently used for copyright information, for example, although some systems insert kerning data into this area. * What is the font descriptor data? The data is: UI Font descriptor size UB Descriptor format UB Font type UI Reserved (should be 0) UI Baseline distance UI Cell width UI Cell height UB Orientation B Spacing UI Symbol set UI Pitch UI Height UI xHeight SB Width Type UB Style SB Stroke Weight UB Typeface LSB UB Typeface MSB UB Serif Style SB Underline distance UB Underline height UI Text Height UI Text Width UB Pitch Extended UB Height Extended UI Cap Height UI Reserved (0) UI Reserved (0) A16 Font name ?? Copyright, or any other information UI = unsigned integer, SI = signed integer, UB = unsigned byte, SB = signed byte, B = boolean, and A16 =sixteen bytes of ASCII. After the font name, ?? bytes of extra data may be inserted. These bytes pad the descriptor out to the length specified in the begin font descriptor command. Note: integers are always in big-endian order (MSB first). * What is a character descriptor? A character descriptor describes the character specific info and the layout of the bitmap. Newer printers can accept compressed character bitmaps. * What is a character descriptor command? "ESC * c # E" The # is the length of the descriptor, in bytes. * What is the character descriptor data? UB Format B Continuation UB Descriptor size UB Class UB Orientation SI Left offset SI Top offset UI Character width UI Character height SI Delta X ?? Character (bitmap) data. Although older printers cannot accept characters that include continuations, newer printers can. If the "continuation" field is 1, the character bitmap data begins immediately after that byte and the remaining fields _are not_ present. * Ok, now I understand the data, what do I look for in the output stream? ESC * c # D defines the font number (remember the number). ESC ) s # W defines the font descriptor (as described above). ESC * c # E specifies the character code (the #, in this case). The next character descriptor maps to this position in the font. Characters do not have to appear in any particular order. ESC ( s # W defines the character descriptor (as described above). Remember, these can occur in any order. Experimentation with the particular driver you are using may help you restrict the number of different cases that you have to be prepared for. Please report your experiences using this method to norm (both to satisfy his own curiosity and to help improve the FAQ). Subject: 3.6. MS-DOS Screen Fonts (EGA/VGA text-mode fonts) Editors note: the following description was mercilessly stolen from comp.archives on 02SEP92. It was originally Yossi Gil's posting. FNTCOL14.ZIP contains more than 200 text mode fonts for EGA/VGA displays. It includes fonts in different sizes for Hebrew, Greek, Cyrillic, math symbols and various type styles including smallcaps and script. It is available at borg.poly.edu:/pub/reader/dos/fntcol14.zip