class CFont : public CBase |
Abstract font interface.
The CFont class provides a device-independent interface to a device-dependent font usually obtained from a call to GetNearestFont...() on a graphics device. It is used as a handle in CGraphicsContext::UseFont() and to obtain device-dependent information about the font - notably the pixel width of a text string.
Protected Member Functions | |
---|---|
~CFont() | |
IMPORT_C TInt | DoExtendedFunction(TUid, TAny *) |
IMPORT_C TCharacterDataAvailability | DoGetCharacterData(TUint, TOpenFontCharMetrics &, const TUint8 *&, TSize &) |
IMPORT_C TBool | DoGetCharacterPosition(TPositionParam &) |
Private Member Functions | |
---|---|
TInt | DoAscentInPixels() |
TInt | DoBaselineOffsetInPixels() |
TInt | DoCharWidthInPixels(TChar) |
IMPORT_C TInt | DoDescentInPixels() |
TFontSpec | DoFontSpecInTwips() |
TInt | DoHeightInPixels() |
TInt | DoMaxCharWidthInPixels() |
TInt | DoMaxNormalCharWidthInPixels() |
TInt | DoTextCount(const TDesC &, TInt) |
TInt | DoTextCount(const TDesC &, TInt, TInt &) |
TInt | DoTextWidthInPixels(const TDesC &) |
TUid | DoTypeUid() |
Public Member Enumerations | |
---|---|
enum | TCharacterDataAvailability { ENoCharacterData, ECharacterWidthOnly, EAllCharacterData } |
enum | TTextDirection { EHorizontal, EVertical } |
IMPORT_C TInt | AscentInPixels | ( | ) | const |
Gets the font ascent in pixels. Note that this deprecated function is replaced by the new FontMaxAscent() or in some cases FontCapitalAscent().
The font ascent in pixels.
IMPORT_C TInt | BaselineOffsetInPixels | ( | ) | const |
Gets the baseline offset in pixels.
The baseline offset is how far a font is raised or lowered from its normal baseline.
Offset from normal baseline, in pixels.
IMPORT_C TInt | CharWidthInPixels | ( | TChar | aChar | ) | const |
Gets the width in pixels in this font of the specified character.
Note: For OpenType fonts this function returns the horizontal advance of the character, which may be different from the actual width.
The width in pixels of the specified character in this font.
TChar aChar | The character whose width should be determined. |
IMPORT_C TBool | CharactersJoin | ( | TInt | aLeftCharacter, |
TInt | aRightCharacter | |||
) | [static] |
IMPORT_C TInt | DescentInPixels | ( | ) | const |
Gets the font descent in pixels. Note that this deprecated function is replaced by the new FontMaxDescent() or in some cases FontStandardDescent().
The font descent in pixels.
TInt | DoAscentInPixels | ( | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
TInt | DoBaselineOffsetInPixels | ( | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
TInt | DoCharWidthInPixels | ( | TChar | aChar | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
TChar aChar |
IMPORT_C TInt | DoExtendedFunction | ( | TUid | aFunctionId, |
TAny * | aParam = NULL | |||
) | const [protected, virtual] |
TFontSpec | DoFontSpecInTwips | ( | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
IMPORT_C TCharacterDataAvailability | DoGetCharacterData | ( | TUint | aCode, |
TOpenFontCharMetrics & | aMetrics, | |||
const TUint8 *& | aBitmap, | |||
TSize & | aBitmapSize | |||
) | const [protected, virtual] |
TUint aCode | |
TOpenFontCharMetrics & aMetrics | |
const TUint8 *& aBitmap | |
TSize & aBitmapSize |
IMPORT_C TBool | DoGetCharacterPosition | ( | TPositionParam & | aParam | ) | const [protected, virtual] |
TPositionParam & aParam |
TInt | DoHeightInPixels | ( | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
TInt | DoMaxCharWidthInPixels | ( | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
TInt | DoMaxNormalCharWidthInPixels | ( | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
TInt | DoTextCount | ( | const TDesC & | aText, |
TInt | aWidthInPixels | |||
) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
TInt | DoTextCount | ( | const TDesC & | aText, |
TInt | aWidthInPixels, | |||
TInt & | aExcessWidthInPixels | |||
) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
TInt | DoTextWidthInPixels | ( | const TDesC & | aText | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
const TDesC & aText |
TUid | DoTypeUid | ( | ) | const [private, pure virtual] |
WARNING: Function for internal use ONLY. Compatibility is not guaranteed in future releases. Please see derived class for implementation.
IMPORT_C TInt | ExtendedFunction | ( | TUid | aFunctionId, |
TAny * | aParam = NULL | |||
) | const |
TInt | FontCapitalAscent | ( | ) | const [inline] |
Gets the ascent of an ANSI capital letter in the font whether or not there are any ANSI capitals in the font. The positive distance from the font baseline to the top of a standard ANSI capital letter
TInt | FontLineGap | ( | ) | const [inline] |
Gets the suggested line gap for the font. This is the recommended baseline to baseline distance between successive lines of text in the font. The positive recommended gap between successive lines
TInt | FontMaxAscent | ( | ) | const [inline] |
Gets the max ascent of any pre-composed glyph in the font. This will include accents or diacritics that form part of pre-composed glyphs. It is not guaranteed to cover the max ascent of composite glyphs that have to be created by a layout engine. This is also the recommended distance between the top of a text box and the baseline of the first line of text. The positive distance from the font baseline to the top of the highest pre-composed glyph (including accents) above the baseline
TInt | FontMaxDescent | ( | ) | const [inline] |
Gets the max descent of any pre-composed glyph in the font. This will include accents or diacritics that form part of pre-composed glyphs. It is not guaranteed to cover the max descent of composite glyphs that have to be created by a layout engine. The positive distance from the font baseline to the bottom of the lowest pre-composed glyph (including accents) below the baseline
TInt | FontMaxHeight | ( | ) | const [inline] |
Gets the (positive) maximum height in pixels of the font. This may differ from the design height.
The maximum height of the font.
IMPORT_C TFontSpec | FontSpecInTwips | ( | ) | const |
Gets the font specification of this font in twips.
The font specification of this font (in twips).
TInt | FontStandardDescent | ( | ) | const [inline] |
Gets the descent of an ANSI descending character in the font. Whether or not there are any ANSI descenders in the font. The positive distance from the font baseline to the bottom of the lowest ANSI descender
IMPORT_C TCharacterDataAvailability | GetCharacterData | ( | TUint | aCode, |
TOpenFontCharMetrics & | aMetrics, | |||
const TUint8 *& | aBitmap, | |||
TSize & | aBitmapSize | |||
) | const |
TUint aCode | |
TOpenFontCharMetrics & aMetrics | |
const TUint8 *& aBitmap | |
TSize & aBitmapSize |
IMPORT_C TBool | GetCharacterPosition | ( | TPositionParam & | aParam | ) | const |
TPositionParam & aParam |
IMPORT_C TBool | GetCharacterPosition2 | ( | TPositionParam & | aParam, |
RShapeInfo & | aShapeInfo | |||
) | const |
TPositionParam & aParam | |
RShapeInfo & aShapeInfo |
IMPORT_C TInt | HeightInPixels | ( | ) | const |
Gets the font height in pixels. Note that this deprecated function is replaced by the new FontMaxHeight().
The font height in pixels.
IMPORT_C TInt | MaxCharWidthInPixels | ( | ) | const |
Gets the width in pixels of the widest character in this font.
The width of the maximum width character, in pixels.
IMPORT_C TInt | MaxNormalCharWidthInPixels | ( | ) | const |
Gets the width in pixels of the widest normal character in this font.
Normal characters include all character in a character set except non-alphabetic characters (e.g. the copyright symbol, or a block graphics symbol, for example).
The width of the maximum width normal character, in pixels.
IMPORT_C TInt | MeasureText | ( | const TDesC & | aText, |
const TMeasureTextInput * | aInput = NULL, | |||
TMeasureTextOutput * | aOutput = NULL | |||
) | const |
const TDesC & aText | |
const TMeasureTextInput * aInput = NULL | |
TMeasureTextOutput * aOutput = NULL |
IMPORT_C TInt | TextCount | ( | const TDesC & | aText, |
TInt | aWidthInPixels | |||
) | const |
Gets how much of the specified descriptor can be displayed in this font without exceeding the specified width.
Note:
This function does not display any of the descriptor itself - it is used before display, to test whether the whole descriptor can be displayed.
The number of characters which will be able to be displayed without exceeding the specified width. The count starts from the beginning of the descriptor.
IMPORT_C TInt | TextCount | ( | const TDesC & | aText, |
TInt | aWidthInPixels, | |||
TInt & | aExcessWidthInPixels | |||
) | const |
Gets how much of the specified descriptor can be displayed in this font without exceeding the specified width.
It also returns the excess width - defined as the specified available width minus the width of the portion of the descriptor which can be displayed without exceeding the available width.
The number of characters which will be able to be displayed without exceeding the specified width. The count starts from the beginning of the descriptor.
IMPORT_C TInt | TextWidthInPixels | ( | const TDesC & | aText | ) | const |
Gets the width in pixels of the specified descriptor when displayed in this font.
The width of the specified descriptor when displayed in this font, in pixels.
const TDesC & aText | The descriptor whose width should be determined. |
IMPORT_C TInt | TextWidthInPixels | ( | const TDesC & | aText, |
const TMeasureTextInput * | aParam | |||
) | const |
Gets the width in pixels of the specified descriptor when displayed in this font.
The width of the specified descriptor when displayed in this font, in pixels.
const TDesC & aText | The descriptor whose width should be determined. |
const TMeasureTextInput * aParam | Parameter block that controls how much of aText is measured |
IMPORT_C TUid | TypeUid | ( | ) | const |
Gets run-time identity of the actual font type. This enables safe casting to a derived type.
For example, if the derived type is a CFbsFont, the return value is KCFbsFontUid. You would need to cast to a CFbsFont to get a character bounding box. Similarly, a CBitmapFont returns KCBitmapFontUidVal.
The font-type identifier.
Data availability flags.
Some fonts like printer fonts may only have width information and can return ECharacterWidthOnly to show this: the text drawing routines in CFont synthesize the rest of the data if necessary.
ENoCharacterData |
No font information available. |
ECharacterWidthOnly |
Width information only is available. |
EAllCharacterData |
All character data is available. |
Text direction flags.
This enum is used in TMeasureTextInput and determines whether the text is drawn horizontally or vertically. Note: text is drawn vertically in some styles of Japanese, etc.
EHorizontal |
Text is drawn horizontally. Text is drawn horizontally. |
EVertical |
Text is drawn vertically. |