class COpenFontFile : public CBase |
Font file abstract base class.
Write a class derived from COpenFontFile to manage a file with the font format supported by your DLL. The derived class must implement the virtual GetNearestFontInPixelsL() function. This function takes a font description and creates a COpenFont derived object if the description matches a typeface contained in the font file.
Derived classes must also load typeface attributes from the file into the protected typeface attribute array during construction. This array is what is searched when getting font attribute information see AddFaceL() , GetNearestFontHelper() .
Writing derived classes construction:
Call the COpenFontFile constructor in the constructor for your derived object, passing it aUid and aFileName arguments. These values are the arguments passed when the constructor is called by COpenFontRasterizer::NewFontFileL() .
A file may contain one or more typefaces. During construction the derived object should extract the information for each typeface and add it to this object's protected typeface attribute array see AddFaceL() . This process will probably leave under some conditions. It should therefore be implemented in a second phase constructor.
Writing derived classes implement the pure virtual functions:
Derived classes must also implement the two pure virtual functions GetNearestFontInPixelsL() and HasUnicodeCharacterL() . Information about these functions is provided in the definitions below. Information about deriving from this class is also provided in the API guide.
COpenFontRasterizer::NewFontFileL() CWsScreenDevice::AddFile()
Protected Member Functions | |
---|---|
IMPORT_C TBool | GetNearestFontHelperOld (const TOpenFontSpec &, TInt , TInt , TInt &, TOpenFontSpec &) |
Private Member Functions | |
---|---|
void | GetNearestFontToDesignHeightInPixelsAndAddToListL ( RHeap *, COpenFontSessionCacheList *, const TOpenFontSpec &, TInt , TInt , COpenFont *&, TOpenFontSpec &) |
void | GetNearestFontToMaxHeightInPixelsAndAddToListL ( RHeap *, COpenFontSessionCacheList *, const TOpenFontSpec &, TInt , TInt , COpenFont *&, TOpenFontSpec &, TInt ) |
TInt | ScoreByName (const TOpenFontSpec &, const TAttrib &) |
TInt | ScoreByStyle (const TOpenFontSpec &, const TAttrib &) |
Private Attributes | |
---|---|
TOpenFontFileData * | iData |
CArrayFixFlat < TAttrib > | iFaceAttrib |
TBuf < KMaxFileName > | iFileName |
CArrayPtrFlat < COpenFont > | iFontList |
TInt | iRefCount |
TUid | iUid |
IMPORT_C | ~COpenFontFile | ( | ) |
Destructor.
It is not allowed that file is deleted before its fonts and the logic is handled in CFontStore::RemoveFile() .
IMPORT_C void | ExtendedInterface | ( | TUid | aUid, |
TAny *& | aParam | |||
) | [virtual] |
TInt | FaceCount | ( | ) | const [inline] |
Gets the number of typefaces in the typeface attributes array.
This is the number of typefaces in the font file: the attributes for each typeface should be loaded into the array when the derived object is constructed.
IMPORT_C TBool | GetNearestFontHelper | ( | const TOpenFontSpec & | aDesiredFontSpec, |
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
TInt & | aFaceIndex, | |||
TOpenFontSpec & | aActualFontSpec | |||
) | const |
Gets the nearest font helper function.
This function may be used by derived classes in their GetNearestFontInPixelsL() implementations. It finds the nearest font in the typeface attribute array, if any, to the provided font specification. If there is a possible match it places the face index in aFaceIndex and the actual specification (including algorithmic effects) in aActualFontSpec.
const TOpenFontSpec & aDesiredFontSpec | The desired font specification. |
TInt aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
TInt aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
TInt & aFaceIndex | The index of the typeface which contains the closest match to aDesiredFontSpec. |
TOpenFontSpec & aActualFontSpec | The actual font specification of the font with attributes closest to aDesiredFontSpec. |
IMPORT_C TBool | GetNearestFontHelperOld | ( | const TOpenFontSpec & | aDesiredFontSpec, |
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
TInt & | aFaceIndex, | |||
TOpenFontSpec & | aActualFontSpec | |||
) | const [protected] |
TInt | GetNearestFontInPixels | ( | RHeap * | aHeap, |
COpenFontSessionCacheList * | aSessionCacheList, | |||
const TOpenFontSpec & | aDesiredFontSpec, | |||
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
COpenFont *& | aFont, | |||
TOpenFontSpec & | aActualFontSpec | |||
) |
Gets the nearest font in pixels.
Implementations of this pure virtual function should create the COpenFont derived object that most closely matches aFontSpec, and place a pointer to it in aFont. If this cannot be done, e.g. if the font name doesn't match, aFont should be set to NULL.
The other two arguments, aHeap and aSessionCacheList, should be passed to the COpenFont constructor.
Implementations may use the utilitity function GetNearestFontHelper() to get the attributes of the closest matching font.
GetNearestFontHelper() Use GetNearestFontToDesignHeightInPixels
RHeap * aHeap | Shared heap. This value should be passed to the COpenFont derived classes' constructor. |
COpenFontSessionCacheList * aSessionCacheList | The session cache list. This value should be passed to the COpenFont derived classes' constructor. |
const TOpenFontSpec & aDesiredFontSpec | The desired font specification. |
TInt aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
TInt aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
COpenFont *& aFont | On return, contains a pointer to the newly created COpenFont derived object, or NULL if no font matching aDesiredFontSpec exists. |
TOpenFontSpec & aActualFontSpec | The actual font specification of the font retrieved into aFont. |
void | GetNearestFontInPixelsL | ( | RHeap * | aHeap, |
COpenFontSessionCacheList * | aSessionCacheList, | |||
const TOpenFontSpec & | aDesiredFontSpec, | |||
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
COpenFont *& | aFont, | |||
TOpenFontSpec & | aActualFontSpec | |||
) | [pure virtual] |
Gets the font which is the nearest to the given font specification.
Implementations of this pure virtual function should create the COpenFont derived object that most closely matches aDesiredFontSpec, while fitting within aMaxHeight, and place a pointer to it in aFont. If this cannot be done, e.g. if the font name doesn't match, aFont should be set to NULL.
The other two arguments, aHeap and aSessionCacheList, should be passed to the COpenFont constructor.
Implementations may use the utility function GetNearestFontHelper() to get the attributes of the closest matching font.
RHeap * aHeap | Shared heap. This value should be passed to the COpenFont derived classes' constructor. |
COpenFontSessionCacheList * aSessionCacheList | The session cache list. This value should be passed to the COpenFont derived classes' constructor. |
const TOpenFontSpec & aDesiredFontSpec | The desired font specification. |
TInt aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
TInt aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
COpenFont *& aFont | On return, contains a pointer to the newly created COpenFont derived object, or NULL if no font matching aDesiredFontSpec exists. |
TOpenFontSpec & aActualFontSpec | The actual font specification of the font retrieved into aFont. |
TInt | GetNearestFontToDesignHeightInPixels | ( | RHeap * | aHeap, |
COpenFontSessionCacheList * | aSessionCacheList, | |||
const TOpenFontSpec & | aDesiredFontSpec, | |||
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
COpenFont *& | aFont, | |||
TOpenFontSpec & | aActualFontSpec | |||
) |
Gets the nearest font in pixels.
Implementations of this pure virtual function should create the COpenFont derived object that most closely matches aFontSpec, and place a pointer to it in aFont. If this cannot be done, e.g. if the font name doesn't match, aFont should be set to NULL.
The other two arguments, aHeap and aSessionCacheList, should be passed to the COpenFont constructor.
Implementations may use the utilitity function GetNearestFontHelper() to get the attributes of the closest matching font.
RHeap * aHeap | Shared heap. This value should be passed to the COpenFont derived classes' constructor. |
COpenFontSessionCacheList * aSessionCacheList | The session cache list. This value should be passed to the COpenFont derived classes' constructor. |
const TOpenFontSpec & aDesiredFontSpec | The desired font specification. |
TInt aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
TInt aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
COpenFont *& aFont | On return, contains a pointer to the newly created COpenFont derived object, or NULL if no font matching aDesiredFontSpec exists. |
TOpenFontSpec & aActualFontSpec | The actual font specification of the font retrieved into aFont. |
void | GetNearestFontToDesignHeightInPixelsAndAddToListL | ( | RHeap * | aHeap, |
COpenFontSessionCacheList * | aSessionCacheList, | |||
const TOpenFontSpec & | aDesiredFontSpec, | |||
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
COpenFont *& | aFont, | |||
TOpenFontSpec & | aActualFontSpec | |||
) | [private] |
RHeap * aHeap | |
COpenFontSessionCacheList * aSessionCacheList | |
const TOpenFontSpec & aDesiredFontSpec | |
TInt aPixelWidth | |
TInt aPixelHeight | |
COpenFont *& aFont | |
TOpenFontSpec & aActualFontSpec |
void | GetNearestFontToDesignHeightInPixelsL | ( | RHeap * | , |
COpenFontSessionCacheList * | , | |||
const TOpenFontSpec & | , | |||
TInt | , | |||
TInt | , | |||
COpenFont *& | , | |||
TOpenFontSpec & | ||||
) | [inline, virtual] |
Gets the font which is the nearest to the given font specification.
Implementations of this pure virtual function should create the COpenFont derived object that most closely matches aDesiredFontSpec, while fitting within aMaxHeight, and place a pointer to it in aFont. If this cannot be done, e.g. if the font name doesn't match, aFont should be set to NULL.
The other two arguments, aHeap and aSessionCacheList, should be passed to the COpenFont constructor.
Implementations may use the utility function GetNearestFontHelper() to get the attributes of the closest matching font.
RHeap * | |
COpenFontSessionCacheList * | |
const TOpenFontSpec & | |
TInt | |
TInt | |
COpenFont *& | |
TOpenFontSpec & |
TInt | GetNearestFontToMaxHeightInPixels | ( | RHeap * | aHeap, |
COpenFontSessionCacheList * | aSessionCacheList, | |||
const TOpenFontSpec & | aDesiredFontSpec, | |||
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
COpenFont *& | aFont, | |||
TOpenFontSpec & | aActualFontSpec, | |||
TInt | aMaxHeight | |||
) |
Gets the nearest font in pixels that fits inside specified max height.
Implementations of this pure virtual function should create the COpenFont derived object that most closely matches aFontSpec, while fitting within aMaxHeight, and place a pointer to it in aFont. If this cannot be done, e.g. if the font name doesn't match, aFont should be set to NULL.
The other two arguments, aHeap and aSessionCacheList, should be passed to the COpenFont constructor.
Implementations may use the utilitity function GetNearestFontHelper() to get the attributes of the closest matching font.
RHeap * aHeap | Shared heap. This value should be passed to the COpenFont derived classes' constructor. |
COpenFontSessionCacheList * aSessionCacheList | The session cache list. This value should be passed to the COpenFont derived classes' constructor. |
const TOpenFontSpec & aDesiredFontSpec | The desired font specification. |
TInt aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
TInt aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
COpenFont *& aFont | On return, contains a pointer to the newly created COpenFont derived object, or NULL if no font matching aDesiredFontSpec exists. |
TOpenFontSpec & aActualFontSpec | The actual font specification of the font retrieved into aFont. |
TInt aMaxHeight | The maximum height within which the font must fit. |
void | GetNearestFontToMaxHeightInPixelsAndAddToListL | ( | RHeap * | aHeap, |
COpenFontSessionCacheList * | aSessionCacheList, | |||
const TOpenFontSpec & | aDesiredFontSpec, | |||
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
COpenFont *& | aFont, | |||
TOpenFontSpec & | aActualFontSpec, | |||
TInt | aMaxHeight | |||
) | [private] |
void | GetNearestFontToMaxHeightInPixelsL | ( | RHeap * | , |
COpenFontSessionCacheList * | , | |||
const TOpenFontSpec & | , | |||
TInt | , | |||
TInt | , | |||
COpenFont *& | , | |||
TOpenFontSpec & | , | |||
TInt | ||||
) | [inline, virtual] |
Gets the font which is the nearest to the given font specification.
Implementations of this pure virtual function should create the COpenFont derived object that most closely matches aDesiredFontSpec, while fitting within aMaxHeight, and place a pointer to it in aFont. If this cannot be done, e.g. if the font name doesn't match, aFont should be set to NULL.
The other two arguments, aHeap and aSessionCacheList, should be passed to the COpenFont constructor.
Implementations may use the utility function GetNearestFontHelper() to get the attributes of the closest matching font.
TBool | HasUnicodeCharacterL | ( | TInt | aFaceIndex, |
TInt | aCode | |||
) | const [pure virtual] |
Tests whether a specified typeface contains a particular character.
void | RemoveFontFromList | ( | const COpenFont * | aFont | ) |
This function is called (via iFile) by a COpenFont when it is destroyed.
const COpenFont * aFont |
TInt | ScoreByName | ( | const TOpenFontSpec & | aDesiredFontSpec, |
const TAttrib & | aAttrib | |||
) | [private, static] |
const TOpenFontSpec & aDesiredFontSpec | |
const TAttrib & aAttrib |
TInt | ScoreByStyle | ( | const TOpenFontSpec & | aDesiredFontSpec, |
const TAttrib & | aAttrib | |||
) | [private, static] |
const TOpenFontSpec & aDesiredFontSpec | |
const TAttrib & aAttrib |
void | SetFontStoreL | ( | CFontStore * | aFontStore | ) |
CFontStore * aFontStore |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.