Name
OpenFont -- create FreeType2 font from memory buffer (V5.0)
Synopsis
FT_Face face = OpenFont(UBYTE *data, int datalen);
Function
This function has to create an FT_Face handle from the raw font data passed to it. You only need to implement this function if you build plugins for WarpOS. On all other systems, your OpenFont() implementation can just return NULL because it is never called.

The reason why this function is needed on WarpOS is that the WarpOS version of Hollywood contains two builds of FreeType2: one for 68020 and one for the PowerPC architecture. Plugins will always have to work with the PPC native version to avoid context switches. Hollywood itself, however, uses the 68020 build of FreeType2 because it's faster in most cases because Hollywood doesn't have to do any context switches. Using the FT_Face handle allocated by the 68020 version of FreeType2 is not going to work with the PowerPC version of FreeType2, though, due to different structure alignments, etc. That is why you need to use the PowerPC version of FreeType2 on WarpOS to create a compatible FT_Face handle which is then passed to CreateVectorFont(). On all other systems OpenFont() is not necessary because there's only a single-architecture FreeType2 in Hollywood.

Basically, all this function has to do on WarpOS is the following:

 
HW_EXPORT FT_Face OpenFont(UBYTE *data, int datalen)
{
    FT_Face face;

    if(hwcl->FT2Base->FT_New_Memory_Face(freetype_library, data,
           datalen, 0, &face)) return NULL;

    return face;
}

HW_EXPORT void CloseFont(FT_Face face)
{
    hwcl->FT2Base->FT_Done_Face(face);
}

Hollywood will call CloseFont() to free handles allocated by this function.

Inputs
data
pointer to raw font data (usually pointer to TrueType font data)
datalen
size of the data buffer in bytes
Results
face
handle to an FT_Face allocated by the WarpOS version of FreeType2 or NULL in case of an error

Show TOC