Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: fbs.h
Link against: fbscli.lib

Class CFbsFont

CFbsFont

Support

Supported from 5.0

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 is derived from the abstract base class CFont, and implements a number of functions defined in it.

Derivation

CBaseBase class for all classes to be instantiated on the heap
CFbsFontFont managed by the font and bitmap server
CFontAbstract font interface

Defined in CFbsFont:
AscentInPixels(), BaselineOffsetInPixels(), CharWidthInPixels(), CharacterMetrics(), CodeSection(), FontSpecInTwips(), GetCharacterData(), GetFaceAttrib(), GetFontMetrics(), Handle(), HasCharacter(), HeightInPixels(), IsOpenFont(), MaxCharWidthInPixels(), MaxNormalCharWidthInPixels(), NumCodeSections(), RawTextWidthInPixels(), TextCount(), TextWidthInPixels(), TypeUid()

Inherited from CBase:
operator new()

Inherited from CFont:
DescentInPixels(), EAllCharacterData, ECharacterWidthOnly, EHorizontal, ENoCharacterData, EVertical, GetCharacterPosition(), MeasureText(), TCharacterDataAvailability, TMeasureTextInput, TMeasureTextOutput, TPositionParam, TTextDirection, WidthZeroInPixels()

See also:


Miscellaneous information


Handle()

TInt Handle() const;

Description

Gets the Font and Bitmap server handle of the font.

Return value

TInt

The handle of the font.


CharacterMetrics()

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.


GetCharacterData()

TBool GetCharacterData(TInt aCode,TOpenFontCharMetrics& aMetrics,const TUint8*& aBytes) const;

Support

Withdrawn in 6.0

Description

Gets the character metrics and the glyph bitmap.

This function works for both bitmap fonts and those handled by the Open Font System. It is better than CharacterMetrics() because TOpenFontCharMetrics can handle 16-bit metrics, and contains more information.

Parameters

TInt aCode

The character code (in code page 1252 for ER5, otherwise in Unicode).

TOpenFontCharMetrics& aMetrics

On return, contains the character metrics.

const TUint8*& aBytes

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

Return value

TBool

True if successful. False if metrics cannot be obtained.


GetCharacterData()

CFont::TCharacterDataAvailability GetCharacterData(
    TUint aCode, TOpenFontCharMetrics& aMetrics,
    const TUint8*& aBitmap, TSize& aBitmapSize) const;

Support

Supported from 6.0

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

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


GetFaceAttrib()

TBool GetFaceAttrib(TOpenFontFaceAttrib& aAttrib) const;

Description

Gets the typeface attributes of Open Font System fonts.

Notes:

Parameters

TOpenFontFaceAttrib& aAttrib

On return, contains the typeface attributes.

Return value

TBool

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


IsOpenFont()

TBool IsOpenFont() const;

Description

Test whether the font is an Open Font system font.

Note:

Return value

TBool

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


HasCharacter()

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 ER5, otherwise it is in Unicode

Return value

TBool

ETrue if the font contains aCode.

[Top]


Getting general font and typeface information


TypeUid()

TUid TypeUid() 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:


FontSpecInTwips()

TFontSpec FontSpecInTwips() const;

Description

Gets the font specification of this font in twips.

Return value

TFontSpec

The font specification of this font (in twips).

See also:

[Top]


Getting font height information


HeightInPixels()

TInt HeightInPixels() const;

Description

Gets the height of the font, in pixels.

Return value

TInt

The height of the font, in pixels.

See also:


AscentInPixels()

TInt AscentInPixels() const;

Description

Gets the ascent of the font, in pixels.

Return value

TInt

The ascent of the font, in pixels.

See also:


BaselineOffsetInPixels()

TInt BaselineOffsetInPixels() 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:

[Top]


Getting font width information


RawTextWidthInPixels()

TInt RawTextWidthInPixels(const TDesC& aText) const;

Description

Gets the raw width of the text in the descriptor, in pixels.

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.


CharWidthInPixels()

TInt CharWidthInPixels(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:


MaxCharWidthInPixels()

TInt MaxCharWidthInPixels() 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:


MaxNormalCharWidthInPixels()

TInt MaxNormalCharWidthInPixels() 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:

[Top]


Getting and testing width of descriptors


TextWidthInPixels()

TInt TextWidthInPixels(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:


TextWidthInPixels()

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


TextCount()

TInt TextCount(const TDesC& aText,TInt aWidthInPixels) const;

Description

Gets how much of the specified descriptor, when displayed in this font, will be able to be displayed without exceeding the specified width.

Note:

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:


TextCount()

TInt TextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const;

Description

Gets how much of the specified descriptor, when displayed in this font, will be able to be displayed 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:

[Top]


Code section information


CodeSection()

virtual TCodeSection CodeSection(TInt aIndex) const;

Support

Withdrawn in 6.0

Description

Deprecated. This is not used anywhere in version 6.0.

Gets the code section at the specified index. A code section defines the bitmaps for characters in a specified range.

Parameters

TInt aIndex

The index of the code section required.

Return value

TCodeSection

The code section at the specified index.


NumCodeSections()

virtual TInt NumCodeSections() const;

Support

Withdrawn in 6.0

Description

Gets the number of code sections in the font.

A code section defines the bitmaps for characters in a specified range.

Return value

TInt

The number of code sections in the font.