The information in this article applies to:
SUMMARY
MyFont.exe is a sample file that demonstrates how to use the normal linker.
MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center. Click the file names below to download the files: http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. Basic Steps (Overview)I. Create font files using the Font Editor. II. Create a font-resource script. III. Create a dummy code module. IV. Create a module-definition file that describes the fonts. V. Compile and link the sources.NOTE: Read Chapter 18 of the "Microsoft Windows Software Development Kit Guide to Programming." The following procedure is very similar. Step I: Create a Font File
Note 2: The names of the font formats are deceiving. Windows 3.0-compatible format works only in 386 enhanced mode. Window 2.0-compatible format works in all modes; therefore, it is usually better to save fonts in 2.0 format. Step II: Create a Font Resource Script
Step III: Create a Dummy Code Module
Step IV: Create a Module Definition File
NOTE: The DESCRIPTION statement specifies a string that describes the font attributes, and supplies a comment that is displayed by the Windows Control Panel when the font is loaded.
WINSTUB.exe is a small file that prints the message "This application requires Microsoft Windows" if the user tries to run the application under MS-DOS. The NONE attribute indicates that the library does not require its own automatic data segment. The description string MUST begin with the FONTRES text so that Windows will know that this is a font resource library. (See the "Microsoft Windows Software Development Kit Guide to Programming" for more information and examples.) Step V: Building the Font Resource Library
Using LINK Instead of LINK4:Important note: The specification of LINK4 in the sample above is not an error. The standard linkers supplied with Microsoft C version 5.1 and Microsoft C version 6.0 produce error messages when an attempt is made to create an executable file that has no segments. LINK4.EXE is not shipped with the Windows 3.x SDK. However, it is shipped with the Windows 2.x SDK and with the Windows 3.x DDK.If Steps III, IV, and V of the procedure given above are modified as follows, LINK versions 5.12 and later can be used to create font files: NEW Step III: Create a Dummy Code ModuleCreate a code segment in the dummy code module by creating an empty Windows Exit Procedure (WEP). This code might resemble the following:
NEW Step IV: Create a Module Definition FileModify the DEF file provided above to add the following lines:
NEW Step V: Building the Font Resource LibraryModify the makefile to refer to LINK instead of to LINK4.Using MASM 6.0 Instead of MASM 5.1If the font file is built using version 6.0 of the Microsoft Macro Assembler (MASM), use version 5.3 of the CMACROS.INC file included with MASM instead of version 5.2 of the file included with the Windows SDK.To access the fonts, use AddFontResource() with the DLL name, and RemoveFontResource(). Use CreateFont() or CreateFontIndirect() to retrieve a handle to a font with the specified attributes. Use SelectObject() to put the font into a specified DC. The face name of the font (for example, "System" or "Helv") can be specified when the font is created using the Font Editor. This same face name is specified as the lpFaceName parameter when calling CreateFont() or CreateFontIndirect(). The face name can be any name desired. Additional query words:
Keywords : kbfile kbsample kb16bitonly kbFont kbGDI kbSDKWin16 |
Last Reviewed: December 8, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |