Using Fonts Effectively

Displaying fonts is simply another form of graphics; using fonts effectively requires little programming effort. Still, there are a few things to watch:

Remember that the video mode should be set only once. If you generate an image with presentation graphics and want to add text to it, do not reset the video mode prior to calling the font routines. Doing so will blank the screen, destroying the original image.

The _setfont function reads specified .FON files to obtain mapping data for the current font. Each call to _setfont causes a disk access and overwrites the old font data in memory. If you want to show text of different styles on the same screen, display all text of one font before moving on to the others. Minimizing the number of calls to _setfont saves time spent in disk I/O and memory reloads.

When your program finishes using the fonts library, you may want to free the memory occupied by the register list by calling _unregisterfonts. This function frees the memory allocated by _registerfonts. The register information for each type size of each font takes up approximately 140 bytes of memory.

Aesthetic suggestions for the printed page also apply to screen text. Typefaces are more effective when they do not compete with each other for attention. Restricting the number of styles per screen to one or two generally results in a more pleasing, less cluttered image.