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.
304 lines
15 KiB
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 <ntqfontdatabase.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 TQString & family ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "TQValueList<int> \fBpointSizes\fR ( const TQString & family, const TQString & style = TQString::null )"
|
|
.br
|
|
.ti -1c
|
|
.BI "TQValueList<int> \fBsmoothSizes\fR ( const TQString & family, const TQString & style )"
|
|
.br
|
|
.ti -1c
|
|
.BI "TQString \fBstyleString\fR ( const QFont & f )"
|
|
.br
|
|
.ti -1c
|
|
.BI "QFont \fBfont\fR ( const TQString & family, const TQString & style, int pointSize )"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBisBitmapScalable\fR ( const TQString & family, const TQString & style = TQString::null ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBisSmoothlyScalable\fR ( const TQString & family, const TQString & style = TQString::null ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBisScalable\fR ( const TQString & family, const TQString & style = TQString::null ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBisFixedPitch\fR ( const TQString & family, const TQString & style = TQString::null ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBitalic\fR ( const TQString & family, const TQString & style ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool \fBbold\fR ( const TQString & family, const TQString & style ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "int \fBweight\fR ( const TQString & family, const TQString & style ) const"
|
|
.br
|
|
.ti -1c
|
|
.BI "QStringList families ( bool ) const \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "QStringList styles ( const TQString & family, const TQString & ) const \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "TQValueList<int> pointSizes ( const TQString & family, const TQString & style, const TQString & ) \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "TQValueList<int> smoothSizes ( const TQString & family, const TQString & style, const TQString & ) \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "QFont font ( const TQString & familyName, const TQString & style, int pointSize, const TQString & ) \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool isBitmapScalable ( const TQString & family, const TQString & style, const TQString & ) const \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool isSmoothlyScalable ( const TQString & family, const TQString & style, const TQString & ) const \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool isScalable ( const TQString & family, const TQString & style, const TQString & ) const \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool isFixedPitch ( const TQString & family, const TQString & style, const TQString & ) const \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool italic ( const TQString & family, const TQString & style, const TQString & ) const \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "bool bold ( const TQString & family, const TQString & style, const TQString & ) const \fI(obsolete)\fR"
|
|
.br
|
|
.ti -1c
|
|
.BI "int weight ( const TQString & family, const TQString & style, const TQString & ) const \fI(obsolete)\fR"
|
|
.br
|
|
.in -1c
|
|
.SS "Static Public Members"
|
|
.in +1c
|
|
.ti -1c
|
|
.BI "TQValueList<int> \fBstandardSizes\fR ()"
|
|
.br
|
|
.ti -1c
|
|
.BI "TQString \fBscriptName\fR ( QFont::Script script )"
|
|
.br
|
|
.ti -1c
|
|
.BI "TQString \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 TQt 2.x "foundry-family" format, e.g. "Cronyx-Helvetica", or the new bracketed TQt 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 <ntqapplication.h>
|
|
.br
|
|
#include <ntqfontdatabase.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
|
|
TQString family = *f;
|
|
.br
|
|
tqDebug( family );
|
|
.br
|
|
QStringList styles = fdb.styles( family );
|
|
.br
|
|
for ( QStringList::Iterator s = styles.begin(); s != styles.end(); ++s ) {
|
|
.br
|
|
TQString style = *s;
|
|
.br
|
|
TQString dstyle = "\\t" + style + " (";
|
|
.br
|
|
TQValueList<int> smoothies = fdb.smoothSizes( family, style );
|
|
.br
|
|
for ( TQValueList<int>::Iterator points = smoothies.begin();
|
|
.br
|
|
points != smoothies.end(); ++points ) {
|
|
.br
|
|
dstyle += TQString::number( *points ) + " ";
|
|
.br
|
|
}
|
|
.br
|
|
dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
|
|
.br
|
|
tqDebug( 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 TQString & family, const TQString & 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 TQString & family, const TQString & style, const TQString & ) 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 TQString & family, const TQString & 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 TQString & familyName, const TQString & style, int pointSize, const TQString & )"
|
|
\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 TQString & family, const TQString & style = TQString::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 TQString & family, const TQString & style, const TQString & ) 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 TQString & family, const TQString & style = TQString::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 TQString & family, const TQString & style, const TQString & ) 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 TQString & family, const TQString & style = TQString::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 TQString & family, const TQString & style, const TQString & ) 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 TQString & family, const TQString & style = TQString::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 TQString & family, const TQString & style, const TQString & ) 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 TQString & family, const TQString & 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 TQString & family, const TQString & style, const TQString & ) const"
|
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
|
.SH "TQValueList<int> QFontDatabase::pointSizes ( const TQString & family, const TQString & style = TQString::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 "TQValueList<int> QFontDatabase::pointSizes ( const TQString & family, const TQString & style, const TQString & )"
|
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
|
.SH "TQString 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 "TQString QFontDatabase::scriptSample ( QFont::Script script )\fC [static]\fR"
|
|
Returns a string with sample characters from \fIscript\fR.
|
|
.PP
|
|
See also QFont::Script.
|
|
.SH "TQValueList<int> QFontDatabase::smoothSizes ( const TQString & family, const TQString & 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 "TQValueList<int> QFontDatabase::smoothSizes ( const TQString & family, const TQString & style, const TQString & )"
|
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
|
.SH "TQValueList<int> QFontDatabase::standardSizes ()\fC [static]\fR"
|
|
Returns a list of standard font sizes.
|
|
.PP
|
|
See also smoothSizes() and pointSizes().
|
|
.SH "TQString 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 TQString & 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 TQString & family, const TQString & ) 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 TQString & family, const TQString & 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 TQString & family, const TQString & style, const TQString & ) 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/ntqfontdatabase.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 TQt documentation is provided in HTML format; it is
|
|
located at $TQTDIR/doc/html and can be read using TQt 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 (tqfontdatabase.3qt) and the Qt
|
|
version (3.3.8).
|