|
|
|
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()constGets the font ascent in pixels. Note that this deprecated function is replaced b...BaselineOffsetInPixels()constGets the baseline offset in pixels.CharWidthInPixels(TChar)constGets 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()constGets the font descent in pixels. Note that this deprecated function is replaced ...DoDescentInPixels()constGets the font descent in pixels. It is defined to be CFont::HeightInPixels()cons...DoGetCharacterData(TUint,TOpenFontCharMetrics &,const TUint8 *&,TSize &)constGets the character metrics for a character.EAllCharacterDataAll character data is available. ECharacterWidthOnlyWidth information only is available. EHorizontalText is drawn horizontally. ENoCharacterDataNo font information available. EVerticalText is drawn vertically. ExtendedFunction(TUid,TAny *)constEnables the caller to access a particular API extension function. N.B. Any overl...FontCapitalAscent()constGets the ascent of an ANSI capital letter in the font whether or not there are a...FontLineGap()constGets the suggested line gap for the font. This is the recommended baseline to ba...FontMaxAscent()constGets the max ascent of any pre-composed glyph in the font. This will include acc...FontMaxDescent()constGets the max descent of any pre-composed glyph in the font. This will include ac...FontMaxHeight()constGets the (positive) maximum height in pixels of the font. This may differ from t...FontSpecInTwips()constGets the font specification of this font in twips.FontStandardDescent()constGets the descent of an ANSI descending character in the font. Whether or not the...GetCharacterData(TUint,TOpenFontCharMetrics &,const TUint8 *&,TSize &)constGets the character metrics for a character.GetCharacterPosition2(TPositionParam &,RShapeInfo &)constTakes Unicode text and produces the glyph cluster for the first character in tha...HeightInPixels()constGets the font height in pixels. Note that this deprecated function is replaced b...MaxCharWidthInPixels()constGets the width in pixels of the widest character in this font.MaxNormalCharWidthInPixels()constGets the width in pixels of the widest normal character in this font.MeasureText(const TDesC &,const TMeasureTextInput *,TMeasureTextOutput *)constText measurement function.TCharacterDataAvailabilityData availability flags.TMeasureTextInputInput parameter block.TMeasureTextOutputOutput parameter block.TPositionParamComplicated parameter block used for contextual glyph selection, ligature creati...TTextDirectionText direction flags.TextCount(const TDesC &,TInt)constGets how much of the specified descriptor can be displayed in this font without ...TextCount(const TDesC &,TInt,TInt &)constGets how much of the specified descriptor can be displayed in this font without ...TextWidthInPixels(const TDesC &)constGets the width in pixels of the specified descriptor when displayed in this font...TypeUid()constGets run-time identity of the actual font type. This enables safe casting to a d...WidthZeroInPixels()constGets 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()constGets the descent of an ANSI descending character in the font. Whether or not the...CFont::FontMaxDescent()constGets 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()constGets 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()constGets the ascent of an ANSI capital letter in the font whether or not there are a...CFont::FontMaxAscent()constGets 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()constGets the descent of an ANSI descending character in the font. Whether or not the...CFont::FontMaxDescent()constGets 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::TPositionParamComplicated 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:
EFLogicalOrderInput text is logically ordered not visually ordered. EMaxInputCharsEMaxOutputGlyphsTFlagsFlags for CFont::TPositionParam::iFlags. TOutputOutput of GetCharacterPosition and GetCharacterPosition2. TPositionParam()Standard constructor. anonymousiDirectionInput: Orientation (EHorizontal or EVertical) in which to draw the text. iFlagsInput: Flags from TFlags. iOutputInformation about the glyphs that were output. iOutputGlyphsNumber of glyphs actually output. iPenInput and output: Pen position. iPosInTextInput and output: Position within iText to shape. On exit it will index the firs...iTextInput: Text containing the characters to be positioned. CFont::GetCharacterPosition2(TPositionParam &,RShapeInfo &)constTakes Unicode text and produces the glyph cluster for the first character in tha...TPositionParam()inline TPositionParam();
Standard constructor.
TOutputclass TOutput;
Output of GetCharacterPosition and GetCharacterPosition2.
Defined in CFont::TPositionParam::TOutput:
TOutput()Standard constructor. iBitmapBitmap data for the glyph, if available iBitmapSizeSize of the bitmap before algorithmic bolding, size multiplication, etc. iBoundsBitmap bounds relative to the original pen position. iCodeCharacter or glyph code. CFont::GetCharacterPosition2(TPositionParam &,RShapeInfo &)constTakes Unicode text and produces the glyph cluster for the first character in tha...TOutput()inline TOutput();
Standard constructor.
iCodeTUint iCode;
Character or glyph code.
iBitmapconst TUint8 * iBitmap;
Bitmap data for the glyph, if available
iBitmapSizeTSize iBitmapSize;
Size of the bitmap before algorithmic bolding, size multiplication, etc.
iBoundsTRect iBounds;
Bitmap bounds relative to the original pen position.
anonymousn/a
|
TFlagsTFlags
Flags for CFont::TPositionParam::iFlags.
|
iDirectionTInt16 iDirection;
Input: Orientation (EHorizontal or EVertical) in which to draw the text.
iFlagsTUint16 iFlags;
Input: Flags from TFlags.
iTextTPtrC iText;
Input: Text containing the characters to be positioned.
iPosInTextTInt iPosInText;
Input and output: Position within iText to shape. On exit it will index the first character not positioned
iPenTPoint iPen;
Input and output: Pen position.
iOutputTOutput iOutput[EMaxOutputGlyphs];
Information about the glyphs that were output.
iOutputGlyphsTInt 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:
EFIncludePenPositionInBoundsCheckFlag to consider side bearings when checking bounds for line-break EFVisualOrderInput text is visually ordered left-to-right. EFVisualOrderRightToLeftInput text is visually ordered right-to-left. Overrides EFVisualOrder. TFlagsFlags for CFont::TMeasureTextInput::iFlags. TMeasureTextInput()iCharJustExcessThe amount of space to be used for letter spacing. iCharJustNumThe number of glyph groups to be letter-spaced. iDirectionThe direction in which to draw the text. iEndInputCharIndex specifying the final input character.iFlagsFlags from TFlags. iMaxAdvanceThe maximum advance. iMaxBoundsThe maximum width (or height if drawing vertically) of bounds. iStartInputCharStarting index specifying first input character in iText.iWordJustExcessThe amount of space to be used for word spacing. iWordJustNumThe number of spaces to be used for word spacing. CFont::MeasureText(const TDesC &,const TMeasureTextInput *,TMeasureTextOutput *)constText measurement function.TMeasureTextInput()inline TMeasureTextInput();
TFlagsTFlags
Flags for CFont::TMeasureTextInput::iFlags.
|
iStartInputCharTInt 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.
iEndInputCharTInt 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.
iDirectionTUint16 iDirection;
The direction in which to draw the text.
iFlagsTUint16 iFlags;
Flags from TFlags.
iMaxAdvanceTInt iMaxAdvance;
The maximum advance.
iMaxBoundsTInt iMaxBounds;
The maximum width (or height if drawing vertically) of bounds.
iCharJustNumTInt iCharJustNum;
The number of glyph groups to be letter-spaced.
iCharJustExcessTInt iCharJustExcess;
The amount of space to be used for letter spacing.
iWordJustNumTInt iWordJustNum;
The number of spaces to be used for word spacing.
iWordJustExcessTInt 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:
iBoundsThe bounding box of all the glyphs that would be drawn. iCharsThe number of input characters that would be drawn.iGlyphsThe number of glyphs that would be drawn. iGroupsThe number of groups that would be drawn.iMaxGlyphSizeThe maximum width and height of any glyph. iSpacesThe number of word spaces (U+0020) that would be drawn. CFont::MeasureText(const TDesC &,const TMeasureTextInput *,TMeasureTextOutput *)constText measurement function.iCharsTInt 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.
iGlyphsTInt iGlyphs;
The number of glyphs that would be drawn.
iGroupsTInt iGroups;
The number of groups that would be drawn.
A group is a base glyph plus one or more combining characters.
iSpacesTInt iSpaces;
The number of word spaces (U+0020) that would be drawn.
iBoundsTRect iBounds;
The bounding box of all the glyphs that would be drawn.
iMaxGlyphSizeTSize 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::TMeasureTextInputInput 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 &)constGets the character metrics for a character.
|