summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/qfontdatabase.3qt
blob: a13caf4b40ba0b78231f2d4bfeb8bd09aef864c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
'\" 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 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 <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
        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/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 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 [email protected] .
Please include the name of the manual page (qfontdatabase.3qt) and the Qt
version (3.3.8).