#include <openfont.h>
class COpenFontFile : public CBase |
Protected Member Functions | |
---|---|
IMPORT_C TBool | GetNearestFontHelperOld(const TOpenFontSpec &, TInt, TInt, TInt &, TOpenFontSpec &) |
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.
See also: COpenFontRasterizer::NewFontFileL() CWsScreenDevice::AddFile()
C++ constructor with UID and filename.
Call this constructor in the constructor for your derived object, passing it aUid and aFileName arguments.
Non Symbian-platform-native font files are allocated IDs by the font store. These are passed in by the rasteriser class. UIDs are required by the font framework. However you should not use the ID to access the file, since a new UID will need to be allocated when the file is next loaded, e.g. after a device reboot. Instead use the font file name.
Parameter | Description |
---|---|
aUid | The UID of the font file. |
aFileName | The full filename, including the path, of the font file. |
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 | AddFaceL | ( | const TOpenFontFaceAttrib & | aAttrib | ) |
Adds a typeface to this object's typeface array.
This function should be called during construction to add the attributes for each typeface in the font file to the typeface attribute array.
Note:
The typeface array is what is searched for the closest match to a specified font by GetNearestFontHelper().
See also: FaceAttrib() FaceCount()
Parameter | Description |
---|---|
aAttrib | The attributes for a typeface to be added to the typeface attribute array. |
TBool | DecRefCount | ( | ) | [inline] |
Decrement a reference count by one.
See also: IncRefCount()
Returns: 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.
See also: AddFaceL() FaceCount()
Parameter | Description |
---|---|
aFaceIndex | The index of the typeface for which the attributes are required. |
Returns: The attributes of the typeface with the specified index.
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.
See also: AddFaceL() FaceAttrib()
Returns: 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.
Returns: The filename of the font file.
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.
Parameter | Description |
---|---|
aDesiredFontSpec | The desired font specification. |
aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
aFaceIndex | The index of the typeface which contains the closest match to aDesiredFontSpec. |
aActualFontSpec | The actual font specification of the font with attributes closest to aDesiredFontSpec. |
Returns: ETrue if there is a possible font match, otherwise EFalse.
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.
See also: GetNearestFontHelper()
DeprecatedUse GetNearestFontToDesignHeightInPixels
Parameter | Description |
---|---|
aHeap | Shared heap. This value should be passed to the COpenFont derived classes' constructor. |
aSessionCacheList | The session cache list. This value should be passed to the COpenFont derived classes' constructor. |
aDesiredFontSpec | The desired font specification. |
aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
aFont | On return, contains a pointer to the newly created COpenFont derived object, or NULL if no font matching aDesiredFontSpec exists. |
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.
See also: GetNearestFontHelper()
Parameter | Description |
---|---|
aHeap | Shared heap. This value should be passed to the COpenFont derived classes' constructor. |
aSessionCacheList | The session cache list. This value should be passed to the COpenFont derived classes' constructor. |
aDesiredFontSpec | The desired font specification. |
aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
aFont | On return, contains a pointer to the newly created COpenFont derived object, or NULL if no font matching aDesiredFontSpec exists. |
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.
See also: GetNearestFontHelper()
Parameter | Description |
---|---|
aHeap | Shared heap. This value should be passed to the COpenFont derived classes' constructor. |
aSessionCacheList | The session cache list. This value should be passed to the COpenFont derived classes' constructor. |
aDesiredFontSpec | The desired font specification. |
aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
aFont | On return, contains a pointer to the newly created COpenFont derived object, or NULL if no font matching aDesiredFontSpec exists. |
aActualFontSpec | The actual font specification of the font retrieved into aFont. |
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.
See also: GetNearestFontHelper()
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.
See also: GetNearestFontHelper()
Parameter | Description |
---|---|
aHeap | Shared heap. This value should be passed to the COpenFont derived classes' constructor. |
aSessionCacheList | The session cache list. This value should be passed to the COpenFont derived classes' constructor. |
aDesiredFontSpec | The desired font specification. |
aPixelWidth | The width of a pixel. Used with aPixelHeight for calculating the algorithmic slant of the typeface. |
aPixelHeight | The height of a pixel. Used with aPixelWidth for calculating the algorithmic slant of the typeface. |
aFont | On return, contains a pointer to the newly created COpenFont derived object, or NULL if no font matching aDesiredFontSpec exists. |
aActualFontSpec | The actual font specification of the font retrieved into aFont. |
aMaxHeight | The maximum height within which the font must fit. |
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.
See also: GetNearestFontHelper()
Tests whether a specified typeface contains a particular character.
Parameter | Description |
---|---|
aFaceIndex | The index of the typeface to be tested. |
aCode | The Unicode character code for the character to be tested. |
Returns: ETrue if the typeface contains aCode, otherwise EFalse.
void | IncRefCount | ( | ) | [inline] |
Increments a reference count by one.
See also: DecRefCount()