CFbsTypefaceStore Class Reference

class CFbsTypefaceStore : public CTypefaceStore

Font and bitmap server typeface store.

Inherits from

Public Member Functions
~CFbsTypefaceStore()
IMPORT_C TIntAddFile(const TDesC &, TInt &)
IMPORT_C TGlyphBitmapTypeDefaultBitmapType()
IMPORT_C TIntFontHeightInPixels(TInt, TInt)
IMPORT_C TIntFontHeightInTwips(TInt, TInt)
IMPORT_C TIntGetFontById(CFont *&, TUid, const TAlgStyle &)
IMPORT_C voidGetLinkedTypefaceL(CLinkedTypefaceSpecification &)
IMPORT_C TIntGetNearestFontInPixels(CFont *&, const TFontSpec &)
IMPORT_C TIntGetNearestFontInTwips(CFont *&, const TFontSpec &)
IMPORT_C TIntGetNearestFontToDesignHeightInPixels(CFont *&, const TFontSpec &)
IMPORT_C TIntGetNearestFontToDesignHeightInTwips(CFont *&, const TFontSpec &)
IMPORT_C TIntGetNearestFontToMaxHeightInPixels(CFont *&, const TFontSpec &, TInt)
IMPORT_C TIntGetNearestFontToMaxHeightInTwips(CFont *&, const TFontSpec &, TInt)
IMPORT_C TIntInstallFile(const TDesC &, TInt &)
IMPORT_C CFbsTypefaceStore *NewL(CGraphicsDevice *)
IMPORT_C TIntNumTypefaces()
IMPORT_C TIntRegisterLinkedTypeface(const CLinkedTypefaceSpecification &, TInt &)
IMPORT_C TIntRegisterLinkedTypeface(const CLinkedTypefaceSpecification &)
IMPORT_C voidReleaseTwipsCache()
IMPORT_C voidRemoveFile(TInt)
IMPORT_C voidRemoveFontFileLocksL()
IMPORT_C voidRemoveFontFileLocksL(const TDesC &, TBool)
IMPORT_C voidRemoveFontFileLocksL(const TDesC &)
IMPORT_C voidSetDefaultBitmapType(TGlyphBitmapType)
IMPORT_C voidSetDefaultLanguageForMetrics(TLanguage)
IMPORT_C voidSetFontNameAliasL(const TDesC &, const TDesC &)
IMPORT_C voidSetSystemDefaultTypefaceNameL(const TDesC &)
IMPORT_C voidTypefaceSupport(TTypefaceSupport &, TInt)
IMPORT_C TIntUpdateLinkedTypeface(const CLinkedTypefaceSpecification &)
Private Member Functions
CFbsTypefaceStore(CGraphicsDevice *)
voidConstructL()
TInt CreateFont(CFont *&, const TFontInfo &)
TInt FontHeight(TInt, TInt, TInt)
TInt GetNearestFontInTwipsAndCreateFont(CFont *&, TInt, const TFontSpec &, TInt)
voidGetPixelSizeInTwips(TSize &)
TBool IsFontLoaded(CFont *&, const TFontInfo &)
TInt SendGetNearestFontCommandNCreateFont(CFont *&, TInt, const TFontSpec &, TInt)
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()
CTypefaceStore::AddFontL(CFont *)
CTypefaceStore::BaselineOffset(TInt,TFontPrintPosition)
CTypefaceStore::CTypefaceStore()
CTypefaceStore::IncrementFontCount(const CFont *)
CTypefaceStore::ReleaseFont(CFont *)
CTypefaceStore::SuperSubHeight(TInt,TFontPrintPosition)
CTypefaceStore::~CTypefaceStore()
Private Attributes
CGraphicsDevice *iDevice
RFbsSession *iFbs
CFontCache *iTwipsCache
Inherited Attributes
CTypefaceStore::iFontAccess

Constructor & Destructor Documentation

CFbsTypefaceStore(CGraphicsDevice *)

CFbsTypefaceStore(CGraphicsDevice *aDevice)[private]

Parameters

CGraphicsDevice * aDevice

~CFbsTypefaceStore()

IMPORT_C~CFbsTypefaceStore()

Member Functions Documentation

AddFile(const TDesC &, TInt &)

IMPORT_C TIntAddFile(const TDesC &aName,
TInt &aId
)

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. InstallFile() RemoveFile() GetFontById() GetNearestFontToDesignHeightInTwips() GetNearestFontToDesignHeightInPixels() GetNearestFontToMaxHeightInTwips() GetNearestFontToMaxHeightInPixels()

Parameters

const TDesC & aNameA descriptor containing the filename of the typeface store
TInt & aIdOn return, contains the id of the typeface.

ConstructL()

voidConstructL()[private]

CreateFont(CFont *&, const TFontInfo &)

TInt CreateFont(CFont *&aFont,
const TFontInfo &aFontInfo
)[private]

Parameters

CFont *& aFont
const TFontInfo & aFontInfo

DefaultBitmapType()

IMPORT_C TGlyphBitmapTypeDefaultBitmapType()const

Gets the default anti-aliasing setting for scalable fonts.

FontHeight(TInt, TInt, TInt)

TInt FontHeight(TIntaTypefaceIndex,
TIntaHeightIndex,
TIntaMessage
)const [private]

Parameters

TInt aTypefaceIndex
TInt aHeightIndex
TInt aMessage

FontHeightInPixels(TInt, TInt)

IMPORT_C TIntFontHeightInPixels(TIntaTypefaceIndex,
TIntaHeightIndex
)const

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 aTypefaceIndexA typeface index number, in the range: 0 to (NumTypefaces() - 1).
TInt aHeightIndexA font height index number, in the range: 0 to (TTypefaceSupport::iNumHeights - 1). Note: TTypefaceSupport::iNumHeights is returned by TypefaceSupport().

FontHeightInTwips(TInt, TInt)

IMPORT_C TIntFontHeightInTwips(TIntaTypefaceIndex,
TIntaHeightIndex
)const [virtual]

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.

CTypefaceStore::FontHeightInTwips()

Parameters

TInt aTypefaceIndexA typeface index number, in the range: 0 to (NumTypefaces() - 1).
TInt aHeightIndexA font height index number, in the range: 0 to (TTypefaceSupport::iNumHeights - 1). Note: TTypefaceSupport::iNumHeights is returned by TypefaceSupport().

GetFontById(CFont *&, TUid, const TAlgStyle &)

IMPORT_C TIntGetFontById(CFont *&aFont,
TUidaUid,
const TAlgStyle &aAlgStyle
)

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.

GetNearestFontToMaxHeightInTwips() GetNearestFontToDesignHeightInTwips() GetNearestFontToMaxHeightInPixels() GetNearestFontToDesignHeightInPixels() AddFile() InstallFile()

Parameters

CFont *& aFontOn return, contains a pointer to the retrieved font.
TUid aUidThe unique identifier of the font to be retrieved.
const TAlgStyle & aAlgStyleAlgorithmic style to be applied. e.g. Sets things like algorithmic bolding, or slant for pseudo-italics.

GetLinkedTypefaceL(CLinkedTypefaceSpecification &)

IMPORT_C voidGetLinkedTypefaceL(CLinkedTypefaceSpecification &aLinkedTypefaceSpec)

Function to retrieve a linked typeface specification from the installed rasterizer. If there is not a rasterizer present supporting font linking then KErrNotSupported will be returned. The rasterizer is name specified within the passed specification and fills in the elements and groups if the typeface exists.

leave
KErrNoMemory if there is insufficient memory available
leave
KErrServerTerminated if the server no longer present
leave
KErrServerBusy if there are no message slots available

Parameters

CLinkedTypefaceSpecification & aLinkedTypefaceSpec

GetNearestFontInPixels(CFont *&, const TFontSpec &)

IMPORT_C TIntGetNearestFontInPixels(CFont *&aFont,
const TFontSpec &aFontSpec
)

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 GetNearestFontToDesignHeightInPixels() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInPixels() function instead. This will guarantee that every character within any given text string will fit within the given amount of pixels, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

Use GetNearestFontToDesignHeightInPixels GetNearestFontToDesignHeightInPixels() GetNearestFontToMaxHeightInPixels() AddFile() InstallFile()

Parameters

CFont *& aFontOn return, contains a pointer to the nearest font.
const TFontSpec & aFontSpecThe specification of the font to be matched.

GetNearestFontInTwips(CFont *&, const TFontSpec &)

IMPORT_C TIntGetNearestFontInTwips(CFont *&aFont,
const TFontSpec &aFontSpec
)[virtual]

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.

Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

GetNearestFontToDesignHeightInTwips() GetNearestFontToMaxHeightInTwips() AddFile() InstallFile()

Parameters

CFont *& aFontOn return, contains a pointer to the nearest font.
const TFontSpec & aFontSpecThe specification of the font to be matched.

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

TInt GetNearestFontInTwipsAndCreateFont(CFont *&aFont,
TIntaFbsMessage,
const TFontSpec &aFontSpec,
TIntaMaxHeight = 0
)[private]

Parameters

CFont *& aFont
TInt aFbsMessage
const TFontSpec & aFontSpec
TInt aMaxHeight = 0

GetNearestFontToDesignHeightInPixels(CFont *&, const TFontSpec &)

IMPORT_C TIntGetNearestFontToDesignHeightInPixels(CFont *&aFont,
const TFontSpec &aFontSpec
)

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 GetNearestFontInPixels() yielding (virtually) the same result. However clients are strongly encouraged to use the new GetNearestFontToMaxHeightInPixels() function instead. This will guarantee that every character within any given text string will fit within the given amount of pixels, whereas the design height is an aesthetic unit decided by the font designer without strict physical meaning, which may result in cropped characters.

Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

GetNearestFontToMaxHeightInPixels() AddFile() InstallFile()

Parameters

CFont *& aFontOn return, contains a pointer to the nearest font.
const TFontSpec & aFontSpecThe specification of the font to be matched.

GetNearestFontToDesignHeightInTwips(CFont *&, const TFontSpec &)

IMPORT_C TIntGetNearestFontToDesignHeightInTwips(CFont *&aFont,
const TFontSpec &aFontSpec
)[virtual]

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.

Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

GetNearestFontToMaxHeightInTwips() AddFile() InstallFile()

Parameters

CFont *& aFontOn return, contains a pointer to the nearest font.
const TFontSpec & aFontSpecThe specification of the font to be matched.

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

IMPORT_C TIntGetNearestFontToMaxHeightInPixels(CFont *&aFont,
const TFontSpec &aFontSpec,
TIntaMaxHeight
)

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.

Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

GetNearestFontToDesignHeightInPixels() AddFile() InstallFile()

Parameters

CFont *& aFontOn return, contains a pointer to the nearest font.
const TFontSpec & aFontSpecThe specification of the font to be matched.
TInt aMaxHeightThe maximum height within which the font must fit. This overrides the height specified in aFontSpec.

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

IMPORT_C TIntGetNearestFontToMaxHeightInTwips(CFont *&aFont,
const TFontSpec &aFontSpec,
TIntaMaxHeight
)[virtual]

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.

Chooses from the fonts loaded at system startup or through the AddFile() or InstallFile() APIs.

GetNearestFontToDesignHeightInTwips() AddFile() InstallFile()

Parameters

CFont *& aFontOn return, contains a pointer to the nearest font.
const TFontSpec & aFontSpecThe specification of the font to be matched.
TInt aMaxHeightThe maximum height within which the font must fit. This overrides the height specified in aFontSpec.

GetPixelSizeInTwips(TSize &)

voidGetPixelSizeInTwips(TSize &aSize)const [private]

get pixel size in Twips * 1000

Parameters

TSize & aSize

InstallFile(const TDesC &, TInt &)

IMPORT_C TIntInstallFile(const TDesC &aName,
TInt &aId
)

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(). AddFile() RemoveFile() GetFontById() GetNearestFontToDesignHeightInTwips() GetNearestFontToDesignHeightInPixels() GetNearestFontToMaxHeightInTwips() GetNearestFontToMaxHeightInPixels()

Parameters

const TDesC & aNameThe name of the file to be installed.
TInt & aIdOn return, contains the id of the installed file.

IsFontLoaded(CFont *&, const TFontInfo &)

TBool IsFontLoaded(CFont *&aFont,
const TFontInfo &aFontInfo
)const [private]

CFontStore::IsFontLoaded CPdrTypefaceStore::IsFontLoaded

Parameters

CFont *& aFont
const TFontInfo & aFontInfo

NewL(CGraphicsDevice *)

IMPORT_C CFbsTypefaceStore *NewL(CGraphicsDevice *aDevice)[static]

Allocates and constructs a CFbsTypefaceStore, specifying a graphics device.

Parameters

CGraphicsDevice * aDeviceA pointer to a graphics device.

NumTypefaces()

IMPORT_C TIntNumTypefaces()const [virtual]

Gets the number of typefaces supported by this store. CTypefaceStore::NumTypefaces()

RegisterLinkedTypeface(const CLinkedTypefaceSpecification &, TInt &)

IMPORT_C TIntRegisterLinkedTypeface(const CLinkedTypefaceSpecification &aLinkedTypefaceSpec,
TInt &aId
)
Function to add a CLinkedTypefaceSpecification to the font and bitmap server typeface store.
capability
ECapabilityWriteDeviceData
CLinkedTypefaceSpecification

Parameters

const CLinkedTypefaceSpecification & aLinkedTypefaceSpecThe typeface specification to be added. Ownership is not transferred.
TInt & aIdA unique identifier

RegisterLinkedTypeface(const CLinkedTypefaceSpecification &)

IMPORT_C TIntRegisterLinkedTypeface(const CLinkedTypefaceSpecification &aLinkedTypefaceSpec)
Function to add a CLinkedTypefaceSpecification to the font and bitmap server typeface store.
capability
ECapabilityWriteDeviceData
CLinkedTypefaceSpecification

Parameters

const CLinkedTypefaceSpecification & aLinkedTypefaceSpec

ReleaseTwipsCache()

IMPORT_C voidReleaseTwipsCache()

Reset the twips cache.

The Typeface Store remembers font matches found through GetNearestFont...InTwips() family of functions in a cache for quicker matching. This function empties the cache, and should be called after the screen mode is changed as the Twips to pixels relationship may have changed.

RemoveFile(TInt)

IMPORT_C voidRemoveFile(TIntaId = 0)

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.

If the id given is 0, an attempt is made to remove all font objects from the font store provided none of the fonts in the store are currently accessed, otherwise it has no effect.

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.

AddFile() InstallFile()

Parameters

TInt aId = 0The id of the file to be removed/decremented, set by AddFile() or InstallFile().

RemoveFontFileLocksL()

IMPORT_C voidRemoveFontFileLocksL()[static]

Unload all fonts loaded from RAM or removable media

RemoveFontFileLocksL(const TDesC &, TBool)

IMPORT_C voidRemoveFontFileLocksL(const TDesC &aDrive,
TBoolaAllFonts
)[static]

Unload all fonts (of specified type) loaded from named drive

Parameters

const TDesC & aDrive
TBool aAllFonts

RemoveFontFileLocksL(const TDesC &)

IMPORT_C voidRemoveFontFileLocksL(const TDesC &aFileName)[static]

Unload the named font file

Parameters

const TDesC & aFileName

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

TInt SendGetNearestFontCommandNCreateFont(CFont *&aFont,
TIntaFbsMessage,
const TFontSpec &aFontSpec,
TIntaMaxHeight = 0
)[private]

Parameters

CFont *& aFont
TInt aFbsMessage
const TFontSpec & aFontSpec
TInt aMaxHeight = 0

SetDefaultBitmapType(TGlyphBitmapType)

IMPORT_C voidSetDefaultBitmapType(TGlyphBitmapTypeaType)const

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. TOpenFontSpec::SetBitmapType() TFontStyle::SetBitmapType()

Parameters

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

SetDefaultLanguageForMetrics(TLanguage)

IMPORT_C voidSetDefaultLanguageForMetrics(TLanguageaLanguage)const

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. TFontSpec::SetScriptTypeForMetrics

Parameters

TLanguage aLanguage

SetFontNameAliasL(const TDesC &, const TDesC &)

IMPORT_C voidSetFontNameAliasL(const TDesC &aFontAlias,
const TDesC &aFontName
)const

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

SetSystemDefaultTypefaceNameL(const TDesC &)

IMPORT_C voidSetSystemDefaultTypefaceNameL(const TDesC &aFontTypefaceName)

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.

capability
WriteDeviceData

Parameters

const TDesC & aFontTypefaceName

TypefaceSupport(TTypefaceSupport &, TInt)

IMPORT_C voidTypefaceSupport(TTypefaceSupport &aTypefaceSupport,
TIntaTypefaceIndex
)const [virtual]

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.

CTypefaceStore::TypefaceSupport()

Parameters

TTypefaceSupport & aTypefaceSupportOn return, if the function executed successfully, this object contains the typeface information.
TInt aTypefaceIndexA typeface index number, in the range: zero to (NumTypefaces() - 1).

UpdateLinkedTypeface(const CLinkedTypefaceSpecification &)

IMPORT_C TIntUpdateLinkedTypeface(const CLinkedTypefaceSpecification &aLinkedTypefaceSpec)

Function to update an existing linked typeface with a new specification. If successful a temporary file is generated and this will replace the linked font after a reboot. Calls to FetchLinkedTypefaceSpecificationL will return the currently loaded linked font spec and not the updated specification.

panic
EFbsPanicNoConnection There is no connection to FontBitmap Server

Parameters

const CLinkedTypefaceSpecification & aLinkedTypefaceSpecA new linked font specification to replace an existing file

Member Data Documentation

CGraphicsDevice * iDevice

CGraphicsDevice *iDevice[private]

RFbsSession * iFbs

RFbsSession *iFbs[private]

CFontCache * iTwipsCache

CFontCache *iTwipsCache[private]