OkfClone

Clone a registered font and register it under a new handle.

int OkfClone( int handle );

Routine Required Header
OkfClone "okf.h"
 

Libraries

OKLIB.A Oankali's GP32 run-time library
 

Return Value

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


Parameters

handle

The handle of the font to be cloned. The handle must belong to a valid registered font.


Remarks

This function is usually used when we need to use a font as it is, but we also want to change permanently some properties of the font, or apply special effects on it with OkfApplyEffect. Cloning the font, we will make a copy of it and will be able to make safely the changes.

The OkfClone function allocates memory for the main font structure, for the bitmaps and for other structures included in the cloned font. En error occurs if there is not enough memory.

The function then copies all data from the cloned font to the allocated memory.

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

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


Example

int newHandle;

// Clone current font
newHandle = OkfClone(okf.font);
if (handle == -1)
{
  switch (okf.lastError)
  {
    case ...
  }
}


See Also

OKF Font Engine Routines, OKF Font Engine Constants, OkfLoadAndRegister, OkfRelease, OkfApplyEffect