Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <GDI.H>
Link against: gdi.lib

Class CTypefaceStore

class CTypefaceStore : public CBase;

Description

Typeface store abstract base interface.

This class provides the interface to a store for typefaces.

See also CFontStore.

Derivation

Members

Defined in CTypefaceStore:

Inherited from CBase:


Construction and destruction


~CTypefaceStore()

IMPORT_C ~CTypefaceStore();

Description

Destroys the typeface store and reclaims the memory allocated to it.


CTypefaceStore()

protected: IMPORT_C CTypefaceStore();

Description


ConstructL()

protected: IMPORT_C void ConstructL();

Description

Second phase constructor.

[Top]


Member functions


GetNearestFontInTwips(CFont *&,const TFontSpec &)

Interface status: deprecated Use GetNearestFontToDesignHeightInTwips

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

Description

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont() .

Note that this deprecated function is replaced by the new GetNearestFontToDesignHeightInTwips() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every character within any given text string will fit within the given amount of twips, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

Parameters

CFont *&aFont

On return, contains a pointer to the nearest font.

const TFontSpec &aFontSpec

The specification of the font to be matched.

Return value

TInt

KErrNone if successful; a system-wide error code otherwise.


GetNearestFontToDesignHeightInTwips(CFont *&,const TFontSpec &)

virtual TInt GetNearestFontToDesignHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec)=0;

Description

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont() .

This new function replaces the deprecated GetNearestFontInTwips() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every character within any given text string will fit within the given amount of twips, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

Parameters

CFont *&aFont

On return, contains a pointer to the nearest font.

const TFontSpec &aFontSpec

The specification of the font to be matched.

Return value

TInt

KErrNone if successful; a system-wide error code otherwise.


GetNearestFontToMaxHeightInTwips(CFont *&,const TFontSpec &,TInt)

virtual TInt GetNearestFontToMaxHeightInTwips(CFont *&aFont, const TFontSpec &aFontSpec, TInt aMaxHeight)=0;

Description

Gets the font which is the nearest to the given font specification.

When the font is no longer needed, call ReleaseFont() .

The font and bitmap server returns a pointer to the nearest matching font from those available. Matches to max height of font - this does its best to return a font that will fit within the maximum height specified (but note that variations due to hinting algorithms may rarely result in this height being exceeded by up to one pixel). Problems can also be encountered with bitmap fonts where the typeface exists but doesn't have a font small enough.

Parameters

CFont *&aFont

On return, contains a pointer to the nearest font.

const TFontSpec &aFontSpec

The specification of the font to be matched.

TInt aMaxHeight

The maximum height within which the font must fit.

Return value

TInt

KErrNone if successful; a system-wide error code otherwise.


NumTypefaces()const

virtual TInt NumTypefaces() const=0;

Description

Gets the number of typefaces supported by the typeface store.

Return value

TInt

The number of supported typefaces.


TypefaceSupport(TTypefaceSupport &,TInt)const

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

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 (CTypefaceStore::NumTypefaces()const - 1).


FontHeightInTwips(TInt,TInt)const

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

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 (CTypefaceStore::NumTypefaces()const - 1).

TInt aHeightIndex

A font height index number.

Return value

TInt

The height of the font, in twips.


ReleaseFont(CFont *)

IMPORT_C void ReleaseFont(CFont *aFont);

Description

Releases the hold of a typeface store client on a specified font.

Decrements the access-count for the specified font by one. If this reduces the access-count to zero then the font is no longer needed by any client, and is deleted from the typeface store list.

Parameters

CFont *aFont

The font to be released by the client.


BaselineOffset(TInt,TFontPrintPosition)

IMPORT_C static TInt BaselineOffset(TInt aHeight, TFontPrintPosition aPos);

Description

Gets the baseline offset, in twips, for any font in subscript or superscript form.

If the print position is normal then zero is returned. If it is superscript then the baseline offset returned is a percentage, KSuperscriptOffsetPercentage, of aHeight. If it is subscript then the baseline offset returned is a percentage, KSubscriptOffsetPercentage, of aHeight.

Parameters

TInt aHeight

The height of a font.

TFontPrintPosition aPos

The print position of the required font: superscript, subscript or normal.

Return value

TInt

The baseline offset for the font.


SuperSubHeight(TInt,TFontPrintPosition)

IMPORT_C static TInt SuperSubHeight(TInt aHeight, TFontPrintPosition aPos);

Description

Gets the height for a font in subscript or superscript form.

If the print position is normal then aHeight is returned unchanged. If it is superscript or subscript then the height returned is a percentage, KSuperSubScalingPercentage, of aHeight.

Parameters

TInt aHeight

The height of a font.

TFontPrintPosition aPos

The print position of the font: superscript, subscript or normal.

Return value

TInt

The required height of the font.


AddFontL(CFont *)

protected: IMPORT_C void AddFontL(CFont *aFont);

Description

Adds a hold, by a client of the typeface store, on the specified font.

If the specified font is not currently accessed by any clients of the typeface store then the font is added to the font list and the access count set to 1. If it is currently accessed then the access count for the font is incremented by 1.

Parameters

CFont *aFont

Pointer to the device specific font accessed.


IncrementFontCount(const CFont *)

protected: IMPORT_C TBool IncrementFontCount(const CFont *aFont);

Description

Search for the font in iFontAccess and increment its count.

Parameters

const CFont *aFont

Font to search for.

Return value

TBool

ETrue if the specified font is found, EFalse otherwise.

[Top]


Member data


iFontAccess

protected: CArrayFixFlat< TFontAccess > * iFontAccess;

Description

A list of fonts accessed by clients of the typeface store, which pairs a font with a count of the number of clients accessing the font.

Implemented as an array of CTypefaceStore::TFontAccess objects.

An object is added to this array for every font accessed. If the font is released by all clients, and the access count drops to zero, the font is removed from the list.