Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: 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() and MGraphicsDeviceMap::GetNearestFontInTwips() functions. The class implements a number of functions inherited from CFont.

Derivation

Members

Defined in CFbsFont:
Address(), CFbsFont(), CFbsFont(), CharacterMetrics(), DoAscentInPixels(), DoBaselineOffsetInPixels(), DoCharWidthInPixels(), DoFontSpecInTwips(), DoGetCharacterData(), DoHeightInPixels(), DoMaxCharWidthInPixels(), DoMaxNormalCharWidthInPixels(), DoTextCount(), DoTextCount(), DoTextWidthInPixels(), DoTypeUid(), Duplicate(), GetFaceAttrib(), GetFontMetrics(), Handle(), HasCharacter(), IsOpenFont(), RawTextWidthInPixels(), Reset(), TextWidthInPixels(), TextWidthInPixels(), iAddressPointer, iFbs, iHandle, iServerHandle, ~CFbsFont()

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

Inherited from CFont:
AscentInPixels(), BaselineOffsetInPixels(), CharWidthInPixels(), CharactersJoin(), DescentInPixels(), DoDescentInPixels(), EAllCharacterData, ECharacterWidthOnly, EHorizontal, ENoCharacterData, EVertical, ExtendedFunction(), FontCapitalAscent(), FontLineGap(), FontMaxAscent(), FontMaxDescent(), FontMaxHeight(), FontSpecInTwips(), FontStandardDescent(), GetCharacterData(), GetCharacterPosition2(), HeightInPixels(), MaxCharWidthInPixels(), MaxNormalCharWidthInPixels(), MeasureText(), TCharacterDataAvailability, TMeasureTextInput, TMeasureTextOutput, TPositionParam, TTextDirection, TextCount(), TypeUid(), WidthZeroInPixels()

See also:


Construction and destruction


CFbsFont()

protected: IMPORT_C CFbsFont();

Description


~CFbsFont()

protected: IMPORT_C ~CFbsFont();

Description


CFbsFont()

protected: IMPORT_C CFbsFont(const CFbsFont &aFont);

Description

Parameters

const CFbsFont &aFont

[Top]


Member functions


DoTypeUid()

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() returns KCFbsFontUid.

Return value

TUid

The font's UID. This should be KCFbsFontUid.

See also:


DoHeightInPixels()

private: virtual IMPORT_C TInt DoHeightInPixels() const;

Description

Gets the font height in pixels.

Return value

TInt

The font height in pixels.

See also:


DoAscentInPixels()

private: virtual IMPORT_C TInt DoAscentInPixels() const;

Description

Gets the font ascent in pixels.

Return value

TInt

The font ascent in pixels.

See also:


DoCharWidthInPixels()

private: virtual IMPORT_C 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()

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

Description

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

Parameters

const TDesC &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()

private: virtual IMPORT_C 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()

private: virtual IMPORT_C 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 TDesC &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()

private: virtual IMPORT_C 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 TDesC &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()

private: virtual IMPORT_C 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()

private: virtual IMPORT_C 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()

private: virtual IMPORT_C 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()

private: virtual IMPORT_C 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()

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

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 TDesC &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()

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 TDesC &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()

IMPORT_C TInt Handle() const;

Description

Gets the Font and Bitmap server handle of the font.

Return value

TInt

The handle of the font.


CharacterMetrics()

IMPORT_C TCharacterMetrics CharacterMetrics(TInt aCode, const TUint8 *&aBytes) const;

Description

Gets the character metrics and a pointer to the compressed glyph bitmap for the specified character. This function is deprecated, because TCharacterMetrics cannot store metrics larger than 127 or less than 127 use GetCharacterData() instead.

Parameters

TInt aCode

The code for the character to be checked.

const TUint8 *&aBytes

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

Return value

TCharacterMetrics

The character metrics for the font.


RawTextWidthInPixels()

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 TDesC &aText

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

Return value

TInt

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


GetFaceAttrib()

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 IsOpenFont() 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 (IsOpenFont() returns EFalse).


IsOpenFont()

IMPORT_C TBool IsOpenFont() const;

Description

Tests whether the font is an Open Font system font. Note: If this function returns ETrue, the function GetFaceAttrib() 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()

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

protected: IMPORT_C CBitmapFont *Address() const;

Description

Return value

CBitmapFont *


Duplicate()

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