COpenFont Class Reference

class COpenFont : public CBase

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.

Derived 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.

COpenFontFile::GetNearestFontInPixelsL()

Inherits from

Public Member Functions
COpenFont(RHeap *, COpenFontSessionCacheList *, COpenFontFile *)
COpenFont(RHeap *, COpenFontSessionCacheList *, COpenFontFile *, TInt)
~COpenFont()
TBool CharacterNeedsToBeRasterized(TInt, TInt)
TInt DecrementCachedRefCount(TInt, TShapeHeader *, TBool)
voidDeleteShaper()
IMPORT_C voidExtendedInterface(TUid, TAny *&)
const TOpenFontFaceAttrib *FaceAttrib()
TInt FaceIndex()
COpenFontFile *File()
TInt FontCapitalAscent()
TInt FontLineGap()
TInt FontMaxAscent()
TInt FontMaxDescent()
TInt FontMaxHeight()
TInt FontStandardDescent()
TInt FreeShaperCacheMemory(TInt)
TBool GetCharacterData(TInt, TInt, const TOpenFontCharMetrics *&, const TUint8 *&)
COpenFontGlyphCache *GetGlyphCache()
TShapeHeader *GetShapedData(TInt, TFontShapeFunctionParameters *)
CShaper *GetShaper()
TBool HasCharacterL(TInt)
TBool HasShaper()
TShapeHeader *InsertShapedDataIntoCache(TInt, TFontShapeFunctionParameters *, TShapeHeader *)
const TOpenFontMetrics &Metrics()
voidOnFileDeleted()
TBool Rasterize(TInt, TInt, TOpenFontGlyphData *)
voidRasterizeL(TInt, TOpenFontGlyphData *)
voidSetShaper(CShaper *)
IMPORT_C voidoperator delete(TAny *)
Protected Member Functions
const COpenFontGlyph *FontCacheGlyph(TInt, TInt *&)
const COpenFontGlyph *FontCacheGlyph(TInt)
TInt PointerToThisOffset(const TAny *)
voidSetGlyphCache(COpenFontGlyphCache *)
TAny *ThisOffsetToPointer(const TInt)
Private Member Functions
const COpenFontGlyph *Glyph(TInt, TInt)
voidRasterizeHelperL(TInt, TOpenFontGlyphData *, TOpenFontGlyphData *&)
const COpenFontGlyph *SessionCacheGlyph(RHeap *, TInt, TInt, COpenFontSessionCache *&, TInt &, TBool)
COpenFontSessionCacheList *SessionCacheList()
voidSetFile(COpenFontFile *)
voidSetSessionCacheList(COpenFontSessionCacheList *)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Protected Attributes
TInt iFontCapitalAscent
TInt iFontLineGap
TInt iFontMaxAscent
TInt iFontMaxDescent
TInt iFontStandardDescent
TInt iGlyphCacheOffset
RHeap *iHeap
TOpenFontMetrics iMetrics
Private Attributes
TInt iFaceIndex
TInt iFileOffset
TAny *iReserved
TInt iSessionCacheListOffset
CShaper *iShaper

Constructor & Destructor Documentation

COpenFont(RHeap *, COpenFontSessionCacheList *, COpenFontFile *)

IMPORT_CCOpenFont(RHeap *aHeap,
COpenFontSessionCacheList *aSessionCacheList,
COpenFontFile *aFile
)

Parameters

RHeap * aHeap
COpenFontSessionCacheList * aSessionCacheList
COpenFontFile * aFile

COpenFont(RHeap *, COpenFontSessionCacheList *, COpenFontFile *, TInt)

IMPORT_CCOpenFont(RHeap *aHeap,
COpenFontSessionCacheList *aSessionCacheList,
COpenFontFile *aFile,
TIntaFaceIndex
)

Parameters

RHeap * aHeap
COpenFontSessionCacheList * aSessionCacheList
COpenFontFile * aFile
TInt aFaceIndex

~COpenFont()

IMPORT_C~COpenFont()

Member Functions Documentation

CharacterNeedsToBeRasterized(TInt, TInt)

TBool CharacterNeedsToBeRasterized(TIntaSessionHandle,
TIntaCode
)const [inline]

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.

ETrue if the character needs to be rasterized, otherwise EFalse.

Parameters

TInt aSessionHandleA handle to the font and bitmap server session.
TInt aCodeThe code for the Unicode character.

DecrementCachedRefCount(TInt, TShapeHeader *, TBool)

TInt DecrementCachedRefCount(TIntaSessionHandle,
TShapeHeader *aShapeHeader,
TBoolaResetAll = EFalse
)

Parameters

TInt aSessionHandle
TShapeHeader * aShapeHeader
TBool aResetAll = EFalse

DeleteShaper()

voidDeleteShaper()const

ExtendedInterface(TUid, TAny *&)

IMPORT_C voidExtendedInterface(TUidaUid,
TAny *&aParam
)[virtual]

Parameters

TUid aUid
TAny *& aParam

FaceAttrib()

const TOpenFontFaceAttrib *FaceAttrib()const [inline]

Gets the typeface attributes.

These are the attributes of the font represented by this object.

The typeface attributes.

FaceIndex()

TInt FaceIndex()const [inline]

Gets the index of this typeface within the font file.

The index of this typeface within the font file.

File()

COpenFontFile *File()const [inline]

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).

The COpenFontFile which created this object.

FontCacheGlyph(TInt, TInt *&)

const COpenFontGlyph *FontCacheGlyph(TIntaCode,
TInt *&aNode
)[protected]

WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.

Parameters

TInt aCode
TInt *& aNode

FontCacheGlyph(TInt)

const COpenFontGlyph *FontCacheGlyph(TIntaCode)[protected]

Parameters

TInt aCode

FontCapitalAscent()

TInt FontCapitalAscent()const [inline]

Gets the ascent of an ANSI capital letter in the font whether or not there are any ANSI capitals in the font. The positive distance from the font baseline to the top of a standard ANSI capital letter

AscentInPixels()

FontLineGap()

TInt FontLineGap()const [inline]

Gets the suggested line gap for the font. This is the recommended baseline to baseline distance between successive lines of text in the font. The positive recommended gap between successive lines

FontMaxAscent()

TInt FontMaxAscent()const [inline]

Gets the max ascent of any pre-composed glyph in the font. This will include accents or diacritics that form part of pre-composed glyphs. It is not guaranteed to cover the max ascent of composite glyphs that have to be created by a layout engine. This is also the recommended distance between the top of a text box and the baseline of the first line of text.

The value may be affected by the TLanguage value set by SetScriptTypeForMetrics().

The positive distance from the font baseline to the top of the highest pre-composed glyph (including accents) above the baseline.

AscentInPixels()

SetScriptTypeForMetrics()

FontMaxDescent()

TInt FontMaxDescent()const [inline]

Gets the max descent of any pre-composed glyph in the font. This will include accents or diacritics that form part of pre-composed glyphs. It is not guaranteed to cover the max descent of composite glyphs that have to be created by a layout engine.

The value may be affected by the TLanguage value set by SetScriptTypeForMetrics().

The positive distance from the font baseline to the bottom of the lowest pre-composed glyph (including accents) below the baseline

DescentInPixels()

SetScriptTypeForMetrics()

FontMaxHeight()

TInt FontMaxHeight()const [inline]

Gets the maximum height for the font. This is the sum of the max ascent of the font and the max descent of the font.

The value may be affected by the TLanguage value set by SetScriptTypeForMetrics().

The positive maximum height of the font

HeightInPixels()

SetScriptTypeForMetrics()

FontStandardDescent()

TInt FontStandardDescent()const [inline]

Gets the descent of an ANSI descending character in the font. Whether or not there are any ANSI descenders in the font.

The value may be affected by the TLanguage value set by SetScriptTypeForMetrics().

The positive distance from the font baseline to the bottom of the lowest ANSI descender.

DescentInPixels()

SetScriptTypeForMetrics()

FreeShaperCacheMemory(TInt)

TInt FreeShaperCacheMemory(TIntaBytesNeeded)

Parameters

TInt aBytesNeeded

GetCharacterData(TInt, TInt, const TOpenFontCharMetrics *&, const TUint8 *&)

TBool GetCharacterData(TIntaSessionHandle,
TIntaCode,
const TOpenFontCharMetrics *&aMetrics,
const TUint8 *&aBitmap
)const

Parameters

TInt aSessionHandle
TInt aCode
const TOpenFontCharMetrics *& aMetrics
const TUint8 *& aBitmap

GetGlyphCache()

COpenFontGlyphCache *GetGlyphCache()

GetShapedData(TInt, TFontShapeFunctionParameters *)

TShapeHeader *GetShapedData(TIntaSessionHandle,
TFontShapeFunctionParameters *aParams
)

Parameters

TInt aSessionHandle
TFontShapeFunctionParameters * aParams

GetShaper()

CShaper *GetShaper()

Glyph(TInt, TInt)

const COpenFontGlyph *Glyph(TIntaSessionHandle,
TIntaCode
)const [private]

Parameters

TInt aSessionHandle
TInt aCode

HasCharacterL(TInt)

TBool HasCharacterL(TIntaCode)const

Parameters

TInt aCode

HasShaper()

TBool HasShaper()const

InsertShapedDataIntoCache(TInt, TFontShapeFunctionParameters *, TShapeHeader *)

TShapeHeader *InsertShapedDataIntoCache(TIntaSessionHandle,
TFontShapeFunctionParameters *aParams,
TShapeHeader *aShapeHeader
)

Parameters

TInt aSessionHandle
TFontShapeFunctionParameters * aParams
TShapeHeader * aShapeHeader

Metrics()

const TOpenFontMetrics &Metrics()const [inline]

Gets the character metrics for this font.

The character metrics for this font.

OnFileDeleted()

voidOnFileDeleted()

PointerToThisOffset(const TAny *)

TInt PointerToThisOffset(const TAny *aAny)[protected]

WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.

Parameters

const TAny * aAny

Rasterize(TInt, TInt, TOpenFontGlyphData *)

TBool Rasterize(TIntaSessionHandle,
TIntaCode,
TOpenFontGlyphData *aGlyphData
)

Parameters

TInt aSessionHandle
TInt aCode
TOpenFontGlyphData * aGlyphData

RasterizeHelperL(TInt, TOpenFontGlyphData *, TOpenFontGlyphData *&)

voidRasterizeHelperL(TIntaCode,
TOpenFontGlyphData *aGlyphData,
TOpenFontGlyphData *&aTempGlyphData
)[private]

Parameters

TInt aCode
TOpenFontGlyphData * aGlyphData
TOpenFontGlyphData *& aTempGlyphData

RasterizeL(TInt, TOpenFontGlyphData *)

voidRasterizeL(TIntaCode,
TOpenFontGlyphData *aGlyphData
)[pure virtual]

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.

Parameters

TInt aCodeThe character code of the Unicode character for which the bitmap is required.
TOpenFontGlyphData * aGlyphDataOn return, contains a pointer to a TOpenFontGlyphData containing the character's bitmap and metrics.

SessionCacheGlyph(RHeap *, TInt, TInt, COpenFontSessionCache *&, TInt &, TBool)

const COpenFontGlyph *SessionCacheGlyph(RHeap *aHeap,
TIntaSessionHandle,
TIntaCode,
COpenFontSessionCache *&aCache,
TInt &aIndex,
TBoolaCreate
)const [private]

Parameters

RHeap * aHeap
TInt aSessionHandle
TInt aCode
COpenFontSessionCache *& aCache
TInt & aIndex
TBool aCreate

SessionCacheList()

COpenFontSessionCacheList *SessionCacheList()const [private]

SetFile(COpenFontFile *)

voidSetFile(COpenFontFile *aFile)[private]

Parameters

COpenFontFile * aFile

SetGlyphCache(COpenFontGlyphCache *)

voidSetGlyphCache(COpenFontGlyphCache *aGlyphCache)[protected]

Parameters

COpenFontGlyphCache * aGlyphCache

SetSessionCacheList(COpenFontSessionCacheList *)

voidSetSessionCacheList(COpenFontSessionCacheList *aSessionCacheList)[private]

Parameters

COpenFontSessionCacheList * aSessionCacheList

SetShaper(CShaper *)

voidSetShaper(CShaper *aShaper)

Parameters

CShaper * aShaper

ThisOffsetToPointer(const TInt)

TAny *ThisOffsetToPointer(const TIntaOffset)[protected]

WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases.

Parameters

const TInt aOffset

operator delete(TAny *)

IMPORT_C voidoperator delete(TAny *)

Parameters

TAny *

Member Data Documentation

TInt iFaceIndex

TInt iFaceIndex[private]

TInt iFileOffset

TInt iFileOffset[private]

TInt iFontCapitalAscent

TInt iFontCapitalAscent[protected]

The positive distance in pixels from the baseline to the top of an ANSI capital (whether or not there are ANSI capitals in the font)

TInt iFontLineGap

TInt iFontLineGap[protected]

The recommended baseline to baseline gap for successive lines of text in the font

TInt iFontMaxAscent

TInt iFontMaxAscent[protected]

The positive distance in pixels from the baseline to the top of the highest pre-composed glyph in the font

TInt iFontMaxDescent

TInt iFontMaxDescent[protected]

The positive distance in pixels from the baseline to the bottom of the lowest pre-composed glyph in the font

TInt iFontStandardDescent

TInt iFontStandardDescent[protected]

The positive distance in pixels from the baseline to the bottom of the lowest ANSI descender (whether or not there are ANSI chars in the font)

TInt iGlyphCacheOffset

TInt iGlyphCacheOffset[protected]

WARNING: Compatibility is not guaranteed in future releases. Please use the provided APIs only. Offset from the address of this font of the per-font glyph cache which is owned by the font

RHeap * iHeap

RHeap *iHeap[protected]

TOpenFontMetrics iMetrics

TOpenFontMetrics iMetrics[protected]

TAny * iReserved

TAny *iReserved[private]

TInt iSessionCacheListOffset

TInt iSessionCacheListOffset[private]

CShaper * iShaper

CShaper *iShaper[private]

The shaper for performing complex character positioning and substitution, if available. Null otherwise.

WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only.