THuiFont Class Reference

class THuiFont

THuiFont is presents an abstract font implementation. It cannot be used on its own. Its main purpose is to act as a handle to a system font and provide metrics to the layout and drawing routines.

Different rendering plugins will implement their own version of this class to suit their own functionality.

Constructor & Destructor Documentation

THuiFont()

IMPORT_C THuiFont ( )

Default constructor. This instance should be initialised before use.

THuiFont(TInt, const TFontSpec &)

IMPORT_C THuiFont ( TInt aId,
const TFontSpec & aFontSpec
)

Constructor from a TFontSpec in twips. Since the metrics are mastered in pixels, the passed-in TFontSpec::Height() is converted to pixels using the default screen device's twips-to-pixel ratio.

Parameters

TInt aId A handle id set into the THuiFont by the Texture manager or skin
const TFontSpec & aFontSpec Symbian OS Font Specification to store

THuiFont(const THuiFont &)

IMPORT_C THuiFont ( const THuiFont & aFont )

Copy constructor.

Parameters

const THuiFont & aFont Font to be copied.

~THuiFont()

IMPORT_C ~THuiFont ( )

Member Functions Documentation

Category()

IMPORT_C TAknFontCategory Category ( ) const

Returns the font category.

FontSpec(MGraphicsDeviceMap *)

IMPORT_C TFontSpec FontSpec ( MGraphicsDeviceMap * aMap = NULL ) const

Returns the Symbian font specification. Always returned in Twips

Parameters

MGraphicsDeviceMap * aMap = NULL Graphics device map containing desired pixel to twips ratio to use

Id()

IMPORT_C TInt Id ( ) const

Determines the font's identifier.

LineExtentsL(const TDesC &)

IMPORT_C TSize LineExtentsL ( const TDesC & aTextString )

Retrieves the dimensions in pixels occupied by rasterization of the given string using this font.

Parameters

const TDesC & aTextString String that is used in calculation of rasterization dimensions.

MeasureBidiTextBoundsWidth(const CFont &, const TDesC &, CFont::TMeasureTextInput::TFlags)

TInt MeasureBidiTextBoundsWidth ( const CFont & aFont,
const TDesC & aText,
CFont::TMeasureTextInput::TFlags aOrder
) const [private]

This is backporting AknBidiTextUtils::MeasureTextBoundsWidth from S60 3.1 to have that functionality also when running hitchcock on S60 3.0 platform

Measures the full horizontal width in pixels of the passed-in text using a particular font, including in the width any side-bearings of the glyphs at the ends of the text, and any declared "advance" of the run of glyphs.

It cannot be used for vertical text measurement.

Side-bearings are parts of glyphs that extend left or right from the normal width or "advance" of the glyph. A left side-bearing, for instance, will overlap with a glyph to its left. Another way of thinking about this is that the origin (0,0) of the glyph is not at its bottom left.

The advance of a run of glyphs is the sum of the advances - once in visual ordering and shaping has been performed - of all the glyphs. It is defined relative to a drawing origin.

Within runs of text, side-bearings do not contribute to the width of the text. However, at the (visual) ends of text, they are likely to need to be counted, depending upon the exact use case.

This method returns the width of the horizontal envelope of the text by taking the extreme horizontal extents of the text bounds rectangle (which includes side-bearings on either end) and the extent of the advance. Thus it returns the width of : Min(<left_text_bound>, 0), Max( <right_text_bound>, <advance>)

This method should be used when the proposed text is going to be drawn using any horizontal CGraphicsContext::DrawText drawing API.

The text can be in visual or logical order.

Since
3.1

Parameters

const CFont & aFont Font to use
const TDesC & aText Text to be measured
CFont::TMeasureTextInput::TFlags aOrder Whether the text provided is in visual or logical order

NearestFontL(TReal32)

IMPORT_C CFont * NearestFontL ( TReal32 aTextMeshYScale = 1 )

Returns the nearest CFont object representation of this THuiFont object. Creates the CFont object according to specifications in this THuiFont unless one is already created. If CFont object is already created then the already created instance is returned. Releasing of CFont - object is handled by this class.

Todo: tell more...

Parameters

TReal32 aTextMeshYScale = 1 Height scale factor from LCD resolution to TV resolution.

RasterizeLineL(const TDesC &, CFbsBitGc &)

IMPORT_C void RasterizeLineL ( const TDesC & aTextString,
CFbsBitGc & aTargetContext
)

Rasterizes the given text string to the target graphics context using this font. The caller has to configure the graphics context with parameters to be used in rasterization before calling this method.

Parameters

const TDesC & aTextString The text string to be rasterized.
CFbsBitGc & aTargetContext The target graphics context to be used in rasterization.

ReleaseFont()

IMPORT_C void ReleaseFont ( )

Release the Symbian font representation.

SetCategory(const TAknFontCategory)

IMPORT_C void SetCategory ( const TAknFontCategory aCategory )

Sets the category.

Parameters

const TAknFontCategory aCategory

SetFontSpec(const TFontSpec &)

IMPORT_C void SetFontSpec ( const TFontSpec & aFontSpec )

Sets the font specification.

Parameters

const TFontSpec & aFontSpec

SetTextPaneHeight(TInt)

IMPORT_C void SetTextPaneHeight ( TInt aTextPaneHeight )

Required vertical extend of the font. This value is always specified in pixels. The text will fit within a rectangle of this height

Parameters

TInt aTextPaneHeight text pane height in pixels into which the text is to fit completely

TextPaneHeight()

IMPORT_C TInt TextPaneHeight ( ) const

Required vertical extend of the font. This value is always returned in pixels. The text will fit within a rectangle of this height

operator=(const THuiFont &)

IMPORT_C THuiFont & operator= ( const THuiFont & aFont )

Assignment operator.

Parameters

const THuiFont & aFont Font to be copied.

Member Data Documentation

TAknFontCategory iCategory

TAknFontCategory iCategory [private]

TFontRef * iFont

TFontRef * iFont [private]

Nearest Font object.

TFontSpec iFontSpec

TFontSpec iFontSpec [private]

Symbian Font specification.

TInt iId

TInt iId [private]

Identifier number. Assigned by the texture manager.

TInt iSpare1

TInt iSpare1 [private]

TInt iSpare2

TInt iSpare2 [private]

TInt iTextPaneHeight

TInt iTextPaneHeight [private]

This is the vertical space in which the font will fit. This measure is alwasy in pixels. It may be necessary to use this request the font, rather than via the Fontspec