forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
setfont
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The setfont function finds a single font, from the set of
     registered fonts, that has the characteristics specified by
     <options>. If a font is found, it becomes the current font. The
     current font is used in all subsequent calls to the outgtext
     function. There can be only one current font at any time.
 
     The <options> string is a set of characters that specifies the
     desired characteristics of the font. The setfont function searches
     the list of registered fonts for a font matching the specified
     characteristics.
 
     The characteristics that may be specified in the <options> string
     are shown in the list below. Characteristics specified in the
     <options> string are neither case sensitive nor position sensitive.
 
     Characteristic     Description
 
     t'fontname'        Name of the typeface.
 
     hx                 Character height, where x is the number of
                        pixels.
 
     wy                 Character width, where y is the number of
                        pixels.
 
     f                  Find only a fixed-space font (should not be
                        used with the "p" characteristic).
 
     p                  Find only a proportionally spaced font (should
                        not be used with the "f" characteristic)
 
     v                  Find only a vector font (should not be used
                        with the "r" characteristic).
 
     r                  Find only a raster-mapped (bit-mapped) font
                        (should not be used with the "v"
                        characteristic).
 
     b                  Select a best fit font.
 
     nx                 Select font number x, where x is less than or
                        equal to the value returned by the
                        registerfonts function. Use this option to
                        "step through" an entire set of fonts.
 
     You can request as many options as desired, except with nx, which
     should be used alone. If mutually exclusive options are requested
     (such as the pair f/p or r/v), the setfont function ignores them.
     There is no error detection for incompatible parameters used with
     nx.
 
     Options can be separated in the <options> string by blanks. Any
     other character is ignored by setfont.
 
     The t (the typeface specification) in <options> is specified as a
     "t" followed by the <typename> in single quotes. The typename may
     be any of the following valid fonts:
 
     Typename     Description
 
     Courier      Fixed-width bit-mapped font with serifs
 
     Helv         Sans serif proportional bit-mapped font
 
     Tms Rmn      Proportional bit-mapped font with serifs
 
     Script       Proportional vector-mapped font of slanted
                  characters formed from nearly continuous lines
 
     Modern       Proportional vector-mapped font without serifs
 
     Roman        Proportional vector-mapped font with serifs
 
     A "b" in the <options> field causes the setfont routine to
     automatically select the "best fit" font that matches the other
     characteristics you have specified. If the b parameter is specified
     and at least one font is registered, setfont will always be able to
     set a font and will return 0 to indicate success.
 
     In selecting a font, the setfont routine uses the following
     precedence (rated from highest precedence to lowest):
 
     1. Pixel height
     2. Typeface
     3. Pixel width
     4. Fixed or proportional font
 
     You can also specify a pixel width and height for fonts. If a
     nonexistent value is chosen for either, and the b option is
     specified, the setfont function will choose the closest match. A
     smaller font size has precedence over a larger size. If setfont
     requests Helv 12 with best fit, and only Helv 10 and Helv 14 are
     available, setfont will select Helv 10.
 
     If a nonexistent value is chosen for pixel height and width, the
     setfont function will apply a magnification factor to a vector-
     mapped font to obtain a suitable font size. This automatic
     magnification does not apply if the "r" (raster-mapped font) option
     is specified, or if a specific typeface is requested and no best
     fit ("b") option is specified.
 
     If you specify the nx parameter, setfont will ignore any other
     specified options and supply only the font number corresponding to
     x.
 
     Note that the font functions affect only the output from the font
     output function outgtext; no other graphics library output
     functions are affected by font usage.
 
     Return Value
 
     The setfont function returns the index number (as in the nx option)
     of the font if successful, or a negative integer otherwise.
                                    -♦-