Location: openfont.h
Link against: fntstr.lib
COpenFont
Supported from 5.0
Open Font System font abstract base class.
Derive a class from this class to represent an instance of a typeface at a particular size, provide bitmaps of the glyphs, and determine whether characters exist in the typeface.
Writing derived classes — construction:
You must call the constructor of this class when creating your derived object, passing the arguments aHeap
and aSessionCacheList
supplied to COpenFontFile::GetNearestFontInPixelsL()
, and the address of the COpenFontFile
object that creates the object as aFile
.
The derived object must be created on the shared heap aHeap
because it is shared by several processes — the font and bitmap server and its clients. To do this, use aHeap->AllocL()
to obtain memory, then construct in place using a placement argument to new
.
Writing derived classes — implement the pure virtual functions:
Devived classes must implement the pure virtual function RasterizeL()
. Information about this function is provided in the function definition below.
Information about deriving from this class is also provided in the API guide.
|
Defined in COpenFont
:
COpenFont()
, CharacterNeedsToBeRasterized()
, FaceAttrib()
, FaceIndex()
, File()
, Metrics()
, RasterizeL()
, delete()
, ~COpenFont()
Inherited from CBase
:
operator new()
COpenFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,COpenFontFile* aFile);
C++ constructor taking shared heap, session cache list and font file as parameters.
You must either use this, or the other constructor, when creating your derived object. This constructor might be used, in preference to the other, if there is only a single typeface in the font file.
|
COpenFont(RHeap* aHeap,COpenFontSessionCacheList* aSessionCacheList,COpenFontFile* aFile,TInt aFaceIndex);
C++ constructor taking shared heap, session cache list, font file and face index as parameters.
You must either use this, or the other constructor, when creating your derived object. This constructor would be used if the font file contains more than one typeface.
|
~COpenFont();
Destructor.
This function frees all memory owned by the object, including the session cache list and the glyph list, prior to its destruction.
virtual void RasterizeL(TInt aCode,TOpenFontGlyphData* aGlyphData)=0;
Creates a bitmap for the specified Unicode character.
Implementations of this function should put the bitmap in aGlyphData->iBitmapBuffer
, and the character metrics are placed in aGlyphData->iMetricsBuffer
. The other parts of aGlyphData
should be left alone.
There are a number of strategies for achieving this, e.g. pass the rasterization task all the way up to the rasterizer engine. These are discussed in the API guide.
At present you must write the bitmap in the Symbian platform's run-length-encoded format. This is a packed binary format starting on a byte boundary and made up of a number of sections. Each section starts with a five-bit header. If the first bit of the header is 0 the next four bits are a repeat count, starting with the least significant bit, and a single row of bits (the number of bits in a row is specified by aGlyphData->iMetricsBuffer.Width()
) follows. If the first bit of the header is 1 the next four bits are a count of non-repeating rows, again starting with the least significant bit, and that many rows of bits follow.
|
TBool CharacterNeedsToBeRasterized(TInt aSessionHandle,TInt aCode) const;
Supported from 6.0
Tests whether or not a character needs to be rasterized.
Characters that have been rasterized are cached — there is no need to regenerate the character bitmap. This function should only be called by the Font and bitmap server.
|
|
const TOpenFontFaceAttrib* FaceAttrib() const;
Gets the typeface attributes.
These are the attributes of the font represented by this object.
|
TInt FaceIndex() const;
Gets the index of this typeface within the font file.
|
COpenFontFile* File() const;
Gets a pointer to the COpenFontFile
which created this object.
This is the COpenFontFile
which owns the file that contains the definition of the typeface. It can be used to get information about the typeface, or to access the rasterizer context (engine).
|
const TOpenFontMetrics& Metrics() const;
Gets the character metrics for this font.
|
void operator delete(TAny*);
Delete operator.
This delete operator overload removes COpenFont
objects from the shared heap.
|