6.5 Screen and Printer Fonts

Screen and printer fonts provide the bitmap or escape-sequence data required to generate character images for displaying or printing. Different code pages have different font data, so a program that changes the code page must also change the fonts for the screen and printer devices. To do this, a font corresponding to the specified code page must be available. The program can determine this by using Query Code-Page Prepare List (Interrupt 21h Function 440Ch Minor Code 6Bh) to retrieve an array of code pages for which hardware or prepared fonts exist. If a code page has a corresponding font (either hardware or prepared), the program can either select it for global system use by using Set Global Code Page or select it for only the specified device by using Select Code Page (Interrupt 21h Function 440Ch Minor Code 4Ah). A program can determine the device's current code page by using Query Selected Code Page (Interrupt 21h Function 440Ch Minor Code 6Ah).

If a corresponding font for a code page does not exist, a program can prepare a new font by using the following procedure:

1.Use Start Code-Page Prepare (Interrupt 21h Function 440Ch Minor Code 4Ch) to begin the preparation, identifying the device and the code pages for which to prepare the new font.

2.Use Send Control Data to Character Device (Interrupt 21h Function 4403h) to copy the contents of the device's corresponding code-page information (.CPI) file to the device. For example, the program must copy the EGA.CPI file to an EGA device.

3.Use End Code-Page Prepare (Interrupt 21h Function 440Ch Minor Code 4Dh) to complete the preparation.

This procedure may fail if the DISPLAY.SYS and PRINTER.SYS drivers are not installed by using device commands in the CONFIG.SYS file.

Note that users can carry out a similar preparation procedure by using the mode command and the cp prepare switch.