Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: fbs.h
Link against: gdi.lib

Class CFbsTypefaceStore

CFbsTypefaceStore

Support

Supported from 5.0

Description

Font and bitmap server typeface store.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CFbsTypefaceStoreFont and bitmap server typeface store
CTypefaceStoreTypeface store abstract base interface

Defined in CFbsTypefaceStore:
AddFile(), FontHeightInPixels(), FontHeightInTwips(), GetFontById(), GetNearestFontInPixels(), GetNearestFontInTwips(), InstallFile(), NewL(), NumTypefaces(), RemoveFile(), TypefaceSupport(), ~CFbsTypefaceStore()

Inherited from CBase:
operator new()

Inherited from CTypefaceStore:
BaselineOffset(), ReleaseFont(), SuperSubHeight()


Construction and destruction


NewL()

static CFbsTypefaceStore* NewL(CGraphicsDevice* aDevice);

Description

Allocates and constructs a CFbsTypefaceStore, specifying a graphics device.

Parameters

CGraphicsDevice* aDevice

A pointer to a graphics device.

Return value

CFbsTypefaceStore*

A pointer to the newly created typeface store.


~CFbsTypefaceStore()

~CFbsTypefaceStore();

Description

Destructor.

[Top]


Member functions


AddFile()

TInt AddFile(const TDesC& aName,TInt& aId);

Description

Adds a font store file to the typeface store.

This function adds the typeface to a reference counted list of fonts. Each client that adds the typeface to the store increases the reference count. The count is decremented when a client using the typeface is destroyed or calls the RemoveFile() function. The typeface is removed from the store only when the the reference count is zero (it is not being used by any clients).

The InstallFile() function is similar, except that the typeface is not reference counted, and is hence not removed when all the clients using it are destroyed.

Parameters

const TDesC& aName

A descriptor containing the filename of the typeface store

TInt& aId

On return, contains the id of the typeface.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.

See also:


FontHeightInPixels()

TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const;

Description

Gets the height of the font with specified height and typeface indices, in pixels.

The value returned is rounded up or down to the nearest font height in pixels.

Parameters

TInt aTypefaceIndex

A typeface index number, in the range: 0 to (NumTypefaces() - 1).

TInt aHeightIndex

A font height index number, in the range: 0 to (iNumHeights - 1). Note: TTypefaceSupport::iNumHeights is returned by TypefaceSupport().

Return value

TInt

The height of the font, in pixels.


FontHeightInTwips()

virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const;

Description

Gets the height of the font with specified height and typeface indices, in twips.

The value returned is rounded up or down to the nearest font height in twips.

Parameters

TInt aTypefaceIndex

A typeface index number, in the range: 0 to (NumTypefaces() - 1).

TInt aHeightIndex

A font height index number, in the range: 0 to (iNumHeights - 1). Note: TTypefaceSupport::iNumHeights is returned by TypefaceSupport().

Return value

TInt

The height of the font, in twips.

See also:


GetFontById()

TInt GetFontById(CFont*& aFont,TUid aUid,const TAlgStyle& aAlgStyle);

Description

Gets font by unique identifier.

Parameters

CFont*& aFont

On return, contains a pointer to the retrieved font.

TUid aUid

The unique identifier of the font to be retrieved.

const TAlgStyle& aAlgStyle

Algorithmic style to be applied. e.g. Sets things like algorithmic bolding, or slant for pseudo-italics.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.


GetNearestFontInPixels()

TInt GetNearestFontInPixels(CFont*& aFont,const TFontSpec& aFontSpec);

Description

Gets the nearest bitmap font in the current graphics map, in pixels, to the given font specification.

Parameters

CFont*& aFont

On return, contains a pointer to the nearest bitmap font.

const TFontSpec& aFontSpec

The device dependent font specification of the font to be found.

Return value

TInt

KErrNone if no nearest font can be found or if there was no error, KErrNoMemory if a nearest font can be found but no memory can be allocated to it in the font store, or another of the system-wide error codes.


GetNearestFontInTwips()

virtual TInt GetNearestFontInTwips(CFont*& aFont,const TFontSpec& aFontSpec);

Description

Gets the bitmap font in the current graphics map, in twips, which is nearest to the specified font specification.

Parameters

CFont*& aFont

On return, contains a pointer to the nearest bitmap font.

const TFontSpec& aFontSpec

The device independent font specification of the font to be found.

Return value

TInt

KErrNone if no nearest font can be found or if there was no error, KErrNoMemory if a nearest font can be found but no memory can be allocated to it in the font store, or another of the system-wide error codes.

See also:


InstallFile()

TInt InstallFile(const TDesC& aName,TInt& aId);

Description

Installs a font store file into the typeface store.

Installed files remain in the typeface store even after the client which added them is destroyed. They can be removed using RemoveFile().

Parameters

const TDesC& aName

The name of the file to be installed.

TInt& aId

On return, contains the id of the installed file.

Return value

TInt

KErrNone if successful, otherwise another of the system-wide error codes.

See also:


NumTypefaces()

virtual TInt NumTypefaces() const;

Description

Gets the number of typefaces supported by this store.

Return value

TInt

The number of supported typefaces.

See also:


RemoveFile()

void RemoveFile(TInt aId=0);

Description

Decrements the font store files reference count and removes the typeface when the reference count is zero.

This function decrements the reference count of a file which was added using AddFile(), and removes it from the store if the reference count reaches zero. If the font was not found in the list of reference-counted files (see AddFile()) it is assumed to be an installed file (see InstallFile()) and an attempt is made to remove it anyway.

Note:

Parameters

TInt aId=0

The id of the file to be removed/decremented. Set by AddFile() or InstallFile().

See also:


TypefaceSupport()

virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const;

Description

Gets typeface information for a specified typeface index.

This information is returned in aTypefaceSupport, and includes the typeface name and typeface attributes, the number of font heights, the maximum and minimum font heights, and whether it is a scaleable typeface.

Parameters

TTypefaceSupport& aTypefaceSupport

On return, if the function executed successfully, this object contains the typeface information.

TInt aTypefaceIndex

A typeface index number, in the range: zero to (NumTypefaces() - 1).

See also: