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_CTHuiTextStyle(const THuiTextStyle &aTextStyle)

Copy constructor.

Parameters

const THuiTextStyle & aTextStyle

THuiTextStyle(TInt, TInt)

THuiTextStyle(TIntaFontStyleId = 0,
TIntaParentId = -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 = 0Font ID provided by font manager. If not set the default font is used.
TInt aParentId = -1The parent text style. Root style is created if the ID is not set.

Member Functions Documentation

BackgroundColor()

IMPORT_C TRgbBackgroundColor()const

DisableClipping()

voidDisableClipping()

EnableClipping(TRect)

voidEnableClipping(TRectaClipRect)

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

Retrieves font style id.

GetTypeface(TTypeface &)

IMPORT_C voidGetTypeface(TTypeface &aTypeface)const

Get the typeface that would be used for this text style

Parameters

TTypeface & aTypefaceReturned typeface structure

Id()

IMPORT_C TIntId()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 & aTextLineString 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 TIntParentId()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 TBoolPosture()

Retrieves text style text posture attribute.

RasterizeLineL(const TDesC &, CHuiTexture &)

voidRasterizeLineL(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 & aTextLineThe line of text to rasterize.
CHuiTexture & aTargetTextureReference to a texture that the text is going to be rasterized to.

SetBackgroundColor(const TRgb &)

IMPORT_C voidSetBackgroundColor(const TRgb &aBackgroundColor)

Parameters

const TRgb & aBackgroundColor

SetFont(THuiFont)

IMPORT_C voidSetFont(THuiFontaFont)[virtual]

Sets a THuiFont object associated with this logical text style.

Parameters

THuiFont aFontA HuiFont that willl be used in this text style.

SetId(TInt)

voidSetId(TIntaId)

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

Parameters

TInt aIdA 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)

voidSetLocalDefinitionFlags(TIntaLocalDefinitionFlags)

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 aLocalDefinitionFlagsWill set all the text style attribute flags.

SetParentId(TInt)

IMPORT_C voidSetParentId(TIntaParentId)

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 aParentIdA toolkit specific ID of the parent text style.

SetPosture(TBool)

IMPORT_C voidSetPosture(TBoolaIsItalic)

Sets the text style text posture attribute.

Parameters

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

SetStrikeThrough(TBool)

IMPORT_C voidSetStrikeThrough(TBoolaIsStrikeThrough)

Sets the text style text strike through attribute.

Parameters

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

SetStrokeWeight(TBool)

IMPORT_C voidSetStrokeWeight(TBoolaIsBold)

Sets the text style text stroke weight attribute.

Parameters

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

SetTextColor(const TRgb &)

IMPORT_C voidSetTextColor(const TRgb &aTextColour)

Sets the text style text color attribute.

Parameters

const TRgb & aTextColourA new text color of the text style.

SetTextPaneHeightInPixels(TInt, TBool)

IMPORT_C voidSetTextPaneHeightInPixels(TIntaTextPaneHeight,
TBoolaIsDecoratedSize = 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 aTextPaneHeightThe new text style text pane height in pixels.
TBool aIsDecoratedSize = EFalseIf 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 voidSetTextSizeInPixels(TIntaTextSizeInPix,
TBoolaIsDecoratedSize = EFalse
)

Sets the text style text size attribute in pixels.

Parameters

TInt aTextSizeInPixThe new text style text size in pixels.
TBool aIsDecoratedSize = EFalseIf 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 voidSetTextSizeInTwips(TIntaTextSizeInTwips,
TBoolaIsDecoratedSize = EFalse
)

Sets the text style text size attribute in twips.

Parameters

TInt aTextSizeInTwipsThe new text style text size in twips.
TBool aIsDecoratedSize = EFalseIf 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 voidSetUnderline(TBoolaIsUnderline)

Sets the text style text underline attribute.

Parameters

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

StrikeThrough()

IMPORT_C TBoolStrikeThrough()const

Retrieves text style text strike through attribute.

StrokeWeight()

IMPORT_C TBoolStrokeWeight()

Retrieves text style text stroke weight attribute.

TextColor()

IMPORT_C TRgbTextColor()const

Retrieves the text style text color attribute.

TextSizeInPixels(TBool)

IMPORT_C TIntTextSizeInPixels(TBoolaIsDecoratedSize = EFalse)

Retrieves text style text size attribute in pixels.

Parameters

TBool aIsDecoratedSize = EFalseIf 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 TIntTextSizeInTwips(TBoolaIsDecoratedSize = EFalse)

Retrieves text style text size attribute in twips.

Parameters

TBool aIsDecoratedSize = EFalseIf 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 TBoolUnderline()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]