This operation code allows you to select any printer font for spooled reports.
CALL "WIN$PRINTER" USING WINPRINT-SET-FONT, WINPRINT-DATA GIVING RESULT
WINPRINT-DATA | Group item defined in
winprint.def as follows:
01 WINPRINT-DATA. 03 WPRTDATA-SET-STD-FONT. 03 WPRTDATA-SET-FONT REDEFINES WPRTDATA-SET-STD-FONT. 05 WPRTDATA-FONT HANDLE OF FONT. |
First, obtain a handle to the desired font with the W$FONT routine described earlier. Once you have the font handle, you can select it as the current font by setting WPRTDATA-FONT to the desired font handle and using WINPRINT-SET-FONT. The font is now associated with the current printer until you change the font again or the runtime finishes. Note that the font is only used for reports printed by the runtime's spooler handler, which you use when you assign a print file to -P SPOOLER.
Fonts are device-specific. If you let the user change printers via WIN$PRINTER's setup operation, then the user should get a new font handle from W$FONT and associate it with the new printer.
You should not DESTROY a font handle that is currently selected as the print font, unless the printer is closed and you will not open it again. If you do, then that font will not be available to the printer.
You may use proportionally spaced fonts in print files. The runtime handles the proportional spacing correctly (in other words, it does not use a fixed width for each character). The runtime computes the number of columns that fit on a page for a proportional font by using the font's average width. (See winspool.cbl for a sample program that uses arbitrary fonts chosen by the user.)