Technical Information Database TI285D.txt Creating and Using Fonts in the Resource Workshop Category :General Programming Platform :All Product :Pascal All Description: Detailed below is a step by step description of how a Windows font file (.FON) is created using Borland's Resource Workshop and Turbo Pascal for Windows. 1. With the Resource Workshop, create a Resource file and save it to a file in compiled .RES format.. This is best done by creating a resource script (a file with the extension .RC) and selecting the .RES option for MultiSave found in the File/Preferences menu. 2. In Turbo Pascal for Windows, create a library similar to the one described below. library NewFont; {$D FONTRES 100,96,96 : NewFont 12 (VGA res)} {$M 1024, 0} {$R NewFont} begin end. The font NewFont is used in this example. You may give your fonts any name desired. Of the compiler directives, the Description directive gives the resolution of the font and provides a description of the font. In the example, the values 100, 96, 96 represent the Aspect, LogPixelsX, LogPixelsY for the device normally used with the font (in this case VGA). Aspect is calculated from the expression (100*AspectY) div (AspectX). The values AspectX, AspectY, LogPixelsX, and LogPixelsY are accessible through the API function GetDeviceCaps. If you like, you may have more than one set of Aspect, LogPixelX, and LogPixelY values. For NewFont, this could take the form of the following. Each set of values is separated by a semi-colon and space. {$D FONTRES 100,96,96; 200,96,48; 133,96,72 : NewFont 12 (VGA res)} For font files, the description directive must start with the term FONTRES in order for the font to be recognized as a valid Windows font file. It is also very important not to separate values within a set of Aspect, LogPixelX, LogPixelY values with spaces. Windows may not recognize a file with values so delimited. 3. Compile the library just created to a .DLL file. 4. Rename the .DLL file to one with the extension .FON. In the case of NewFont, NEWFONT.DLL would be renamed to NEWFONT.FON. 5. Often, .FON are copied into the Windows directory \WINDOWS\SYSTEM and then added using the Control Panel program. Note, Microsoft's Control Panel program may not function correctly with fonts that do encompass the entire alphabet. Reference: 7/16/98 4:33:41 PM
Last Modified: 01-SEP-99