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.

Public Member Functions
THuiFont()
THuiFont(TInt, const TFontSpec &)
THuiFont(const THuiFont &)
~THuiFont()
IMPORT_C TAknFontCategoryCategory()
IMPORT_C TFontSpecFontSpec(MGraphicsDeviceMap *)
IMPORT_C TIntId()
IMPORT_C TSizeLineExtentsL(const TDesC &)
IMPORT_C CFont *NearestFontL(TReal32)
IMPORT_C voidRasterizeLineL(const TDesC &, CFbsBitGc &)
IMPORT_C voidReleaseFont()
IMPORT_C voidSetCategory(const TAknFontCategory)
IMPORT_C voidSetFontSpec(const TFontSpec &)
IMPORT_C voidSetTextPaneHeight(TInt)
IMPORT_C TIntTextPaneHeight()
IMPORT_C THuiFont &operator=(const THuiFont &)
Private Member Functions
TInt MeasureBidiTextBoundsWidth(const CFont &, const TDesC &, CFont::TMeasureTextInput::TFlags)
Private Attributes
TAknFontCategory iCategory
TFontRef *iFont
TFontSpec iFontSpec
TInt iId
TInt iSpare1
TInt iSpare2
TInt iTextPaneHeight

Constructor & Destructor Documentation

THuiFont()

IMPORT_CTHuiFont()

Default constructor. This instance should be initialised before use.

THuiFont(TInt, const TFontSpec &)

IMPORT_CTHuiFont(TIntaId,
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 aIdA handle id set into the THuiFont by the Texture manager or skin
const TFontSpec & aFontSpecSymbian OS Font Specification to store

THuiFont(const THuiFont &)

IMPORT_CTHuiFont(const THuiFont &aFont)

Copy constructor.

Parameters

const THuiFont & aFontFont to be copied.

~THuiFont()

IMPORT_C~THuiFont()

Member Functions Documentation

Category()

IMPORT_C TAknFontCategoryCategory()const

Returns the font category.

FontSpec(MGraphicsDeviceMap *)

IMPORT_C TFontSpecFontSpec(MGraphicsDeviceMap *aMap = NULL)const

Returns the Symbian font specification. Always returned in Twips

Parameters

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

Id()

IMPORT_C TIntId()const

Determines the font's identifier.

LineExtentsL(const TDesC &)

IMPORT_C TSizeLineExtentsL(const TDesC &aTextString)

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

Parameters

const TDesC & aTextStringString 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::TFlagsaOrder
)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 & aFontFont to use
const TDesC & aTextText to be measured
CFont::TMeasureTextInput::TFlags aOrderWhether the text provided is in visual or logical order

NearestFontL(TReal32)

IMPORT_C CFont *NearestFontL(TReal32aTextMeshYScale = 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 = 1Height scale factor from LCD resolution to TV resolution.

RasterizeLineL(const TDesC &, CFbsBitGc &)

IMPORT_C voidRasterizeLineL(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 & aTextStringThe text string to be rasterized.
CFbsBitGc & aTargetContextThe target graphics context to be used in rasterization.

ReleaseFont()

IMPORT_C voidReleaseFont()

Release the Symbian font representation.

SetCategory(const TAknFontCategory)

IMPORT_C voidSetCategory(const TAknFontCategoryaCategory)

Sets the category.

Parameters

const TAknFontCategory aCategory

SetFontSpec(const TFontSpec &)

IMPORT_C voidSetFontSpec(const TFontSpec &aFontSpec)

Sets the font specification.

Parameters

const TFontSpec & aFontSpec

SetTextPaneHeight(TInt)

IMPORT_C voidSetTextPaneHeight(TIntaTextPaneHeight)

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 aTextPaneHeighttext pane height in pixels into which the text is to fit completely

TextPaneHeight()

IMPORT_C TIntTextPaneHeight()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 & aFontFont 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