THuiTextStyle Class Reference

class THuiTextStyle

THuiTextStyle presents an abstract text style implementation. Its main purpose is to act as an encapsulation of a particular text style.

Derived platform dependant classes will implement their own version of this class

Constructor & Destructor Documentation

THuiTextStyle(const THuiTextStyle &)

IMPORT_C THuiTextStyle ( const THuiTextStyle & aTextStyle )

Copy constructor.

Parameters

const THuiTextStyle & aTextStyle

THuiTextStyle(TInt, TInt)

THuiTextStyle ( TInt aFontStyleId = 0,
TInt aParentId = -1
)

Constructs a text style that uses font according to font ID provided by font manager. Uses a default text style when parameters are not set.

Parameters

TInt aFontStyleId = 0 Font ID provided by font manager. If not set the default font is used.
TInt aParentId = -1 The parent text style. Root style is created if the ID is not set.

Member Functions Documentation

BackgroundColor()

IMPORT_C TRgb BackgroundColor ( ) const

DisableClipping()

void DisableClipping ( )

EnableClipping(TRect)

void EnableClipping ( TRect aClipRect )

Parameters

TRect aClipRect

Font()

IMPORT_C THuiFont & Font ( )

Returns THuiFont associated with this logical text style.

Font()

IMPORT_C const THuiFont & Font ( ) const

Returns THuiFont associated with this logical text style.

FontStyleId()

IMPORT_C TInt FontStyleId ( ) const

Retrieves font style id.

GetTypeface(TTypeface &)

IMPORT_C void GetTypeface ( TTypeface & aTypeface ) const

Get the typeface that would be used for this text style

Parameters

TTypeface & aTypeface Returned typeface structure

Id()

IMPORT_C TInt Id ( ) const

A unique toolkit specific ID assigned by the text style manager. The text style can be accessed anytime through the CHuiTextStyleManager::TextStyle - method based on this unique ID. The default text style has always ID 0.

CHuiTextStyleManager::CreatePlatformTextStyleL

LineExtentsL(const TDesC &)

TSize LineExtentsL ( const TDesC & aTextLine )

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

Parameters

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

LocalDefinitionFlags()

TInt LocalDefinitionFlags ( ) const

Retrieves the flags that describe which text style attributes are set/defined locally in this particular text style, and which come from the parent. Each flag can be used to set/reset a bit in definitions flags member variable. If a flag, KTextColorDefined for example, is set, it means that the respective text style attribute is defined locally. If the flag is not set, the respective attribute value will be looked from the parent.

KTextColorDefined as an example.

ParentId()

IMPORT_C TInt ParentId ( ) const

Retrieves a toolkit specific ID of the parent text style. The text styles are cascaded. The parent of a text style is EHuiTextStyleNormal by default.

CHuiTextStyleManager::CreatePlatformTextStyleL

Posture()

IMPORT_C TBool Posture ( )

Retrieves text style text posture attribute.

RasterizeLineL(const TDesC &, CHuiTexture &)

void RasterizeLineL ( const TDesC & aTextLine,
CHuiTexture & aTargetTexture
)

Rasterizes a single line of text using this style. Rasterization is done to the texture given as a parameter. Caller has to assure that the the texture is of correct dimentions and pixel format.

TodoText shadow should be a property of the text style (or even a separate brush, maybe?) and not configured in text mesh.

Parameters

const TDesC & aTextLine The line of text to rasterize.
CHuiTexture & aTargetTexture Reference to a texture that the text is going to be rasterized to.

SetBackgroundColor(const TRgb &)

IMPORT_C void SetBackgroundColor ( const TRgb & aBackgroundColor )

Parameters

const TRgb & aBackgroundColor

SetFont(THuiFont)

IMPORT_C void SetFont ( THuiFont aFont ) [virtual]

Sets a THuiFont object associated with this logical text style.

Parameters

THuiFont aFont A HuiFont that willl be used in this text style.

SetId(TInt)

void SetId ( TInt aId )

Text style manager is setting this ID when a new text style is created. CHuiTextStyleManager::CreatePlatformTextStyleL

Parameters

TInt aId A Unique toolkit specific ID for this text style. This text style can be accessed anytime through the CHuiTextStyleManager::TextStyle - method using this ID.

SetLocalDefinitionFlags(TInt)

void SetLocalDefinitionFlags ( TInt aLocalDefinitionFlags )

Sets the flags that describe which text style attributes are set/defined locally in this particular text style, and which come from the parent. SetId

Parameters

TInt aLocalDefinitionFlags Will set all the text style attribute flags.

SetParentId(TInt)

IMPORT_C void SetParentId ( TInt aParentId )

Sets a toolkit specific ID of the parent text style. The text styles are cascaded. Setting a parent ID will cause the text style to get all the text style attributes that are not locally defined from the parent.

Parameters

TInt aParentId A toolkit specific ID of the parent text style.

SetPosture(TBool)

IMPORT_C void SetPosture ( TBool aIsItalic )

Sets the text style text posture attribute.

Parameters

TBool aIsItalic The new text style text posture. If ETrue, the text is italic, otherwise upright.

SetStrikeThrough(TBool)

IMPORT_C void SetStrikeThrough ( TBool aIsStrikeThrough )

Sets the text style text strike through attribute.

Parameters

TBool aIsStrikeThrough The new text style text strike through attribute. If ETrue, the text is strike through, otherwise normal.

SetStrokeWeight(TBool)

IMPORT_C void SetStrokeWeight ( TBool aIsBold )

Sets the text style text stroke weight attribute.

Parameters

TBool aIsBold The new text style text stroke weight. If ETrue, the text is bold, otherwise normal.

SetTextColor(const TRgb &)

IMPORT_C void SetTextColor ( const TRgb & aTextColour )

Sets the text style text color attribute.

Parameters

const TRgb & aTextColour A new text color of the text style.

SetTextPaneHeightInPixels(TInt, TBool)

IMPORT_C void SetTextPaneHeightInPixels ( TInt aTextPaneHeight,
TBool aIsDecoratedSize = EFalse
)

Sets the text style text pane height in pixels.

Note:

This means that the text size (i.e. the return value from calling TextSizeInPixels ) will be in general smaller than the text pane height, as the text pane is intended to match the font's maximum extent.

In order to convert a height from a metric value into pixels, use CHuiVisual::LocalToDisplay .

Parameters

TInt aTextPaneHeight The new text style text pane height in pixels.
TBool aIsDecoratedSize = EFalse If true, the decoration size is subtracted from the text pane height to ensure that the rasterized text will fit into the reserved area including the decoration. The decoration here means various effects that can be added to the text, for example a shadow.

SetTextSizeInPixels(TInt, TBool)

IMPORT_C void SetTextSizeInPixels ( TInt aTextSizeInPix,
TBool aIsDecoratedSize = EFalse
)

Sets the text style text size attribute in pixels.

Parameters

TInt aTextSizeInPix The new text style text size in pixels.
TBool aIsDecoratedSize = EFalse If true, the decoration size is subtracted from the text size to ensure that the rasterized text will fit into the reserved area including the decoration. The decoration here means various effects that can be added to the text, for example a shadow .

SetTextSizeInTwips(TInt, TBool)

IMPORT_C void SetTextSizeInTwips ( TInt aTextSizeInTwips,
TBool aIsDecoratedSize = EFalse
)

Sets the text style text size attribute in twips.

Parameters

TInt aTextSizeInTwips The new text style text size in twips.
TBool aIsDecoratedSize = EFalse If true, the decoration size is subtracted from the text size to ensure that the rasterized text will fit into the reserved area including the decoration. The decoration here means various effects that can be added to the text, for example a shadow .

SetUnderline(TBool)

IMPORT_C void SetUnderline ( TBool aIsUnderline )

Sets the text style text underline attribute.

Parameters

TBool aIsUnderline The new text style text underline attribute. If ETrue, the text is underlined, otherwise normal.

StrikeThrough()

IMPORT_C TBool StrikeThrough ( ) const

Retrieves text style text strike through attribute.

StrokeWeight()

IMPORT_C TBool StrokeWeight ( )

Retrieves text style text stroke weight attribute.

TextColor()

IMPORT_C TRgb TextColor ( ) const

Retrieves the text style text color attribute.

TextSizeInPixels(TBool)

IMPORT_C TInt TextSizeInPixels ( TBool aIsDecoratedSize = EFalse )

Retrieves text style text size attribute in pixels.

Parameters

TBool aIsDecoratedSize = EFalse If true, the decoration size (the area reserved for decoration) is added to the actual text size. The decoration here means various effects that can be added to the text, for example a shadow.

TextSizeInTwips(TBool)

IMPORT_C TInt TextSizeInTwips ( TBool aIsDecoratedSize = EFalse )

Retrieves text style text size attribute in twips.

Parameters

TBool aIsDecoratedSize = EFalse If true, the decoration size (the area reserved for decoration) is added to the actual text size. The decoration here means various effects that can be added to the text, for example a shadow.

Underline()

IMPORT_C TBool Underline ( ) const

Retrieves text style text underline attribute.

Member Data Documentation

TRgb iBackgroundColor

TRgb iBackgroundColor [private]

TRect iClipRect

TRect iClipRect [private]

TBool iClippingEnabled

TBool iClippingEnabled [private]

THuiFont iFont

THuiFont iFont [protected]

TInt iFontStyleId

TInt iFontStyleId [protected]

Font style ID

TInt iId

TInt iId [private]

A unique toolkit specific ID for the text style. The text style can be accessed anytime through the CHuiTextStyleManager based on this unique ID. The default text style has always ID 0.

TBool iIsStrikeThrough

TBool iIsStrikeThrough [private]

TBool iIsUnderline

TBool iIsUnderline [private]

TInt iLocalDefinitionFlags

TInt iLocalDefinitionFlags [protected]

Local definition flags

TInt iParentId

TInt iParentId [private]

Toolkit specific ID of the parent text style. The text styles are cascaded. The parent of a text style is EHuiTextStyleNormal by default.

TRgb iTextColor

TRgb iTextColor [private]