Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_registerfonts() initialize the font graphics system</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _registerfonts()        Initialize the font graphics system

 #include   <graph.h>

 short _registerfonts(pathname);
 unsigned char _far *pathname;          Pathname for .FON files

    _registerfonts() initializes the fonts for the graphics system; it
    is the first necessary step in using fonts on the screen. pathname
    holds the path and filename(s) of valid .FON files (including
    wildcards).

    Note that you must register a font with _registerfonts() before
    using it.

    Returns:    Number of fonts registered; < 0 otherwise:
                -1 file not found
                -2 one of the files was not a valid .FON file
                -2 one of the .FON files was damaged

    Notes:      For each font registered, C uses about 140 bytes
                of memory.

   Portability:     MS-DOS only, true MDPA, CGA, EGA, MCGA, or VGA video
                    compatibles

   -------------------------------- Example ---------------------------------

        This program prints a string using the first .FON file it finds.

    #include <conio.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <graph.h>

    unsigned char *tstring = "Here is the Text";

    void main()
    {
        struct videoconfig vstruc;
        struct _fontinfo finfo;
        short nfont, maxfonts, halfinx, halfiny;

        _setvideomode(_MAXRESMODE);
        _getvideoconfig(&vstruc);
        _registerfonts("*.FON");
        _clearscreen(_GCLEARSCREEN);

        halfinx = vstruc.numxpixels/2 - _getgtextextent(tstring)/2;
        halfiny = vstruc.numypixels/2 + _getgtextextent(tstring)/2;
        _moveto(halfinx, halfiny);

        _setfont("n1");     /* Display first font */
        _setgtextvector(1, 0);
        _outgtext(tstring);
        _setgtextvector(-1, 0);
        _outgtext(tstring);
        _getfontinfo(&finfo);
        getch();

        _unregisterfonts();
        _setvideomode(_DEFAULTMODE);
    }

See Also: _getfontinfo() _outgtext() _setfont() _unregisterfonts()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson