Location: openfont.h
Link against: fntstr.lib
COpenFontRasterizer
Supported from 5.0
Font rasterizer abstract base class.
An Open Font System rasterizer is a polymorphic DLL. It contains a single exported factory function which creates rasterizer objects for a specific font type — these objects are derived from COpenFontRasterizer
. This function is called just once, when the Font and Bitmap Server loads the DLL.
The rasterizer also implements, but does not export, the single pure virtual function declared in this class. The function reads font files, and creates a COpenFontFile
object if the font file is of the right type.
Writing derived classes:
Open font rasterizers should derive from this class and implement the NewFontFileL()
function.
Derived classes should also define the factory function. It is a static function which takes no arguments, and it is the only function exported from the class. It creates a COpenFontRasterizer
derived object on the heap, and returns it to the caller — the caller is responsible for deleting the object. The name of the function does not matter because it is loaded by ordinal, however it is good practice to name it NewL()
. As the name of the example function suggests, it is allowed to leave.
The rasterizer class may also need to store an 'engine context'. This is an object derived from COpenFontRasterizerContext
, which provides functions that make it easier to write the glyph bitmap during rasterization.
More information on deriving from this class is provided in the API guide.
|
Defined in COpenFontRasterizer
:
NewFontFileL()
Inherited from CBase
:
operator new()
virtual COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession)=0;
Creates a COpenFontFile
derived object for loading font files in the new format.
This function is called by the framework during font and bitmap server startup. It creates a font file object for font files in the \system\fonts directory on all drives, using the default search path. The first font of a given name overrides subsequent ones. The directory search path is soft to hard: Y:, X:, W:, ..., C:, B:, A:, Z:. Files may also be added dynamically after startup using CWsScreenDevice::AddFile()
, which indirectly calls this function.
Implementations of this function should examine the file aFileName
, and if it is of the correct type attempt to create a COpenFontFile
derived object to load it. The caller is responsible for deleting the object. The function must return NULL if it cannot recognise the file, and it may also leave if there is an error.
|
|
|