OkfGetEmbeddedFontHandle

Get the handle of a registered font given the address of an OKF Font file in memory.

int OkfGetEmbeddedFontHandle( unsigned long *pSource );

Routine Required Header
OkfGetEmbeddedFontHandle "okf.h"
 

Libraries

OKLIB.A Oankali's GP32 run-time library
 

Return Value

In case of success OkfGetEmbeddedFontHandle returns the handle of the OKF Font file located at the address pointed by pSource.

If pSource doesn't point to a valid registered OKF Font file the function returns 0.

In case of error 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 OkfGetEmbeddedFontHandle function is an uncommon function used to retrieve the handle of a registered font given the address of the OKF Font file in memory.

This function can be useful to verify if an embedded font has already been registered or not, for example in a program that registers fonts dynamically and not only at the start of the program.

This function can be time consuming, so if it has to be included in a loop, it's preferable to stock the returned handle in a temporal variable, than use this variable instead.


Example

// Register a font if it is not already registered
void RegisterFont(void *pSource)
{
  int handle;
  
  handle = OkfGetEmbeddedFontHandle(pSource);
  if (handle == 0)
    OkfRegister(pSource);
}


See Also

OKF Font Engine Routines, OKF Font Engine Constants, OkfGetCurrentFont, OkfGetFont