registerbgifont
Registers linked-in stroked font code.
Defined in header <graphics.h>
Syntax
#include <graphics.h>
int registerbgifont(void (*/onO(void));
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
Calling registerbgifont informs the graphics system that the font pointed to hy font was included at link time. This routine checks the linked-in code for the specified font; if the code is valid, it registers the code in internal tables. Linked-in fonts are discussed in detail under BGIOBJ in UTIL.DOC included with your distribution disks.
By using the name of a linked-in font in a call to registerbgifont, you also tell the compiler (and linker) to link in the object file with that public name. If you register a user-supplied font, you must pass the result of registerbgifont to settextstyle as the font number to be used.
Return value
registerbgifont returns a negative graphics error code if the specified font is invalid. Otherwise, registerbgifont returns the font number of the registered font.
See also
Example
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
/* request autodetection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
/* register a font file that was added into GRAPHICS.LIB */
errorcode = registerbgifont (triplex_font);
/* report any registration errors */
if (errorcode < 0) {
printf("Graphics error: %s\n", grapherrormsg(errorcode) );
printf("Press any key to halt:");
getchO;
exit(l); /* terminate with an error code */
}
/* initialize graphics and local variables */
initgraph(&gdriver, Sigmode, "");
/* read result of initialization */
errorcode = graphresult ();
if (errorcode != grOk) { /* an error occurred */
printf ("Graphics error: %s\n", grapherrormsg(errorcode)
printf( "Press any key to halt:");
getchO ;
exit(l); /* terminate with an error code */
}
midx = getmaxxO / 2;
midy = getmaxy () / 2;
/* select the registered font */
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 4);
/* output some text */
settextjustify (CENTER_TEXT, CENTER_TEXT);
outtextxy(midx, midy, "The TRIPLEX FONT");
/* clean up */
getchO ;
closegraphO ;
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/graphics.h/registerbgifont/
· short form /3.1/registerbgifont/