> RegisterBGIfont (function) (Graph unit)


 RegisterBGIfont (function)     (Graph unit)

Passes the graphics system a pointer to a font that has been linked into an application program.


 function RegisterBGIfont(Font: pointer): Integer;


Real, Protected


The return value is less than 0 if an error occurs. Possible error codes are grError, grInvalidFont, and grInvalidFontNum. If no error occurs, the internal font number is returned. This routine enables a user to load a font file and "register" the font by passing its memory location to RegisterBGIfont.

When that font is selected with a call to SetTextStyle, the registered font will be used (instead of being loaded from disk by the Graph unit). A user-registered font can be loaded from disk onto the heap, or converted to an .OBJ file (using BINOBJ.EXE) and linked into the .EXE.

There are several reasons to load and register font files. First, Graph only keeps one stroked font in memory at a time. If you have a program that needs to quickly alternate between stroked fonts, you might want to load and register the fonts yourself at the beginning of your program. Then Graph will not load and unload the fonts each time a call to SetTextStyle is made.

Second, you might wish to incorporate the font files directly into your .EXE file. This way, the font files that your program needs will be built-in, and only the .EXE and driver files will be needed to run. The process for incorporating a font file into your .EXE is straight forward:

   1. Run BINOBJ on the font file(s).
   2. Link the resulting .OBJ file(s) into your program.
   3. Register the linked-in font file(s) before calling InitGraph.

For a detailed explanation and example of the preceding, see the comments at the top of the BGILINK.PAS example program on the distribution disks. Documentation on the BINOBJ utility is available in the file UTIL.DOC (in ONLINE.ZIP) on your distribution disks.

See Also

Sample Code

 К началу страницы 
Тэги: RegisterBGIfont

Код для вставки: :: :: :: ГОСТ ::
Поделиться: //

Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"