You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/man/man3/qfontdatabase.3qt

304 lines
15 KiB

'\" t
.TH QFontDatabase 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QFontDatabase \- Information about the fonts available in the underlying window system
.SH SYNOPSIS
\fC#include <qfontdatabase.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQFontDatabase\fR ()"
.br
.ti -1c
.BI "QStringList \fBfamilies\fR () const"
.br
.ti -1c
.BI "QStringList \fBfamilies\fR ( QFont::Script script ) const"
.br
.ti -1c
.BI "QStringList \fBstyles\fR ( const QString & family ) const"
.br
.ti -1c
.BI "QValueList<int> \fBpointSizes\fR ( const QString & family, const QString & style = QString::null )"
.br
.ti -1c
.BI "QValueList<int> \fBsmoothSizes\fR ( const QString & family, const QString & style )"
.br
.ti -1c
.BI "QString \fBstyleString\fR ( const QFont & f )"
.br
.ti -1c
.BI "QFont \fBfont\fR ( const QString & family, const QString & style, int pointSize )"
.br
.ti -1c
.BI "bool \fBisBitmapScalable\fR ( const QString & family, const QString & style = QString::null ) const"
.br
.ti -1c
.BI "bool \fBisSmoothlyScalable\fR ( const QString & family, const QString & style = QString::null ) const"
.br
.ti -1c
.BI "bool \fBisScalable\fR ( const QString & family, const QString & style = QString::null ) const"
.br
.ti -1c
.BI "bool \fBisFixedPitch\fR ( const QString & family, const QString & style = QString::null ) const"
.br
.ti -1c
.BI "bool \fBitalic\fR ( const QString & family, const QString & style ) const"
.br
.ti -1c
.BI "bool \fBbold\fR ( const QString & family, const QString & style ) const"
.br
.ti -1c
.BI "int \fBweight\fR ( const QString & family, const QString & style ) const"
.br
.ti -1c
.BI "QStringList families ( bool ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "QStringList styles ( const QString & family, const QString & ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "QValueList<int> pointSizes ( const QString & family, const QString & style, const QString & ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "QValueList<int> smoothSizes ( const QString & family, const QString & style, const QString & ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "QFont font ( const QString & familyName, const QString & style, int pointSize, const QString & ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool isBitmapScalable ( const QString & family, const QString & style, const QString & ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool isSmoothlyScalable ( const QString & family, const QString & style, const QString & ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool isScalable ( const QString & family, const QString & style, const QString & ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool isFixedPitch ( const QString & family, const QString & style, const QString & ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool italic ( const QString & family, const QString & style, const QString & ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "bool bold ( const QString & family, const QString & style, const QString & ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int weight ( const QString & family, const QString & style, const QString & ) const \fI(obsolete)\fR"
.br
.in -1c
.SS "Static Public Members"
.in +1c
.ti -1c
.BI "QValueList<int> \fBstandardSizes\fR ()"
.br
.ti -1c
.BI "QString \fBscriptName\fR ( QFont::Script script )"
.br
.ti -1c
.BI "QString \fBscriptSample\fR ( QFont::Script script )"
.br
.in -1c
.SH DESCRIPTION
The QFontDatabase class provides information about the fonts available in the underlying window system.
.PP
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.
.PP
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.
.PP
The font() function returns a QFont given a family, style and point size.
.PP
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().
.PP
A text version of a style is given by styleString().
.PP
The QFontDatabase class also supports some static functions, for example, standardSizes(). You can retrieve the Unicode 3.0 description of a script using scriptName(), and a sample of characters in a script with scriptSample().
.PP
Example:
.PP
.nf
.br
#include <qapplication.h>
.br
#include <qfontdatabase.h>
.br
#include <else.h>
.br
.br
int main( int argc, char **argv )
.br
{
.br
QApplication app( argc, argv );
.br
QFontDatabase fdb;
.br
QStringList families = fdb.families();
.br
for ( QStringList::Iterator f = families.begin(); f != families.end(); ++f ) {
.br
QString family = *f;
.br
qDebug( family );
.br
QStringList styles = fdb.styles( family );
.br
for ( QStringList::Iterator s = styles.begin(); s != styles.end(); ++s ) {
.br
QString style = *s;
.br
QString dstyle = "\\t" + style + " (";
.br
QValueList<int> smoothies = fdb.smoothSizes( family, style );
.br
for ( QValueList<int>::Iterator points = smoothies.begin();
.br
points != smoothies.end(); ++points ) {
.br
dstyle += QString::number( *points ) + " ";
.br
}
.br
dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
.br
qDebug( dstyle );
.br
}
.br
}
.br
return 0;
.br
}
.fi
This example gets the list of font families, then the list of styles for each family and the point sizes that are available for each family/style combination.
.PP
See also Environment Classes and Graphics Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QFontDatabase::QFontDatabase ()"
Creates a font database object.
.SH "bool QFontDatabase::bold ( const QString & family, const QString & style ) const"
Returns TRUE if the font that has family \fIfamily\fR and style \fIstyle\fR is bold; otherwise returns FALSE.
.PP
See also italic() and weight().
.SH "bool QFontDatabase::bold ( const QString & family, const QString & style, const QString & ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "QStringList QFontDatabase::families () const"
Returns a sorted list of the names of the available font families.
.PP
If a family exists in several foundries, the returned name for that font is in the form "family [foundry]". Examples:
.)l "Times
[Adobe]", "Times [Cronyx]", "Palatino".
.SH "QStringList QFontDatabase::families ( QFont::Script script ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns a sorted list of the available font families which support the Unicode script \fIscript\fR.
.PP
If a family exists in several foundries, the returned name for that font is in the form "family [foundry]". Examples:
.)l "Times
[Adobe]", "Times [Cronyx]", "Palatino".
.SH "QStringList QFontDatabase::families ( bool ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "QFont QFontDatabase::font ( const QString & family, const QString & style, int pointSize )"
Returns a QFont object that has family \fIfamily\fR, style \fIstyle\fR and point size \fIpointSize\fR. If no matching font could be created, a QFont object that uses the application's default font is returned.
.SH "QFont QFontDatabase::font ( const QString & familyName, const QString & style, int pointSize, const QString & )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "bool QFontDatabase::isBitmapScalable ( const QString & family, const QString & style = QString::null ) const"
Returns TRUE if the font that has family \fIfamily\fR and style \fIstyle\fR is a scalable bitmap font; otherwise returns FALSE. Scaling a bitmap font usually produces an unattractive hardly readable result, because the pixels of the font are scaled. If you need to scale a bitmap font it is better to scale it to one of the fixed sizes returned by smoothSizes().
.PP
See also isScalable() and isSmoothlyScalable().
.SH "bool QFontDatabase::isBitmapScalable ( const QString & family, const QString & style, const QString & ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "bool QFontDatabase::isFixedPitch ( const QString & family, const QString & style = QString::null ) const"
Returns TRUE if the font that has family \fIfamily\fR and style \fIstyle\fR is fixed pitch; otherwise returns FALSE.
.SH "bool QFontDatabase::isFixedPitch ( const QString & family, const QString & style, const QString & ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "bool QFontDatabase::isScalable ( const QString & family, const QString & style = QString::null ) const"
Returns TRUE if the font that has family \fIfamily\fR and style \fIstyle\fR is scalable; otherwise returns FALSE.
.PP
See also isBitmapScalable() and isSmoothlyScalable().
.SH "bool QFontDatabase::isScalable ( const QString & family, const QString & style, const QString & ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "bool QFontDatabase::isSmoothlyScalable ( const QString & family, const QString & style = QString::null ) const"
Returns TRUE if the font that has family \fIfamily\fR and style \fIstyle\fR is smoothly scalable; otherwise returns FALSE. If this function returns TRUE, it's safe to scale this font to any size, and the result will always look attractive.
.PP
See also isScalable() and isBitmapScalable().
.SH "bool QFontDatabase::isSmoothlyScalable ( const QString & family, const QString & style, const QString & ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "bool QFontDatabase::italic ( const QString & family, const QString & style ) const"
Returns TRUE if the font that has family \fIfamily\fR and style \fIstyle\fR is italic; otherwise returns FALSE.
.PP
See also weight() and bold().
.SH "bool QFontDatabase::italic ( const QString & family, const QString & style, const QString & ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "QValueList<int> QFontDatabase::pointSizes ( const QString & family, const QString & style = QString::null )"
Returns a list of the point sizes available for the font that has family \fIfamily\fR and style \fIstyle\fR. The list may be empty.
.PP
See also smoothSizes() and standardSizes().
.SH "QValueList<int> QFontDatabase::pointSizes ( const QString & family, const QString & style, const QString & )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "QString QFontDatabase::scriptName ( QFont::Script script )\fC [static]\fR"
Returns a string that gives a default description of the \fIscript\fR (e.g. for displaying to the user in a dialog). The name matches the name of the script as defined by the Unicode 3.0 standard.
.PP
See also QFont::Script.
.SH "QString QFontDatabase::scriptSample ( QFont::Script script )\fC [static]\fR"
Returns a string with sample characters from \fIscript\fR.
.PP
See also QFont::Script.
.SH "QValueList<int> QFontDatabase::smoothSizes ( const QString & family, const QString & style )"
Returns the point sizes of a font that has family \fIfamily\fR and style \fIstyle\fR that will look attractive. The list may be empty. For non-scalable fonts and bitmap scalable fonts, this function is equivalent to pointSizes().
.PP
See also pointSizes() and standardSizes().
.SH "QValueList<int> QFontDatabase::smoothSizes ( const QString & family, const QString & style, const QString & )"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "QValueList<int> QFontDatabase::standardSizes ()\fC [static]\fR"
Returns a list of standard font sizes.
.PP
See also smoothSizes() and pointSizes().
.SH "QString QFontDatabase::styleString ( const QFont & f )"
Returns a string that describes the style of the font \fIf\fR. For example, "Bold Italic", "Bold", "Italic" or "Normal". An empty string may be returned.
.SH "QStringList QFontDatabase::styles ( const QString & family ) const"
Returns a list of the styles available for the font family \fIfamily\fR. Some example styles: "Light", "Light Italic", "Bold"," Oblique", "Demi". The list may be empty.
.SH "QStringList QFontDatabase::styles ( const QString & family, const QString & ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.SH "int QFontDatabase::weight ( const QString & family, const QString & style ) const"
Returns the weight of the font that has family \fIfamily\fR and style \fIstyle\fR. If there is no such family and style combination, returns -1.
.PP
See also italic() and bold().
.SH "int QFontDatabase::weight ( const QString & family, const QString & style, const QString & ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qfontdatabase.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qfontdatabase.3qt) and the Qt
version (3.3.8).