The Open Font System is a framework which allows rasterizer plug-ins to be used by the Font and Bitmap Server. A rasterizer plug-in is a DLL which recognises and reads font files stored in a particular format, and provides character bitmaps to the Font and Bitmap server.
Note that the Open Font System makes it possible to support fonts in any format. Whether or not a particular font file format is supported depends on what rasterizer DLLs, if any, are present on the device. Symbian provides a TrueType rasterizer freetype.dll
with the reference platform, however there are good reasons why this may not be included. For example, to reduce the memory overhead of rasterizer DLLs and font files.
The Open Font System is invisible to clients — once a rasterizer DLL has been written and installed, fonts in the supported format are used in exactly the same way as native Symbian fonts.
Client side requests for fonts are made to the Font and Bitmap server through the Fonts API.
The Open Font System framework consists of four classes:
, COpenFontRasterizer
, and COpenFontFile
, and (optionally) the convenience class COpenFont
. A rasterizer DLL is created by deriving a class from the first three of these, and declaring a single exported function in the ordinal 1 position. The purpose of each part of the framework and rasterizer DLL are discussed below.COpenFontRasterizerContext
The DLL's ordinal 1 function is a factory function. You implement this function to create your rasterizer object — the object you derive from COpenFontRasterizer
— and to return a COpenFontRasterizer*
pointer.
When the Font and Bitmap server starts running it calls the factory function of every rasterizer DLL in the system.
The purpose of the rasterizer object is to recognise and load font files of types supported by the rasterizer DLL. You implement COpenFontRasterizer
's pure virtual function to create a font file object — an object which you derive from COpenFontFile
— and return a COpenFontFile*
.
When the Font and Bitmap server starts running, font files are offered to the rasterizer object using this function. If the file can be read then a pointer to the COpenFontFile
object is returned. Otherwise NULL is returned and the file is offered to the next rasterizer object for processing.
The COpenFontFile
object manages and has information about all the typefaces in a file. It can create COpenFont
-derived font objects on demand.
A COpenFont
object's job is mainly to create glyphs for characters in a font. This process is called rasterization.
COpenFontRasterizerContext
provides convenience functions for writing bitmaps in Symbian run-length encoded format.