Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: fbs.h
Link against: fbscli.lib

Class CFbsTypefaceStore

class CFbsTypefaceStore : public CTypefaceStore;

Description

Font and bitmap server typeface store.

Derivation

Members

Defined in CFbsTypefaceStore:
AddFile(), DefaultBitmapType(), FontHeightInPixels(), FontHeightInTwips(), GetFontById(), GetNearestFontInPixels(), GetNearestFontToDesignHeightInPixels(), GetNearestFontToDesignHeightInTwips(), GetNearestFontToMaxHeightInPixels(), GetNearestFontToMaxHeightInTwips(), InstallFile(), NewL(), NumTypefaces(), RemoveFile(), SetDefaultBitmapType(), SetDefaultLanguageForMetrics(), SetFontNameAliasL(), SetSystemDefaultTypefaceNameL(), TypefaceSupport(), ~CFbsTypefaceStore()

Inherited from CBase:
Delete(), Extension_(), operator new()

Inherited from CTypefaceStore:
AddFontL(), BaselineOffset(), ConstructL(), GetNearestFontInTwips(), IncrementFontCount(), ReleaseFont(), SuperSubHeight(), iFontAccess


Construction and destruction


NewL()

static IMPORT_C 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()

IMPORT_C ~CFbsTypefaceStore();

Description

[Top]


Member functions


AddFile()

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

Description

Adds a font store file to the typeface store. All the fonts in added and installed font files are available to the GetNearestFont...() family of functions. Additionally Bitmap Fonts are also available to GetFontById().

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:


InstallFile()

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

Description

Installs a font store file into the typeface store. All the fonts in added and installed font files are available to the GetNearestFont...() family of functions. Additionally Bitmap Fonts are also available to GetFontById().

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:


RemoveFile()

IMPORT_C 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: The id passed to this function has a different meaning depending on whether or not the file is a Symbian-format bitmap file. If it is a Symbian-format bitmap file the id is a UID, and is the same from one session to the next. If it is an Open Font System file (e.g., a TrueType file) the id is an arbitrary number. Consequently the id may vary from one session to the next, and should not be saved in a file: however it may be kept and used by a client as long as the client is running.

Parameters

TInt aId

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

See also:


GetNearestFontInPixels()

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

Description

Gets the font which is the nearest to the given font specification. Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

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.

See also:


GetNearestFontToDesignHeightInTwips()

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

Description

Gets the font which is the nearest to the given font specification. Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

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.

See also:


GetNearestFontToDesignHeightInPixels()

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

Description

Gets the font which is the nearest to the given font specification. Matching to design height gives no guarantees on the actual physical size of the font. Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

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.

See also:


GetNearestFontToMaxHeightInTwips()

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

Description

Gets the font which is the nearest to the given font specification. Matching to maximum height returns a font that will fit within the height specified. Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

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. This overrides the height specified in aFontSpec.

Return value

TInt

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

See also:


GetNearestFontToMaxHeightInPixels()

IMPORT_C TInt GetNearestFontToMaxHeightInPixels(CFont *&aFont, const TFontSpec &aFontSpec, TInt aMaxHeight);

Description

Gets the font which is the nearest to the given font specification. Matching to maximum height returns a font that will fit within the height specified. Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

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. This overrides the height specified in aFontSpec.

Return value

TInt

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

See also:


GetFontById()

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

Description

Gets a Bitmap Font by unique identifier and algorithmic drawing style. Chooses from the Bitmap fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

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.

See also:


NumTypefaces()

virtual IMPORT_C TInt NumTypefaces() const;

Description

Gets the number of typefaces supported by this store.

Return value

TInt

The number of supported typefaces.

See also:


TypefaceSupport()

virtual IMPORT_C 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.

Returns benignly with an empty TTypefaceSupport if the index is too high; this can happen if another process removes a typeface after the first process has already got the number of typefaces. However, if the aTypefaceIndex<0 the function panics with EFbsTypefaceIndexOutOfRange.

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:


FontHeightInTwips()

virtual IMPORT_C 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.

If aTypefaceIndex<0 the function panics with EFbsTypefaceIndexOutOfRange. If aTypefaceIndex is greater than the number of typefaces or aHeightIndex<0 then the function returns 0. If aHeightIndex is greater than the number of heights then the function returns the biggest height.

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 (TTypefaceSupport::iNumHeights - 1). Note: TTypefaceSupport::iNumHeights is returned by TypefaceSupport().

Return value

TInt

The height of the font, in twips.

See also:


FontHeightInPixels()

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

If aTypefaceIndex<0 the function panics with EFbsTypefaceIndexOutOfRange. If aTypefaceIndex is greater than the number of typefaces or aHeightIndex<0 then the function returns 0. If aHeightIndex is greater than the number of heights then the function returns the biggest height.

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 (TTypefaceSupport::iNumHeights - 1). Note: TTypefaceSupport::iNumHeights is returned by TypefaceSupport().

Return value

TInt

The height of the font, in pixels.


DefaultBitmapType()

IMPORT_C TGlyphBitmapType DefaultBitmapType() const;

Description

Gets the default anti-aliasing setting for scalable fonts.

Return value

TGlyphBitmapType

Indicates whether or not scalable fonts should be drawn using anti-aliasing.


SetDefaultBitmapType()

IMPORT_C void SetDefaultBitmapType(TGlyphBitmapType aType) const;

Description

Sets the default anti-aliasing setting for scalable fonts. Unless this default setting is overridden so that a font is explicitly requested with anti-aliasing turned on or off, (see TOpenFontSpec::SetBitmapType() or TFontStyle::SetBitmapType()), fonts will use the default setting. The default setting would typically only be changed via the Control Panel. The new setting affects fonts requested after the change has been made. There is currently no anti-aliasing support for bitmapped fonts.

Parameters

TGlyphBitmapType aType

Indicates whether or not scalable fonts should be drawn using anti-aliasing.

See also:


SetFontNameAliasL()

IMPORT_C void SetFontNameAliasL(const TDesC &aFontAlias, const TDesC &aFontName) const;

Description

Sets an alias for a font name.

If a requested font cannot be found and its name occurs in the alias list then it will be searched for again using the font name corresponding to that alias. If an empty font name is passed then the alias will be removed the list.

Parameters

const TDesC &aFontAlias

const TDesC &aFontName


SetDefaultLanguageForMetrics()

IMPORT_C void SetDefaultLanguageForMetrics(TLanguage aLanguage) const;

Description

Specifies the default language with which font metrics calculation will be based on. The default language will be used if none is set on the font specification.

Parameters

TLanguage aLanguage


SetSystemDefaultTypefaceNameL()

Capability: WriteDeviceData

IMPORT_C void SetSystemDefaultTypefaceNameL(const TDesC &aFontTypefaceName);

Description

Sets the system default font typeface. This font will be used when finding the nearest font and the font specified is an empty descriptor. If the system default font is not set, then the default behaviour is to find the nearest match.

Parameters

const TDesC &aFontTypefaceName