Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <FBS.H>
Link against: fbscli.lib

Class CFbsFont

class CFbsFont : public CFont;

Description

Font managed by the font and bitmap server. CFbsFont objects are used for screen and off-screen bitmap fonts. They are usually obtained by calls to the CBitmapDevice::GetNearestFontInPixels(CFont *&,const TFontSpec &) and MGraphicsDeviceMap::GetNearestFontInTwips(CFont *&,const TFontSpec &) functions. The class implements a number of functions inherited from CFont.

Derivation

Members

Defined in CFbsFont:

Inherited from CBase:

Inherited from CFont:

See also:


Construction and destruction


CFbsFont()

protected: IMPORT_C CFbsFont();

Description


~CFbsFont()

protected: IMPORT_C ~CFbsFont();

Description


CFbsFont(const CFbsFont &)

protected: IMPORT_C CFbsFont(const CFbsFont &aFont);

Description

Parameters

const CFbsFont &aFont

[Top]


Member functions


DoTypeUid()const

private: inline virtual TUid DoTypeUid() const;

Description

Gets the font's UID. All CFbsFont objects have the constant UID KCFbsFontUid. It is safe to cast from CFont* to CFbsFont* if CFont::TypeUid()const returns KCFbsFontUid.

Return value

TUid

The font's UID. This should be KCFbsFontUid.

See also:


DoHeightInPixels()const

private: IMPORT_C virtual TInt DoHeightInPixels() const;

Description

Gets the font height in pixels.

Return value

TInt

The font height in pixels.

See also:


DoAscentInPixels()const

private: IMPORT_C virtual TInt DoAscentInPixels() const;

Description

Gets the font ascent in pixels.

Return value

TInt

The font ascent in pixels.

See also:


DoCharWidthInPixels(TChar)const

private: IMPORT_C virtual TInt DoCharWidthInPixels(TChar aChar) const;

Description

Gets the width of the specified character in this font, in pixels.

Parameters

TChar aChar

The character whose width should be determined.

Return value

TInt

The width of the specified character in this font, in pixels.

See also:


DoTextWidthInPixels(const TDesC &)const

private: IMPORT_C virtual TInt DoTextWidthInPixels(const TDesC &aText) const;

Description

Gets the width of the specified descriptor when displayed in this font, in pixels.

Parameters

const TDesC16 &aText

The descriptor whose width should be determined.

Return value

TInt

The width of the specified descriptor when displayed in this font, in pixels

See also:


DoBaselineOffsetInPixels()const

private: IMPORT_C virtual TInt DoBaselineOffsetInPixels() const;

Description

Gets the baseline offset, in pixels. The offset is how far a font is raised or lowered from its normal baseline.

Return value

TInt

Offset from normal baseline, in pixels.

See also:


DoTextCount(const TDesC &,TInt)const

private: IMPORT_C virtual TInt DoTextCount(const TDesC &aText, TInt aWidthInPixels) const;

Description

Gets how much of the specified descriptor can be displayed in this font without exceeding the specified width.

Note: This function does not display any of the descriptor itself. It is used before display, to test whether the whole descriptor can be displayed.

Parameters

const TDesC16 &aText

The descriptor.

TInt aWidthInPixels

The available width for character display

Return value

TInt

The number of characters (starting from the beginning of the descriptor) which will be able to be displayed without exceeding the specified width.

See also:


DoTextCount(const TDesC &,TInt,TInt &)const

private: IMPORT_C virtual TInt DoTextCount(const TDesC &aText, TInt aWidthInPixels, TInt &aExcessWidthInPixels) const;

Description

Gets how much of the specified descriptor can be displayed in this font without exceeding the specified width. It also returns the excess width defined as the specified available width minus the width of the portion of the descriptor which can be displayed without exceeding the available width.

Parameters

const TDesC16 &aText

The descriptor.

TInt aWidthInPixels

The available width for character display.

TInt &aExcessWidthInPixels

The excess width after displaying the portion of the descriptor, in pixels.

Return value

TInt

The number of characters (starting from the beginning of the descriptor) which will be able to be displayed without exceeding the specified width.

See also:


DoMaxCharWidthInPixels()const

private: IMPORT_C virtual TInt DoMaxCharWidthInPixels() const;

Description

Gets the width of the widest character in this font, in pixels.

Return value

TInt

The width of the maximum width character, in pixels.

See also:


DoMaxNormalCharWidthInPixels()const

private: IMPORT_C virtual TInt DoMaxNormalCharWidthInPixels() const;

Description

Gets the width of the widest normal character in this font, in pixels. Normal characters include all character in a character set except non-alphabetic characters (e.g. the copyright symbol, or a block graphics symbol, for example).

Return value

TInt

The width of the maximum width normal character, in pixels.

See also:


DoFontSpecInTwips()const

private: IMPORT_C virtual TFontSpec DoFontSpecInTwips() const;

Description

Gets the font specification of this font in twips.

Return value

TFontSpec

The font specification of this font (in twips).

See also:


DoGetCharacterData(TUint,TOpenFontCharMetrics &,const TUint8 *&,TSize &)const

private: IMPORT_C virtual CFont::TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics &aMetrics, const TUint8 *&aBitmap, TSize &aBitmapSize) const;

Description

Gets the character metrics and the glyph bitmap.

Parameters

TUint aCode

The character code in Unicode.

TOpenFontCharMetrics &aMetrics

On return, contains the character metrics.

const TUint8 *&aBitmap

On return, contains a pointer to the compressed glyph bitmap.

TSize &aBitmapSize

The size of the returned glyph bitmap in pixels. This is not necessarily the same as the size implied by the returned metrics, which may incorporate algorithmic multiplication.

Return value

CFont::TCharacterDataAvailability


GetFontMetrics(TOpenFontMetrics &)const

IMPORT_C TBool GetFontMetrics(TOpenFontMetrics &aMetrics) const;

Description

Gets the open font metrics. If the metrics cannot be obtained the function returns EFalse.

Parameters

TOpenFontMetrics &aMetrics

On return, contains the font metrics

Return value

TBool

EFalse if the metrics cannot be obtained


TextWidthInPixels(const TDesC &)const

IMPORT_C TInt TextWidthInPixels(const TDesC &aText) const;

Description

Gets the width of the specified descriptor when displayed in this font, in pixels. Override of the base class to resolve name clash with other TextWidthInPixels variant.

Parameters

const TDesC16 &aText

The descriptor whose width should be determined.

Return value

TInt

The width of the specified descriptor when displayed in this font, in pixels

See also:


TextWidthInPixels(const TDesC &,SCharWidth &)const

IMPORT_C void TextWidthInPixels(const TDesC &aText, SCharWidth &aCharWidth) const;

Description

Gets the text width, move and adjusts of the specified descriptor when displayed in this font.

Parameters

const TDesC16 &aText

The descriptor whose width should be determined.

SCharWidth &aCharWidth

The width of the specified descriptor when displayed in this font, in pixels (including information on the width, move and adjusts of the descriptor).


Handle()const

IMPORT_C TInt Handle() const;

Description

Gets the Font and Bitmap server handle of the font.

Return value

TInt

The handle of the font.


RawTextWidthInPixels(const TDesC &)const

Interface status: deprecated

IMPORT_C TInt RawTextWidthInPixels(const TDesC &aText) const;

Description

Gets the raw width of the text in the descriptor, in pixels. DEPRECATED: Same as MeasureText(const TDesC&). This is the width of the text without adjusting for side bearings, algorithmic style etc.

Parameters

const TDesC16 &aText

Any text descriptor (TPtrC, TPtr, _LIT, TBuf etc.).

Return value

TInt

The width (in pixels) of the text in the descriptor.


GetFaceAttrib(TOpenFontFaceAttrib &)const

IMPORT_C TBool GetFaceAttrib(TOpenFontFaceAttrib &aAttrib) const;

Description

Gets the typeface attributes of Open Font System fonts. Notes: Typeface attributes are different from the font metrics; they are not metrics, which are different for every different size, but size-independent attributes of the typeface, like name and style. This function can be used if CFbsFont::IsOpenFont()const returns true i.e. the font is an Open Font.

Parameters

TOpenFontFaceAttrib &aAttrib

On return, contains the typeface attributes.

Return value

TBool

EFalse if the attributes cannot be obtained, or if the font is not an Open Font (CFbsFont::IsOpenFont()const returns EFalse).


IsOpenFont()const

IMPORT_C TBool IsOpenFont() const;

Description

Tests whether the font is an Open Font system font. Note: If this function returns ETrue, the function CFbsFont::GetFaceAttrib(TOpenFontFaceAttrib &)const will work.

Return value

TBool

ETrue if font is an Open Font system font (e.g. TrueType). EFalse if the font is a bitmap font loaded from a GDR file.


HasCharacter(TInt)const

IMPORT_C TBool HasCharacter(TInt aCode) const;

Description

Tests whether the font contains a particular character.

Parameters

TInt aCode

Character code to be tested. This code is in the code page 1252 encoding in v5, otherwise it is in Unicode

Return value

TBool

ETrue if the font contains aCode.


Address()const

protected: IMPORT_C CBitmapFont* Address() const;

Description

Return value

CBitmapFont *


Duplicate(TInt)

protected: IMPORT_C TInt Duplicate(TInt aHandle);

Description

Duplicates a font. This function does not create a copy of the font. It just assigns another handle to the bitmap in the font and bitmap server, and sets this object's handle to that.

Parameters

TInt aHandle

The handle to an existing CFbsFont.

Return value

TInt

KErrNone if successful; KErrCouldNotConnect if no connection to the font and bitmap server could be made; KErrUnknown if no font could be found with the specified handle number.


Reset()

protected: IMPORT_C void Reset();

Description

[Top]


Member data


iFbs

protected: RFbsSession * iFbs;

Description


iAddressPointer

protected: CBitmapFont * iAddressPointer;

Description


iHandle

protected: TInt iHandle;

Description


iServerHandle

protected: TInt iServerHandle;

Description