1QFontDatabase(3qt) QFontDatabase(3qt)
2
3
4
6 QFontDatabase - Information about the fonts available in the underlying
7 window system
8
10 #include <qfontdatabase.h>
11
12 Public Members
13 QFontDatabase ()
14 QStringList families () const
15 QStringList families ( QFont::Script script ) const
16 QStringList styles ( const QString & family ) const
17 QValueList<int> pointSizes ( const QString & family, const QString &
18 style = QString::null )
19 QValueList<int> smoothSizes ( const QString & family, const QString &
20 style )
21 QString styleString ( const QFont & f )
22 QFont font ( const QString & family, const QString & style, int
23 pointSize )
24 bool isBitmapScalable ( const QString & family, const QString & style =
25 QString::null ) const
26 bool isSmoothlyScalable ( const QString & family, const QString & style
27 = QString::null ) const
28 bool isScalable ( const QString & family, const QString & style =
29 QString::null ) const
30 bool isFixedPitch ( const QString & family, const QString & style =
31 QString::null ) const
32 bool italic ( const QString & family, const QString & style ) const
33 bool bold ( const QString & family, const QString & style ) const
34 int weight ( const QString & family, const QString & style ) const
35 QStringList families ( bool ) const (obsolete)
36 QStringList styles ( const QString & family, const QString & ) const
37 (obsolete)
38 QValueList<int> pointSizes ( const QString & family, const QString &
39 style, const QString & ) (obsolete)
40 QValueList<int> smoothSizes ( const QString & family, const QString &
41 style, const QString & ) (obsolete)
42 QFont font ( const QString & familyName, const QString & style, int
43 pointSize, const QString & ) (obsolete)
44 bool isBitmapScalable ( const QString & family, const QString & style,
45 const QString & ) const (obsolete)
46 bool isSmoothlyScalable ( const QString & family, const QString &
47 style, const QString & ) const (obsolete)
48 bool isScalable ( const QString & family, const QString & style, const
49 QString & ) const (obsolete)
50 bool isFixedPitch ( const QString & family, const QString & style,
51 const QString & ) const (obsolete)
52 bool italic ( const QString & family, const QString & style, const
53 QString & ) const (obsolete)
54 bool bold ( const QString & family, const QString & style, const
55 QString & ) const (obsolete)
56 int weight ( const QString & family, const QString & style, const
57 QString & ) const (obsolete)
58
59 Static Public Members
60 QValueList<int> standardSizes ()
61 QString scriptName ( QFont::Script script )
62 QString scriptSample ( QFont::Script script )
63
65 The QFontDatabase class provides information about the fonts available
66 in the underlying window system.
67
68 The most common uses of this class are to query the database for the
69 list of font families() and for the pointSizes() and styles() that are
70 available for each family. An alternative to pointSizes() is
71 smoothSizes() which returns the sizes at which a given family and style
72 will look attractive.
73
74 If the font family is available from two or more foundries the foundry
75 name is included in the family name, e.g. "Helvetica [Adobe]" and
76 "Helvetica [Cronyx]". When you specify a family you can either use the
77 old hyphenated Qt 2.x "foundry-family" format, e.g. "Cronyx-Helvetica",
78 or the new bracketed Qt 3.x "family [foundry]" format e.g. "Helvetica
79 [Cronyx]". If the family has a foundry it is always returned, e.g. by
80 families(), using the bracketed format.
81
82 The font() function returns a QFont given a family, style and point
83 size.
84
85 A family and style combination can be checked to see if it is italic()
86 or bold(), and to retrieve its weight(). Similarly we can call
87 isBitmapScalable(), isSmoothlyScalable(), isScalable() and
88 isFixedPitch().
89
90 A text version of a style is given by styleString().
91
92 The QFontDatabase class also supports some static functions, for
93 example, standardSizes(). You can retrieve the Unicode 3.0 description
94 of a script using scriptName(), and a sample of characters in a script
95 with scriptSample().
96
97 Example:
98
99 #include <qapplication.h>
100 #include <qfontdatabase.h>
101 #include <else.h>
102 int main( int argc, char **argv )
103 {
104 QApplication app( argc, argv );
105 QFontDatabase fdb;
106 QStringList families = fdb.families();
107 for ( QStringList::Iterator f = families.begin(); f != families.end(); ++f ) {
108 QString family = *f;
109 qDebug( family );
110 QStringList styles = fdb.styles( family );
111 for ( QStringList::Iterator s = styles.begin(); s != styles.end(); ++s ) {
112 QString style = *s;
113 QString dstyle = "\t" + style + " (";
114 QValueList<int> smoothies = fdb.smoothSizes( family, style );
115 for ( QValueList<int>::Iterator points = smoothies.begin();
116 points != smoothies.end(); ++points ) {
117 dstyle += QString::number( *points ) + " ";
118 }
119 dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
120 qDebug( dstyle );
121 }
122 }
123 return 0;
124 }
125 This example gets the list of font families, then the list of styles
126 for each family and the point sizes that are available for each
127 family/style combination.
128
129 See also Environment Classes and Graphics Classes.
130
133 Creates a font database object.
134
136 const
137 Returns TRUE if the font that has family family and style style is
138 bold; otherwise returns FALSE.
139
140 See also italic() and weight().
141
143 const QString & ) const
144 This function is obsolete. It is provided to keep old source working.
145 We strongly advise against using it in new code.
146
148 Returns a sorted list of the names of the available font families.
149
150 If a family exists in several foundries, the returned name for that
151 font is in the form "family [foundry]". Examples: [Adobe]", "Times
152 [Cronyx]", "Palatino".
153
155 This is an overloaded member function, provided for convenience. It
156 behaves essentially like the above function.
157
158 Returns a sorted list of the available font families which support the
159 Unicode script script.
160
161 If a family exists in several foundries, the returned name for that
162 font is in the form "family [foundry]". Examples: [Adobe]", "Times
163 [Cronyx]", "Palatino".
164
166 This function is obsolete. It is provided to keep old source working.
167 We strongly advise against using it in new code.
168
170 pointSize )
171 Returns a QFont object that has family family, style style and point
172 size pointSize. If no matching font could be created, a QFont object
173 that uses the application's default font is returned.
174
176 int pointSize, const QString & )
177 This function is obsolete. It is provided to keep old source working.
178 We strongly advise against using it in new code.
179
181 style = QString::null ) const
182 Returns TRUE if the font that has family family and style style is a
183 scalable bitmap font; otherwise returns FALSE. Scaling a bitmap font
184 usually produces an unattractive hardly readable result, because the
185 pixels of the font are scaled. If you need to scale a bitmap font it is
186 better to scale it to one of the fixed sizes returned by smoothSizes().
187
188 See also isScalable() and isSmoothlyScalable().
189
191 style, const QString & ) const
192 This function is obsolete. It is provided to keep old source working.
193 We strongly advise against using it in new code.
194
196 style = QString::null ) const
197 Returns TRUE if the font that has family family and style style is
198 fixed pitch; otherwise returns FALSE.
199
201 style, const QString & ) const
202 This function is obsolete. It is provided to keep old source working.
203 We strongly advise against using it in new code.
204
206 = QString::null ) const
207 Returns TRUE if the font that has family family and style style is
208 scalable; otherwise returns FALSE.
209
210 See also isBitmapScalable() and isSmoothlyScalable().
211
213 style, const QString & ) const
214 This function is obsolete. It is provided to keep old source working.
215 We strongly advise against using it in new code.
216
218 & style = QString::null ) const
219 Returns TRUE if the font that has family family and style style is
220 smoothly scalable; otherwise returns FALSE. If this function returns
221 TRUE, it's safe to scale this font to any size, and the result will
222 always look attractive.
223
224 See also isScalable() and isBitmapScalable().
225
227 & style, const QString & ) const
228 This function is obsolete. It is provided to keep old source working.
229 We strongly advise against using it in new code.
230
232 const
233 Returns TRUE if the font that has family family and style style is
234 italic; otherwise returns FALSE.
235
236 See also weight() and bold().
237
239 const QString & ) const
240 This function is obsolete. It is provided to keep old source working.
241 We strongly advise against using it in new code.
242
244 QString & style = QString::null )
245 Returns a list of the point sizes available for the font that has
246 family family and style style. The list may be empty.
247
248 See also smoothSizes() and standardSizes().
249
251 QString & style, const QString & )
252 This function is obsolete. It is provided to keep old source working.
253 We strongly advise against using it in new code.
254
256 Returns a string that gives a default description of the script (e.g.
257 for displaying to the user in a dialog). The name matches the name of
258 the script as defined by the Unicode 3.0 standard.
259
260 See also QFont::Script.
261
263 Returns a string with sample characters from script.
264
265 See also QFont::Script.
266
268 QString & style )
269 Returns the point sizes of a font that has family family and style
270 style that will look attractive. The list may be empty. For non-
271 scalable fonts and bitmap scalable fonts, this function is equivalent
272 to pointSizes().
273
274 See also pointSizes() and standardSizes().
275
277 QString & style, const QString & )
278 This function is obsolete. It is provided to keep old source working.
279 We strongly advise against using it in new code.
280
282 Returns a list of standard font sizes.
283
284 See also smoothSizes() and pointSizes().
285
287 Returns a string that describes the style of the font f. For example,
288 "Bold Italic", "Bold", "Italic" or "Normal". An empty string may be
289 returned.
290
292 Returns a list of the styles available for the font family family. Some
293 example styles: "Light", "Light Italic", "Bold"," Oblique", "Demi". The
294 list may be empty.
295
297 const
298 This function is obsolete. It is provided to keep old source working.
299 We strongly advise against using it in new code.
300
302 const
303 Returns the weight of the font that has family family and style style.
304 If there is no such family and style combination, returns -1.
305
306 See also italic() and bold().
307
309 const QString & ) const
310 This function is obsolete. It is provided to keep old source working.
311 We strongly advise against using it in new code.
312
314 http://doc.trolltech.com/qfontdatabase.html
315 http://www.trolltech.com/faq/tech.html
316
318 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
319 license file included in the distribution for a complete license
320 statement.
321
323 Generated automatically from the source code.
324
326 If you find a bug in Qt, please report it as described in
327 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
328 help you. Thank you.
329
330 The definitive Qt documentation is provided in HTML format; it is
331 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
332 web browser. This man page is provided as a convenience for those users
333 who prefer man pages, although this format is not officially supported
334 by Trolltech.
335
336 If you find errors in this manual page, please report them to qt-
337 bugs@trolltech.com. Please include the name of the manual page
338 (qfontdatabase.3qt) and the Qt version (3.3.8).
339
340
341
342Trolltech AS 2 February 2007 QFontDatabase(3qt)