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 TAknFontCategory | Category() |
IMPORT_C TFontSpec | FontSpec(MGraphicsDeviceMap *) |
IMPORT_C TInt | Id() |
IMPORT_C TSize | LineExtentsL(const TDesC &) |
IMPORT_C CFont * | NearestFontL(TReal32) |
IMPORT_C void | RasterizeLineL(const TDesC &, CFbsBitGc &) |
IMPORT_C void | ReleaseFont() |
IMPORT_C void | SetCategory(const TAknFontCategory) |
IMPORT_C void | SetFontSpec(const TFontSpec &) |
IMPORT_C void | SetTextPaneHeight(TInt) |
IMPORT_C TInt | TextPaneHeight() |
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 |
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.
IMPORT_C | THuiFont | ( | const THuiFont & | aFont | ) |
Copy constructor.
const THuiFont & aFont | Font to be copied. |
IMPORT_C TFontSpec | FontSpec | ( | MGraphicsDeviceMap * | aMap = NULL | ) | const |
Returns the Symbian font specification. Always returned in Twips
MGraphicsDeviceMap * aMap = NULL | Graphics device map containing desired pixel to twips ratio to use |
IMPORT_C TSize | LineExtentsL | ( | const TDesC & | aTextString | ) |
Retrieves the dimensions in pixels occupied by rasterization of the given string using this font.
const TDesC & aTextString | String that is used in calculation of rasterization dimensions. |
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.
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 |
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.
TReal32 aTextMeshYScale = 1 | Height scale factor from LCD resolution to TV resolution. |
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.
IMPORT_C void | SetCategory | ( | const TAknFontCategory | aCategory | ) |
Sets the category.
const TAknFontCategory aCategory |
IMPORT_C void | SetFontSpec | ( | const TFontSpec & | aFontSpec | ) |
Sets the font specification.
const TFontSpec & aFontSpec |
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
TInt aTextPaneHeight | text pane height in pixels into which the text is to fit completely |
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
IMPORT_C THuiFont & | operator= | ( | const THuiFont & | aFont | ) |
Assignment operator.
const THuiFont & aFont | Font to be copied. |
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
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.