|
||
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(const CFont *)
and to obtain device-dependent information about the font - notably the pixel width of a text string.
CBase
-
Base class for all classes to be instantiated on the heap.
CFont
- Abstract font interface.
Defined in CFont
:
AscentInPixels()const
Gets the font ascent in pixels. Note that this deprecated function is replaced b...BaselineOffsetInPixels()const
Gets the baseline offset in pixels.CharWidthInPixels(TChar)const
Gets the width in pixels in this font of the specified character.CharactersJoin(TInt,TInt)
Determines if aLeftCharacter and aRightCharacter affect each other's contextual ...DescentInPixels()const
Gets the font descent in pixels. Note that this deprecated function is replaced ...DoDescentInPixels()const
Gets the font descent in pixels. It is defined to be CFont::HeightInPixels()cons...DoGetCharacterData(TUint,TOpenFontCharMetrics &,const TUint8 *&,TSize &)const
Gets the character metrics for a character.EAllCharacterData
All character data is available. ECharacterWidthOnly
Width information only is available. EHorizontal
Text is drawn horizontally. ENoCharacterData
No font information available. EVertical
Text is drawn vertically. ExtendedFunction(TUid,TAny *)const
Enables the caller to access a particular API extension function. N.B. Any overl...FontCapitalAscent()const
Gets the ascent of an ANSI capital letter in the font whether or not there are a...FontLineGap()const
Gets the suggested line gap for the font. This is the recommended baseline to ba...FontMaxAscent()const
Gets the max ascent of any pre-composed glyph in the font. This will include acc...FontMaxDescent()const
Gets the max descent of any pre-composed glyph in the font. This will include ac...FontMaxHeight()const
Gets the (positive) maximum height in pixels of the font. This may differ from t...FontSpecInTwips()const
Gets the font specification of this font in twips.FontStandardDescent()const
Gets the descent of an ANSI descending character in the font. Whether or not the...GetCharacterData(TUint,TOpenFontCharMetrics &,const TUint8 *&,TSize &)const
Gets the character metrics for a character.GetCharacterPosition2(TPositionParam &,RShapeInfo &)const
Takes Unicode text and produces the glyph cluster for the first character in tha...HeightInPixels()const
Gets the font height in pixels. Note that this deprecated function is replaced b...MaxCharWidthInPixels()const
Gets the width in pixels of the widest character in this font.MaxNormalCharWidthInPixels()const
Gets the width in pixels of the widest normal character in this font.MeasureText(const TDesC &,const TMeasureTextInput *,TMeasureTextOutput *)const
Text measurement function.TCharacterDataAvailability
Data availability flags.TMeasureTextInput
Input parameter block.TMeasureTextOutput
Output parameter block.TPositionParam
Complicated parameter block used for contextual glyph selection, ligature creati...TTextDirection
Text direction flags.TextCount(const TDesC &,TInt)const
Gets how much of the specified descriptor can be displayed in this font without ...TextCount(const TDesC &,TInt,TInt &)const
Gets how much of the specified descriptor can be displayed in this font without ...TextWidthInPixels(const TDesC &)const
Gets the width in pixels of the specified descriptor when displayed in this font...TypeUid()const
Gets run-time identity of the actual font type. This enables safe casting to a d...WidthZeroInPixels()const
Gets the width of the zero character of this font in pixels.~CFont()
Default destructor. Inherited from CBase
:
Delete(CBase *)
Deletes the specified object.Extension_(TUint,TAny *&,TAny *)
Extension function operator new(TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TAny *)
Initialises the object to binary zeroes.operator new(TUint,TLeave)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TLeave,TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TUint)
Allocates the object from the heap and then initialises its contents to binary z...CGraphicsContext::UseFont(const CFont *)
Sets the device font to be used for text drawing.Interface status: | deprecated |
private: IMPORT_C virtual TInt DoDescentInPixels() const;
Gets the font descent in pixels. It is defined to be CFont::HeightInPixels()const
minus CFont::AscentInPixels()const
. Note that this deprecated function is replaced by the new FontMaxDescent()
or in some cases FontStandardDescent()
.
|
CFont::FontStandardDescent()const
Gets the descent of an ANSI descending character in the font. Whether or not the...CFont::FontMaxDescent()const
Gets the max descent of any pre-composed glyph in the font. This will include ac...protected: IMPORT_C virtual TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics &aMetrics, const
TUint8 *&aBitmap, TSize &aBitmapSize) const;
Gets the character metrics for a character.
|
|
inline TInt FontCapitalAscent() const;
Gets the ascent of an ANSI capital letter in the font whether or not there are any ANSI capitals in the font.
|
inline TInt FontMaxAscent() const;
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.
|
inline TInt FontStandardDescent() const;
Gets the descent of an ANSI descending character in the font. Whether or not there are any ANSI descenders in the font.
|
inline TInt FontMaxDescent() const;
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.
|
inline TInt FontLineGap() const;
Gets the suggested line gap for the font. This is the recommended baseline to baseline distance between successive lines of text in the font.
|
inline TInt FontMaxHeight() const;
Gets the (positive) maximum height in pixels of the font. This may differ from the design height.
|
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.
|
Interface status: | deprecated |
IMPORT_C TInt HeightInPixels() const;
Gets the font height in pixels. Note that this deprecated function is replaced by the new FontMaxHeight()
.
|
CFont::FontMaxHeight()const
Gets the (positive) maximum height in pixels of the font. This may differ from t...Interface status: | deprecated |
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()
.
|
CFont::FontCapitalAscent()const
Gets the ascent of an ANSI capital letter in the font whether or not there are a...CFont::FontMaxAscent()const
Gets the max ascent of any pre-composed glyph in the font. This will include acc...Interface status: | deprecated |
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()
.
|
CFont::FontStandardDescent()const
Gets the descent of an ANSI descending character in the font. Whether or not the...CFont::FontMaxDescent()const
Gets the max descent of any pre-composed glyph in the font. This will include ac...IMPORT_C TInt CharWidthInPixels(TChar aChar) const;
Gets the width in pixels in this font of the specified character.
|
|
IMPORT_C TInt TextWidthInPixels(const TDesC &aText) const;
Gets the width in pixels of the specified descriptor when displayed in this font.
|
|
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.
|
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.
|
|
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.
|
|
IMPORT_C TInt MaxCharWidthInPixels() const;
Gets the width in pixels of the widest character in this font.
|
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).
|
IMPORT_C TFontSpec FontSpecInTwips() const;
Gets the font specification of this font in twips.
|
IMPORT_C TCharacterDataAvailability GetCharacterData(TUint aCode, TOpenFontCharMetrics &aMetrics, const TUint8 *&aBitmap,
TSize &aBitmapSize) const;
Gets the character metrics for a character.
|
|
IMPORT_C TInt WidthZeroInPixels() const;
Gets the width of the zero character of this font in pixels.
This function is provided as the "0" character is roughly the average width of the characters of any font.
|
IMPORT_C TInt MeasureText(const TDesC &aText, const TMeasureTextInput *aInput=0, TMeasureTextOutput *aOutput=0) const;
Text measurement function.
This is a powerful text measurement function underlying all the other text measurement functions. It takes optional input and output parameter blocks, which may be null, and returns the advance width (change in pen position when drawn horizontally) of the text, or the advance height, if the text is drawn vertically.
Some of the functions that can be performed using this function are listed below. Many of them are used by the Text Views API to do its typographic layout.
Get the advance width or advance height (return value). The advance width is the amount by which the pen advances when drawing the text horizontally, while the advance height is the amount by which the pen advances when drawing the text vertically.
Measure some text in context, so that shaping behaviour (e.g. in Arabic) can be affected by what comes before and after the
text. Do this using CFont::TMeasureTextInput::iStartInputChar
and CFont::TMeasureTextInput::iEndInputChar
to tell the function where to start and end in the supplied descriptor.
Determine how much text fits a given size by setting CFont::TMeasureTextInput::iMaxAdvance
or CFont::TMeasureTextInput::iMaxBounds
.
Specify letter spacing and word spacing using CFont::TMeasureTextInput::iCharJustNum
, CFont::TMeasureTextInput::iCharJustExcess
, CFont::TMeasureTextInput::iWordJustNum
and CFont::TMeasureTextInput::iWordJustExcess
.
Get the number of characters drawn in CFont::TMeasureTextOutput::iChars
when applying the various constraints in CFont::TMeasureTextInput
.
Get the number of glyphs drawn in CFont::TMeasureTextOutput::iGlyphs
.
Get the number of groups (formed by ligation or diacritic placement) in CFont::TMeasureTextOutput::iGroups
. Groups are units of cursor movement: the cursor hops over a character-plus-accent group or an Arabic or other ligature in
one go.
Get the number of word spaces in CFont::TMeasureTextOutput::iSpaces
.
Get the bounds of the inked-in pixels in CFont::TMeasureTextOutput::iBounds
.
Get the size of the biggest glyph that would be drawn in CFont::TMeasureTextOutput::iMaxGlyphSize
.
|
|
|
IMPORT_C static TBool CharactersJoin(TInt aLeftCharacter, TInt aRightCharacter);
Determines if aLeftCharacter and aRightCharacter affect each other's contextual glyph form if placed next to each other. If either character is a combining character, EFalse will be returned, which is not generally useful information. Pass in base characters ignoring intervening combining characters.
|
|
IMPORT_C TInt ExtendedFunction(TUid aFunctionId, TAny *aParam=0) const;
Enables the caller to access a particular API extension function. N.B. Any overload of this function in a derived class should call its immediate parent implementation for any extension function UID that it does not recognize and handle.
|
|
IMPORT_C TBool GetCharacterPosition2(TPositionParam &aParam, RShapeInfo &aShapeInfo) const;
Takes Unicode text and produces the glyph cluster for the first character in that text plus any combining mark characters, or for the first indic syllable. It is responsible for contextual glyph selection, ligature creation and diacritic placement.
|
|
CFont::TPositionParam
Complicated parameter block used for contextual glyph selection, ligature creati...class TPositionParam;
Complicated parameter block used for contextual glyph selection, ligature creation and diacritic placement when drawing text in complex scripts
This class declares a constructor, another scoped class, and several other enums. However this class is unlikely to be useful to third party developers.
Defined in CFont::TPositionParam
:
EFLogicalOrder
Input text is logically ordered not visually ordered. EMaxInputChars
EMaxOutputGlyphs
TFlags
Flags for CFont::TPositionParam::iFlags. TOutput
Output of GetCharacterPosition and GetCharacterPosition2. TPositionParam()
Standard constructor. anonymous
iDirection
Input: Orientation (EHorizontal or EVertical) in which to draw the text. iFlags
Input: Flags from TFlags. iOutput
Information about the glyphs that were output. iOutputGlyphs
Number of glyphs actually output. iPen
Input and output: Pen position. iPosInText
Input and output: Position within iText to shape. On exit it will index the firs...iText
Input: Text containing the characters to be positioned. CFont::GetCharacterPosition2(TPositionParam &,RShapeInfo &)const
Takes Unicode text and produces the glyph cluster for the first character in tha...TPositionParam()
inline TPositionParam();
Standard constructor.
TOutput
class TOutput;
Output of GetCharacterPosition and GetCharacterPosition2.
Defined in CFont::TPositionParam::TOutput
:
TOutput()
Standard constructor. iBitmap
Bitmap data for the glyph, if available iBitmapSize
Size of the bitmap before algorithmic bolding, size multiplication, etc. iBounds
Bitmap bounds relative to the original pen position. iCode
Character or glyph code. CFont::GetCharacterPosition2(TPositionParam &,RShapeInfo &)const
Takes Unicode text and produces the glyph cluster for the first character in tha...TOutput()
inline TOutput();
Standard constructor.
iCode
TUint iCode;
Character or glyph code.
iBitmap
const TUint8 * iBitmap;
Bitmap data for the glyph, if available
iBitmapSize
TSize iBitmapSize;
Size of the bitmap before algorithmic bolding, size multiplication, etc.
iBounds
TRect iBounds;
Bitmap bounds relative to the original pen position.
anonymous
n/a
|
TFlags
TFlags
Flags for CFont::TPositionParam::iFlags
.
|
iDirection
TInt16 iDirection;
Input: Orientation (EHorizontal or EVertical) in which to draw the text.
iFlags
TUint16 iFlags;
Input: Flags from TFlags.
iText
TPtrC iText;
Input: Text containing the characters to be positioned.
iPosInText
TInt iPosInText;
Input and output: Position within iText to shape. On exit it will index the first character not positioned
iPen
TPoint iPen;
Input and output: Pen position.
iOutput
TOutput iOutput[EMaxOutputGlyphs];
Information about the glyphs that were output.
iOutputGlyphs
TInt iOutputGlyphs;
Number of glyphs actually output.
class TMeasureTextInput;
Input parameter block.
This is optionally used by CFont::MeasureText(const TDesC &,const TMeasureTextInput *,TMeasureTextOutput *)const
, which is the powerful text measurement function underlying all the other text measurement functions.
Defined in CFont::TMeasureTextInput
:
EFIncludePenPositionInBoundsCheck
Flag to consider side bearings when checking bounds for line-break EFVisualOrder
Input text is visually ordered left-to-right. EFVisualOrderRightToLeft
Input text is visually ordered right-to-left. Overrides EFVisualOrder. TFlags
Flags for CFont::TMeasureTextInput::iFlags. TMeasureTextInput()
iCharJustExcess
The amount of space to be used for letter spacing. iCharJustNum
The number of glyph groups to be letter-spaced. iDirection
The direction in which to draw the text. iEndInputChar
Index specifying the final input character.iFlags
Flags from TFlags. iMaxAdvance
The maximum advance. iMaxBounds
The maximum width (or height if drawing vertically) of bounds. iStartInputChar
Starting index specifying first input character in iText.iWordJustExcess
The amount of space to be used for word spacing. iWordJustNum
The number of spaces to be used for word spacing. CFont::MeasureText(const TDesC &,const TMeasureTextInput *,TMeasureTextOutput *)const
Text measurement function.TMeasureTextInput()
inline TMeasureTextInput();
TFlags
TFlags
Flags for CFont::TMeasureTextInput::iFlags
.
|
iStartInputChar
TInt iStartInputChar;
Starting index specifying first input character in iText.
Together with iEndInputChar, this allows some context before and after the measured text to be supplied so that shaping can work properly.
iEndInputChar
TInt iEndInputChar;
Index specifying the final input character.
Together with iStartInputChar, this allows some context before and after the measured text to be supplied so that shaping can work properly.
iDirection
TUint16 iDirection;
The direction in which to draw the text.
iFlags
TUint16 iFlags;
Flags from TFlags.
iMaxAdvance
TInt iMaxAdvance;
The maximum advance.
iMaxBounds
TInt iMaxBounds;
The maximum width (or height if drawing vertically) of bounds.
iCharJustNum
TInt iCharJustNum;
The number of glyph groups to be letter-spaced.
iCharJustExcess
TInt iCharJustExcess;
The amount of space to be used for letter spacing.
iWordJustNum
TInt iWordJustNum;
The number of spaces to be used for word spacing.
iWordJustExcess
TInt iWordJustExcess;
The amount of space to be used for word spacing.
class TMeasureTextOutput;
Output parameter block.
This is optionally used by CFont::MeasureText(const TDesC &,const TMeasureTextInput *,TMeasureTextOutput *)const
, which is the powerful text measurement function underlying all the other text measurement functions.
Defined in CFont::TMeasureTextOutput
:
iBounds
The bounding box of all the glyphs that would be drawn. iChars
The number of input characters that would be drawn.iGlyphs
The number of glyphs that would be drawn. iGroups
The number of groups that would be drawn.iMaxGlyphSize
The maximum width and height of any glyph. iSpaces
The number of word spaces (U+0020) that would be drawn. CFont::MeasureText(const TDesC &,const TMeasureTextInput *,TMeasureTextOutput *)const
Text measurement function.iChars
TInt iChars;
The number of input characters that would be drawn.
This may be less than the length of the text if a maximum advance or bounding box size is specified.
iGlyphs
TInt iGlyphs;
The number of glyphs that would be drawn.
iGroups
TInt iGroups;
The number of groups that would be drawn.
A group is a base glyph plus one or more combining characters.
iSpaces
TInt iSpaces;
The number of word spaces (U+0020) that would be drawn.
iBounds
TRect iBounds;
The bounding box of all the glyphs that would be drawn.
iMaxGlyphSize
TSize iMaxGlyphSize;
The maximum width and height of any glyph.
TTextDirection
Text direction flags.
This enum is used in CFont::TMeasureTextInput
and determines whether the text is drawn horizontally or vertically. Note: text is drawn vertically in some styles of Japanese,
etc.
CFont::TMeasureTextInput
Input parameter block.
|
TCharacterDataAvailability
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.
CFont::GetCharacterData(TUint,TOpenFontCharMetrics &,const TUint8 *&,TSize &)const
Gets the character metrics for a character.
|