C Language and Libraries Help (clang.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
─────Run-Time Library───────────────────────────────────────────────────────
 
     The _setfont function finds a single font, from the set of
     registered fonts, that has the characteristics specified by the
     <options> string. If a font is found, it is made the current font.
     The current font is used in all subsequent calls to the _outgtext
     function. There can be only one active 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 can 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'        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 (bitmapped) 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 function
                        _registerfonts. Use this option to "step
                        through" an entire set of fonts or to save or
                        restore a previously set font.
 
     You can request as many options as desired, except with n<x>,
     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 n<x>.
 
     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 bitmapped font with serifs
 
     Helv         Sans serif proportional bitmapped font
 
     Tms Rmn      Proportional bitmapped 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.
 
     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. For example,
     if _setfont requests Helv 12 with best fit, and only Helv 10 and
     Helv 14 are available, _setfont will select Helv 10.
 
     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
 
     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 n<x> 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 run-time output functions
     are affected by font usage.
 
     Return Value
 
     The _setfont function returns an index that is suitable for use
     with n<x> to indicate success, or a negative value to indicate an
     error. An error occurs if a request for a specific font fails and
     the b option was not specified, or if fonts have not yet been
     registered.
                                    -♦-