Microsoft KB Archive/57502

From BetaArchive Wiki
Knowledge Base

LoadFont Function Example Documentation Error in Basic 7.0/7.1

Article ID: 57502

Article Last Modified on 11/21/2006

This article was previously published under Q57502


Page 524 of the "Microsoft Basic 7.0: Language Reference" for Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 shows an incorrect example of how to load a font by its order in the font file. This documentation incorrectly states the following:

Note that to load fonts according to their order in the font file, l% would take the form:

      l% = LoadFont%("n1,n3,n6")

The code above should read as follows (where l% means L%, not to be confused with 1%):

   L% = LoadFont%("n1/n3/n6")

When loading multiple fonts, each font given in the fontspec$ argument of LoadFont%(fontspec$) should be separated by forward slashes (/), not by commas.

If the code in this documentation error is used, only the first font is loaded (l% contains the number "1", indicating that only one font is loaded).

Code Example

The following code example demonstrates the documentation problem. To use this code example, you must start QBX.EXE with /L FONTBEFR.QLB to access the font toolbox routines.

'* Load the Times Roman font.
PRINT "Registering Times Roman font."
FontNum% = RegisterFonts("D:\BC7\FONTS\TMSRB.FON")
PRINT "Number of fonts in the file: "; FontNum%
PRINT "Loading fonts 4,5,6 from the Times Roman file."
var1% = LoadFont%("N4,N5,N6")
PRINT "Number of fonts successfully loaded"; var1%
PRINT "value of FontErr", FontErr
a$ = "Hello world"
var1% = OutGText%(100, 100, a$)

Additional query words: BasicCom 7.00 7.10

Keywords: KB57502