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.
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 void | AddFaceL | ( | const TOpenFontFaceAttrib & | aAttrib | ) |
const TOpenFontFaceAttrib & aAttrib |
TBool | DecRefCount | ( | ) | [inline] |
Decrement a reference count by one.
ETrue if the reference count has reached zero (i.e. is less than or equal to zero); EFalse if the reference count has not yet reached zero (i.e. is positive).
const TOpenFontFaceAttrib & | FaceAttrib | ( | TInt | aFaceIndex | ) | const [inline] |
Gets the typeface at a specified index in the typeface attribute array.
The attributes of the typeface with the specified index.
TInt aFaceIndex | The index of the typeface for which the attributes are required. |
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.
The number of typefaces in the font file.
const TDesC & | FileName | ( | ) | const [inline] |
Gets the full path and filename of the font file
This is the filename that was passed to the constructor when the object is created.
The filename of the font file.
IMPORT_C TBool | GetNearestFontHelper | ( | const TOpenFontSpec & | aDesiredFontSpec, |
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
TInt & | aFaceIndex, | |||
TOpenFontSpec & | aActualFontSpec | |||
) | const |
const TOpenFontSpec & aDesiredFontSpec | |
TInt aPixelWidth | |
TInt aPixelHeight | |
TInt & aFaceIndex | |
TOpenFontSpec & aActualFontSpec |
IMPORT_C TBool | GetNearestFontHelperOld | ( | const TOpenFontSpec & | aDesiredFontSpec, |
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
TInt & | aFaceIndex, | |||
TOpenFontSpec & | aActualFontSpec | |||
) | const [protected] |
const TOpenFontSpec & aDesiredFontSpec | |
TInt aPixelWidth | |
TInt aPixelHeight | |
TInt & aFaceIndex | |
TOpenFontSpec & aActualFontSpec |
TInt | GetNearestFontInPixels | ( | RHeap * | aHeap, |
COpenFontSessionCacheList * | aSessionCacheList, | |||
const TOpenFontSpec & | aDesiredFontSpec, | |||
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
COpenFont *& | aFont, | |||
TOpenFontSpec & | aActualFontSpec | |||
) |
RHeap * aHeap | |
COpenFontSessionCacheList * aSessionCacheList | |
const TOpenFontSpec & aDesiredFontSpec | |
TInt aPixelWidth | |
TInt aPixelHeight | |
COpenFont *& aFont | |
TOpenFontSpec & aActualFontSpec |
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 | |||
) |
RHeap * aHeap | |
COpenFontSessionCacheList * aSessionCacheList | |
const TOpenFontSpec & aDesiredFontSpec | |
TInt aPixelWidth | |
TInt aPixelHeight | |
COpenFont *& aFont | |
TOpenFontSpec & aActualFontSpec |
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 | |||
) |
RHeap * aHeap | |
COpenFontSessionCacheList * aSessionCacheList | |
const TOpenFontSpec & aDesiredFontSpec | |
TInt aPixelWidth | |
TInt aPixelHeight | |
COpenFont *& aFont | |
TOpenFontSpec & aActualFontSpec | |
TInt aMaxHeight |
void | GetNearestFontToMaxHeightInPixelsAndAddToListL | ( | RHeap * | aHeap, |
COpenFontSessionCacheList * | aSessionCacheList, | |||
const TOpenFontSpec & | aDesiredFontSpec, | |||
TInt | aPixelWidth, | |||
TInt | aPixelHeight, | |||
COpenFont *& | aFont, | |||
TOpenFontSpec & | aActualFontSpec, | |||
TInt | aMaxHeight | |||
) | [private] |
RHeap * aHeap | |
COpenFontSessionCacheList * aSessionCacheList | |
const TOpenFontSpec & aDesiredFontSpec | |
TInt aPixelWidth | |
TInt aPixelHeight | |
COpenFont *& aFont | |
TOpenFontSpec & aActualFontSpec | |
TInt aMaxHeight |
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.
RHeap * | |
COpenFontSessionCacheList * | |
const TOpenFontSpec & | |
TInt | |
TInt | |
COpenFont *& | |
TOpenFontSpec & | |
TInt |
TBool | HasUnicodeCharacterL | ( | TInt | aFaceIndex, |
TInt | aCode | |||
) | const [pure virtual] |
Tests whether a specified typeface contains a particular character.
ETrue if the typeface contains aCode, otherwise EFalse.
void | RemoveFontFromList | ( | const COpenFont * | aFont | ) |
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 |