Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QFontDatabase Class Reference

List of all members.

Detailed Description

The QFontDatabase class provides information about the fonts available in the underlying window system.

The most common uses of this class are to query the database for the list of font families() and for the pointSizes() and styles() that are available for each family. An alternative to pointSizes() is smoothSizes() which returns the sizes at which a given family and style will look attractive.

If the font family is available from two or more foundries the foundry name is included in the family name, e.g. "Helvetica [Adobe]" and "Helvetica [Cronyx]". When you specify a family you can either use the old hyphenated Qt 2.x "foundry-family" format, e.g. "Cronyx-Helvetica", or the new bracketed Qt 3.x "family [foundry]" format e.g. "Helvetica [Cronyx]". If the family has a foundry it is always returned, e.g. by families(), using the bracketed format.

The font() function returns a QFont given a family, style and point size.

A family and style combination can be checked to see if it is italic() or bold(), and to retrieve its weight(). Similarly we can call isBitmapScalable(), isSmoothlyScalable(), isScalable() and isFixedPitch().

Use the styleString() to obtain a text version of a style.

The QFontDatabase class also supports some static functions, for example, standardSizes(). You can retrieve the description of a writing system using writingSystemName(), and a sample of characters in a writing system with writingSystemSample().


doc/src/snippets/qfontdatabase/main.cpp 0 doc/src/snippets/qfontdatabase/main.cpp 1

This example gets the list of font families, the list of styles for each family, and the point sizes that are available for each combination of family and style, displaying this information in a tree view.

See also:
QFont, QFontInfo, QFontMetrics, QFontComboBox, {Character Map Example}

Definition at line 68 of file qfontdatabase.h.

Public Types

enum  WritingSystem {
  Any, Latin, Greek, Cyrillic,
  Armenian, Hebrew, Arabic, Syriac,
  Thaana, Devanagari, Bengali, Gurmukhi,
  Gujarati, Oriya, Tamil, Telugu,
  Kannada, Malayalam, Sinhala, Thai,
  Lao, Tibetan, Myanmar, Georgian,
  Khmer, SimplifiedChinese, TraditionalChinese, Japanese,
  Korean, Vietnamese, Symbol, Other = Symbol,
  Ogham, Runic, WritingSystemsCount

Public Member Functions

bool bold (const QString &family, const QString &style) const
QStringList families (WritingSystem writingSystem=Any) const
QFont font (const QString &family, const QString &style, int pointSize) const
bool isBitmapScalable (const QString &family, const QString &style=QString()) const
bool isFixedPitch (const QString &family, const QString &style=QString()) const
bool isScalable (const QString &family, const QString &style=QString()) const
bool isSmoothlyScalable (const QString &family, const QString &style=QString()) const
bool italic (const QString &family, const QString &style) const
QList< int > pointSizes (const QString &family, const QString &style=QString())
 QFontDatabase ()
QList< int > smoothSizes (const QString &family, const QString &style)
QStringList styles (const QString &family) const
QString styleString (const QFontInfo &fontInfo)
QString styleString (const QFont &font)
int weight (const QString &family, const QString &style) const
QList< WritingSystemwritingSystems (const QString &family) const
QList< WritingSystemwritingSystems () const

Static Public Member Functions

static int addApplicationFont (const QString &fileName)
static int addApplicationFontFromData (const QByteArray &fontData)
static QStringList applicationFontFamilies (int id)
static bool removeAllApplicationFonts ()
static bool removeApplicationFont (int id)
static QList< int > standardSizes ()
static bool supportsThreadedFontRendering ()
static QString writingSystemName (WritingSystem writingSystem)
static QString writingSystemSample (WritingSystem writingSystem)

Static Private Member Functions

static void createDatabase ()
static void load (const QFontPrivate *d, int script)
static void parseFontName (const QString &name, QString &foundry, QString &family)

Private Attributes

QFontDatabasePrivate * d


struct QFontDef
class QFontDialog
class QFontEngineMultiQWS
class QFontEngineMultiXLFD
class QFontPrivate

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index