Qt API | Qtopia API | Qtopia Documentation |

# QRenderedFont Class Reference

A QRenderedFont is the rendered version of a particular font (as specified by QFont - that is, at a given weight,family and point size, italic or not, and so on). There is one and only one QRenderedFont for each particular QFont specification; if you specify two Times 10pt bold italic QFonts they will both refer to the same QRenderedFont. QRenderedFonts are cached by QFontManager and are reference counted; when there is no QGfx referring to a particular QRenderedFont it is deleted. Each QRenderedFont renders glyphs (that is, images of characters) on demand and caches the rendered glyphs. It can be subclassed by individual factories since they create new QRenderedFonts. More...

`#include <qfontmanager_qws.h>`

List of all member functions.

## Public Members

- QRenderedFont ( QDiskFont * df, const QFontDef & d )
- virtual ~QRenderedFont ()
- QFontDef fontDef () const
- void ref ()
- bool deref ()
- int ascent ()
- int descent ()
- int width ( int )
- int width ( const QString & s, int l = -1 )
- int leftBearing ( int )
- int rightBearing ( int )
- int minLeftBearing ()
- int minRightBearing ()
- int maxWidth ()
- virtual bool inFont ( QChar ch ) const = 0
- virtual QGlyph render ( QChar ch ) = 0

## Detailed Description

A QRenderedFont is the rendered version of a particular font (as specified by QFont - that is, at a given weight,family and point size, italic or not, and so on). There is one and only one QRenderedFont for each particular QFont specification; if you specify two Times 10pt bold italic QFonts they will both refer to the same QRenderedFont. QRenderedFonts are cached by QFontManager and are reference counted; when there is no QGfx referring to a particular QRenderedFont it is deleted. Each QRenderedFont renders glyphs (that is, images of characters) on demand and caches the rendered glyphs. It can be subclassed by individual factories since they create new QRenderedFonts.

## Member Function Documentation

### QRenderedFont::QRenderedFont ( QDiskFont * df, const QFontDef & d )

This constructs a QRenderedFont; the QDiskFont and QFontDef are needed by the font factory to render glyphs.

### QRenderedFont::~QRenderedFont ()`[virtual]`

Destroys a QRenderedFont

### int QRenderedFont::ascent ()

Returns the font's ascent (the distance from the baseline to the top of the tallest character)

### int QRenderedFont::descent ()

Returns the font's descent (the distance from the baseline to the bottom of the lowest character)

### int QRenderedFont::maxWidth ()

Returns the maximum width in pixels of any character in the font.

### int QRenderedFont::minLeftBearing ()

Returns the minimum right bearing (distance from the end of a character) of any character in the font. Unimplemented.

### QGlyph QRenderedFont::render ( QChar ch )`[pure virtual]`

Renders the unicode character ch, returning a QGlyph. A QGlyph has two members, metrics and data. Metrics contains information on the size, advance width and so forth of the character, data a pointer to the raw data for the character - either a 1 bit per pixel bitmap or an 8 bit per pixel alpha map of the character, the linestep of which is specified in QGlyphMetrics.

### int QRenderedFont::rightBearing ( int )

Returns the right bearing (distance in pixels after the end of the letter) of the character specified.

### int QRenderedFont::width ( int )

Returns the width in pixels of the unicode character specified

### int QRenderedFont::width ( const QString & s, int l = -1 )

Returns the width in pixels of the first l characters of the string s, or the whole string if the value for l is not specified. This should be used in preference to adding up the widths of each character in the string since it can take account of kerning and inter-character spacing

This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.