OkfRegister

Register an OKF Font given a pointer to an OKF Font located in memory. Usually used for embedded fonts.

int OkfRegister( void *pSource );

Routine Required Header
OkfRegister "okf.h"
 

Libraries

OKLIB.A Oankali's GP32 run-time library
 

Return Value

In case of success OkfRegister returns the handle of the new registered font, otherwise it returns -1. Look at okf.lastError for details on what happened.


Parameters

pSource

A pointer to an OKF Font file located in memory. Usually this font is embedded directly in the executable program.


Remarks

The OkfRegister function analyses the data to see if it is a valid OKF Font file.

In case of success, memory is allocated for the decoded bitmaps and other structures needed by the font engine. En error occurs if there is not enough memory to register correctly the font.

The function then decodes the bitmaps, if there are RLE encoded, and calculates the dimensions and distribution of the characters in the fonts character set (see extInfo member in OKFCHAR structure for more details).

Finally the new decoded font is added the okf.pFonts font list, okf.pFonts->lastHandle is initialized to the new handle and the handle is returned.

To release the registered font and recover allocated memory, use OkfRelease.


Example

int handle;

// arial10_okf is a pointer to an OKF Font file in memory
handle = OkfRegister(arial10_okf);
if (handle == -1)
{
  switch (okf.lastError)
  {
    case ...
  }
}


See Also

OKF Font Engine Routines, OKF Font Engine Structures, OKF Font Engine Constants, OkfLoadAndRegister, OkfRelease, OkfGetEmbeddedFontHandle