Fonts

On graphical systems, you are not limited to just one font. ACUCOBOL-GT provides general support for access to most fonts known to the system.

In ACUCOBOL-GT, fonts are represented in your program by handles. Once created, a font handle indirectly refers to all the information the system needs to manage that particular font. When you want to specify a particular font in your program, you use its handle. See Handles for more information.

In ACUCOBOL-GT, you have access to most of the systems add-on fonts (TrueType), as well as several predefined fonts. The set of predefined fonts is used because they are guaranteed to be available on all Windows systems. These fonts correspond to the various Windows system fonts that are accessed with the GetStockObject API function.

Font handles are created in two ways: with the W$FONT library routine and with the ACCEPT FROM STANDARD OBJECT verb. The ACCEPT FROM STANDARD OBJECT verb provides access to the system predefined fonts only. See Procedure Division Statements for a description of the ACCEPT Statement and a list of the available fonts.

The W$FONT library routine provides access to most of the fonts known to the system, including TrueType fonts. W$FONT provides three primary functions.

  1. It returns a handle to the font on the system that either exactly or most closely matches a font description
  2. Given a font handle, it returns a complete description of the font's characteristics
  3. It creates and presents to the user a font selection dialog box, returning a description of the font that the user selected

For a complete description of W$FONT see Appendix I. Library Routines.

Note: Fonts occupy memory. If you no longer need a font, you can free the memory used by that font with the DESTROY Statement. The runtime system automatically destroys all fonts when it exits.