Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: FNTSTORE.H
Link against: fntstr.lib

Class CBitmapFont

class CBitmapFont : public CFont;

Description

Bitmap font class. An object of this class may either access and use a bitmap font (a CFontBitmap) or an open font (a COpenFont). Stored in a CFontStore.

Derivation

Members

Defined in CBitmapFont:
BitmapEncoding(), CharacterMetrics(), CharacterNeedsToBeRasterized(), DoAscentInPixels(), DoBaselineOffsetInPixels(), DoCharWidthInPixels(), DoFontSpecInTwips(), DoHeightInPixels(), DoMaxCharWidthInPixels(), DoMaxNormalCharWidthInPixels(), DoTextCount(), DoTextCount(), DoTextWidthInPixels(), DoTypeUid(), FontWithCharacter(), GetCharacterData(), GetFaceAttrib(), GetFontMetrics(), GlyphBitmapType(), HasCharacterL(), IsOpenFont(), OpenFont(), Rasterize(), iAlgStyle, operator delete()

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

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


Member functions


CharacterMetrics()

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

Description

Gets a pointer to a bitmap and the metrics for a specified character, but only if a CFontBitmap is being used by the bitmap font object.

This function does not work when a COpenFont is being used, but GetCharacterData() can be used instead.

If the specified character does not exist in the font then the bitmap pointer and character metrics are gotten for a replacement character, KReplacementCharacter.

Parameters

TInt aCode

A character code.

const TUint8 *&aBytes

On return, a pointer to the bitmap for the specified character.

Return value

TCharacterMetrics

Metrics for the specified character.


GetCharacterData()

IMPORT_C TBool GetCharacterData(TInt aSessionHandle, TInt aCode, TOpenFontCharMetrics &aMetrics, const TUint8 *&aBitmap) const;

Description

Gets a pointer to a bitmap and the metrics for a specified character.

Note that this function calls CharacterMetrics() if a CFontBitmap is being used by the bitmap font object, and maps the TCharacterMetrics values returned by that function to aMetrics.

If the function fails to get the bitmap and metric values (because the character is in an open font and has not yet been rasterized) returns EFalse.

Parameters

TInt aSessionHandle

A session handle for the open font system.

TInt aCode

A character code.

TOpenFontCharMetrics &aMetrics

On return, metrics for the specified character.

const TUint8 *&aBitmap

On return, a pointer to the bitmap for the specified character.

Return value

TBool

ETrue if successful, otherwise EFalse.


Rasterize()

IMPORT_C TBool Rasterize(TInt aSessionHandle, TInt aCode, TOpenFontGlyphData *aGlyphData) const;

Description

Attempts to rasterize a character (aCode) into a data area (aGlyphData) in shared memory.

This works only for open fonts: where the bitmap font object is using a COpenFont.

Bitmap fonts are deemed to be fully rasterized after they have been loaded from file.

Returns ETrue if the character was successfully rasterized or was already in the cache. This function can be called only by the server; rasterization uses memory and other resources (e.g., file handles) owned by the server.

Parameters

TInt aSessionHandle

A session handle for the open font system.

TInt aCode

A character code.

TOpenFontGlyphData *aGlyphData

A data area in shared memory.

Return value

TBool

ETrue if the character was successfully rasterized or was already in the cache; otherwise EFalse.


GetFontMetrics()

IMPORT_C void GetFontMetrics(TOpenFontMetrics &aMetrics) const;

Description

Gets the open font metrics.

These metrics distinguish between maximum character height and depth and typographic ascent and descent, so that the clipping rectangle for text can be distinguished from the distance to neighbouring baselines.

Parameters

TOpenFontMetrics &aMetrics

Open font metrics.


GetFaceAttrib()

IMPORT_C TBool GetFaceAttrib(TOpenFontFaceAttrib &aAttrib) const;

Description

Gets the open font typeface attributes if possible.

At present no attempt is made to sythesize these attributes for bitmap fonts (CFontBitmaps).

Parameters

TOpenFontFaceAttrib &aAttrib

On return, the open font typeface attributes.

Return value

TBool

ETrue if successful; EFalse if not possible to get the open font typeface attributes.


BitmapEncoding()

IMPORT_C TInt BitmapEncoding() const;

Description

Gets encoding if a bitmap font (a CFontBitmap) is used.

Return value

TInt

Bitmap encoding value.


HasCharacterL()

IMPORT_C TBool HasCharacterL(TInt aCode) const;

Description

Gets whether the open or bitmap font has the specified character.

Parameters

TInt aCode

A character code.

Return value

TBool

ETrue if the font has the specified character; otherwise EFalse.


CharacterNeedsToBeRasterized()

IMPORT_C TBool CharacterNeedsToBeRasterized(TInt aSessionHandle, TInt aCode) const;

Description

Gets whether the specified character needs to be rasterised.

False is returned if it is a bitmap font (a CFontBitmap) being used by the bitmap font object (so no rasterization is required) or if is an open font (a COpenFont) and the character has been rasterized.

Parameters

TInt aSessionHandle

A session handle for the open font system.

TInt aCode

A character code.

Return value

TBool

ETrue if the character needs to be rasterized; otherwise EFalse.


operator delete()

IMPORT_C void operator delete(TAny *);

Description

Parameters

TAny *


IsOpenFont()

inline TBool IsOpenFont() const;

Description

Returns whether the bitmap font object is an open font (a COpenFont) rather than a bitmap font (a CFontBitmap).

Return value

TBool

ETrue if the bitmap font object is using an open font (a COpenFont); EFalse if it is using a bitmap font (a CFontBitmap).

See also:


OpenFont()

inline COpenFont *OpenFont() const;

Description

Returns a pointer to the open font being used by the bitmap font object.

Return value

COpenFont *

A pointer to an open font.

See also:


GlyphBitmapType()

inline TGlyphBitmapType GlyphBitmapType() const;

Description

Gets the anti-aliasing setting for the font, see TGlyphBitmapType for the range of values.

This is only applicable to open fonts (COpenFonts) not bitmap fonts (CBitmapFonts).

Note that this setting is stored in the device-independent font specification which is set when the bitmap font object is constructed.

Return value

TGlyphBitmapType

The anti-aliasing setting for the font.

See also:


FontWithCharacter()

IMPORT_C CBitmapFont *FontWithCharacter(TInt aCode, CLinkedFontInformation *&aInfo, TBool aSearchAllFonts, TBool aGetCanonicalDefault) const;

Description

Parameters

TInt aCode

CLinkedFontInformation *&aInfo

TBool aSearchAllFonts

TBool aGetCanonicalDefault

Return value

CBitmapFont *


DoTypeUid()

private: virtual IMPORT_C TUid DoTypeUid() const;

Description

Returns the font type identifier:KCBitmapFontUidVal.

Return value

TUid

The font type identifier.


DoHeightInPixels()

private: virtual IMPORT_C TInt DoHeightInPixels() const;

Description

Returns the font height in pixels. For an open font this will be the design height (notional rather than exact).

Return value

TInt

Font height in pixels.


DoAscentInPixels()

private: virtual IMPORT_C TInt DoAscentInPixels() const;

Description

Returns the font ascent in pixels.

The ascent is usually the height of a Latin capital letter above the baseline. For an open font, the returned value is likely to be inaccurate. Don't rely on it to get exact metrics at the pixel level.

Return value

TInt

Font ascent in pixels.


DoCharWidthInPixels()

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

Description

Returns the width, in pixels, of the given character.

If all characters have the same width (i.e. the font is mono - an attribute stored in iAlgStyle) then this is the maximum normal width, returned using MaxNormalCharWidthInPixels().

Parameters

TChar aChar

A character.

Return value

TInt

The character width in pixels.


DoTextWidthInPixels()

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

Description

Returns the width, in pixels, of the given text.

Parameters

const TDesC &aText

Text string.

Return value

TInt

Width of the text in pixels.


DoBaselineOffsetInPixels()

private: virtual IMPORT_C TInt DoBaselineOffsetInPixels() const;

Description

Returns the baseline offset in pixels, as stored in iAlgStyle.

Return value

TInt

The baseline offset in pixels.


DoTextCount()

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

Description

Returns the number of whole characters of aText, starting from the beginning, that fit into the given pixel width.

Parameters

const TDesC &aText

A text string.

TInt aWidthInPixels

A width in pixels.

Return value

TInt

The number of whole characters of aText that fit into aWidthInPixels.


DoTextCount()

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

Description

Returns the number of whole characters of aText, starting from the beginning, that fit into the given pixel width, and gets the excess width.

Parameters

const TDesC &aText

A text descriptor.

TInt aWidthInPixels

A width in pixels.

TInt &aExcessWidthInPixels

On return, the width left over of aWidthInPixels after the maximum possible whole number of characters of aText have been fit into it.

Return value

TInt

The number of whole characters of aText that fit into aWidthInPixels.


DoMaxCharWidthInPixels()

private: virtual IMPORT_C TInt DoMaxCharWidthInPixels() const;

Description

Returns the font's maximum character width in pixels.

Return value

TInt

The maximum character width in pixels.


DoMaxNormalCharWidthInPixels()

private: virtual IMPORT_C TInt DoMaxNormalCharWidthInPixels() const;

Description

Returns the font's normal maximum character width in pixels.

Note that when a CFontBitmap is used this value is the same as the maximum character width in pixels returned by MaxCharWidthInPixels(), but when a COpenFont is used the value may be different.

Return value

TInt

The normal maximum character width in pixels.


DoFontSpecInTwips()

private: virtual IMPORT_C TFontSpec DoFontSpecInTwips() const;

Description

Returns the device-independent font specification for the font.

Note that this is set when the bitmap font object is constructed.

Return value

TFontSpec

A font specification.

[Top]


Member data


iAlgStyle

TAlgStyle iAlgStyle;

Description

The algorithmic font style.