| Classes - Annotated - Tree - Functions - Home - Structure

# QFontDatabase Class Reference

Provides information about available fonts. More...

`#include <qfontdatabase.h>`

List of all member functions.

## Public Members

- QFontDatabase ()
- QStringList families ( bool onlyForLocale = TRUE ) const
- QValueList<int> pointSizes ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null )
- QStringList styles ( const QString & family, const QString & charSet = QString::null ) const
- QStringList charSets ( const QString & familyName, bool onlyForLocale = TRUE ) const
- QFont font ( const QString familyName, const QString & style, int pointSize, const QString charSetName = QString::null )
- bool isBitmapScalable ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null ) const
- bool isSmoothlyScalable ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null ) const
- bool isScalable ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null ) const
- bool isFixedPitch ( const QString & family, const QString & style = QString::null, const QString & charset = QString::null ) const
- QValueList<int> smoothSizes ( const QString & family, const QString & style, const QString & charSet = QString::null )
- bool italic ( const QString & family, const QString & style, const QString & charSet = QString::null ) const
- bool bold ( const QString & family, const QString & style, const QString & charSet = QString::null ) const
- int weight ( const QString & family, const QString & style, const QString & charSet = QString::null ) const
- QString styleString ( const QFont & )

## Static Public Members

- QValueList<int> standardSizes ()
- QString verboseCharSetName ( const QString & charSetName )
- QString charSetSample ( const QString & charSetName )

## Detailed Description

Provides information about available fonts.

QFontDatabase provides information about the available fonts of the underlying window system.

Most often you will simply want to query the database for all font families(), and their respective pointSizes(), styles() and charSets().

## Member Function Documentation

### QFontDatabase::QFontDatabase ()

Creates a font database object.

### bool QFontDatabase::bold ( const QString & family, const QString & style, const QString & charSet = QString::null ) const

Returns if the font which matches the settings family, style and charSet is bold or not.

See also italic() and weight().

### QString QFontDatabase::charSetSample ( const QString & charSetName ) `[static]`

Returns some sample characters which are in the charset charSetName.

### QStringList QFontDatabase::charSets ( const QString & family, bool onlyForLocale = TRUE ) const

Returns a list of all char sets in which the font family is available in the current locale if onlyForLocale is TRUE, otherwise all charsets of family independent of the locale are returned.

### QStringList QFontDatabase::families ( bool onlyForLocale = TRUE ) const

Returns a list of names of all available font families in the current locale if onlyForLocale is TRUE, otherwise really all available font families independent of the current locale are returned.

If a family exists in several foundries, the returned name will be "foundry-family".

### QFont QFontDatabase::font ( const QString family, const QString & style, int pointSize, const QString charSet = QString::null )

Returns a QFont object which matches the settings of family, style, pointsize and charSet. If no matching font could be created an empty QFont object is returned.

### bool QFontDatabase::isBitmapScalable ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null ) const

Returns whether the font which matches family, style and charSet is a scaleable bitmap font. Scaling a bitmap font produces a bad, often hardly readable result, as the pixels of the font are scaled. It's better to scale such a font only to the available fixed sizes (which you can get with smoothSizes()).

See also isScalable() and isSmoothlyScalable().

### bool QFontDatabase::isFixedPitch ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null ) const

Returns whether the font which matches family, style and charSet is fixed pitch.

### bool QFontDatabase::isScalable ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null ) const

Returns TRUE if the font which matches the settings family, style and charSet is scaleable.

See also isBitmapScalable() and isSmoothlyScalable().

### bool QFontDatabase::isSmoothlyScalable ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null ) const

Returns whether the font which matches family, style and charSet is a smoothly scaleable. If this function returns TRUE, it's save to scale this font to every size as the result will always look good.

See also isScalable() and isBitmapScalable().

### bool QFontDatabase::italic ( const QString & family, const QString & style, const QString & charSet = QString::null ) const

Returns if the font which matches the settings family, style and charSet is italic or not.

See also weight() and bold().

### QValueList<int> QFontDatabase::pointSizes ( const QString & family, const QString & style = QString::null, const QString & charSet = QString::null )

Returns a list of all available sizes of the font family in the style style and the char set charSet.

See also smoothSizes() and standardSizes().

### QValueList<int> QFontDatabase::smoothSizes ( const QString & family, const QString & style, const QString & charSet = QString::null )

Returns the point sizes of a font which matches family, style and charSet, that is guaranteed to look good. For non-scalable fonts and smoothly scalable fonts this function is equivalent to pointSizes().

See also pointSizes() and standardSizes().

### QValueList<int> QFontDatabase::standardSizes () `[static]`

Returns a list of standard fontsizes.

See also smoothSizes() and pointSizes().

### QString QFontDatabase::styleString ( const QFont & f )

Returns a string with describes the style of the font f. This is Something like "Bold Italic".

### QStringList QFontDatabase::styles ( const QString & family, const QString & charSet = QString::null ) const

Retruns all available styles of the font family in the char set charSet.

### QString QFontDatabase::verboseCharSetName ( const QString & charSetName ) `[static]`

Returns a string which gives a quite detailed description of the charSetName which can be used e.g. for displaying in a dialog for the user.

### int QFontDatabase::weight ( const QString & family, const QString & style, const QString & charSet = QString::null ) const

Returns the weight of the font which matches the settings family, style and charSet.

See also italic() and bold().

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.