Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



How to derive from COpenFontFile


Overview

Write a class derived from COpenFontFile to manage a file of the font format supported by the DLL. An object of this type is created by COpenFontRasterizer::NewFontFile().

To derive from COpenFontFile:

[Top]


Implementing GetNearestFontInPixelsL()

This function is called by the Font and Bitmap server to retrieve the font (from the font file) which most closely matches a given font specification. The freetype implementation is given below:

void CFreeTypeFontFile::GetNearestFontInPixelsL(RHeap* aHeap,
          COpenFontSessionCacheList* aSessionCacheList,
          const TOpenFontSpec& aFontSpec,
          TInt aPixelWidth,
          TInt aPixelHeight, COpenFont*& aFont,
          TOpenFontSpec& aActualFontSpec)
    {
    // Use the standard matcher.
    TInt face_index = 0;
    if (GetNearestFontHelper(aFontSpec,aPixelWidth,aPixelHeight,face_index,aActualFontSpec))
        {
        aFont = CFreeTypeFont::NewL(aHeap,aSessionCacheList,this,face_index,
                                    aActualFontSpec.Height(),
                                    aActualFontSpec.WidthFactor(),
                                    aActualFontSpec.SlantFactor());
        }
    }

To implement this function:


Implementing HasUnicodeCharacterL()

HasUnicodeCharacterL() is called by the Font and Bitmap Server to test whether a font contains a particular Unicode character. The prototype is:

virtual TBool HasUnicodeCharacterL(TInt aFaceIndex,TInt aCode) const = 0; 

Implementations must return ETrue if the character aCode, which is always a Unicode value, exists in the typeface. There are no other constraints on the way this function is implemented.

[Top]


See also

How to derive from COpenFontRasterizer

How to derive from COpenFont

How to derive from COpenFontRasterizerContext