File: qfont.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (454 lines) | stat: -rw-r--r-- 51,164 bytes parent folder | download
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QFont Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFont Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QFont class specifies a font used for drawing text. <a href="#details">More...</a></p>
<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qfont.html#Stretch-enum">Stretch</a></b> { UltraCondensed, ExtraCondensed, Condensed, SemiCondensed, ..., UltraExpanded }</li><li><div class="fn" />enum <b><a href="qfont.html#Style-enum">Style</a></b> { StyleNormal, StyleItalic, StyleOblique }</li><li><div class="fn" />enum <b><a href="qfont.html#StyleHint-enum">StyleHint</a></b> { Helvetica, SansSerif, Times, Serif, ..., AnyStyle }</li><li><div class="fn" />enum <b><a href="qfont.html#StyleStrategy-enum">StyleStrategy</a></b> { PreferDefault, PreferBitmap, PreferDevice, PreferOutline, ..., OpenGLCompatible }</li><li><div class="fn" />enum <b><a href="qfont.html#Weight-enum">Weight</a></b> { Light, Normal, DemiBold, Bold, Black }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qfont.html#QFont">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qfont.html#QFont-2">__init__</a></b> (<i>self</i>, QString&#160;<i>family</i>, int&#160;<i>pointSize</i>&#160;=&#160;-1, int&#160;<i>weight</i>&#160;=&#160;-1, bool&#160;<i>italic</i>&#160;=&#160;False)</li><li><div class="fn" /><b><a href="qfont.html#QFont-3">__init__</a></b> (<i>self</i>, QFont, QPaintDevice&#160;<i>pd</i>)</li><li><div class="fn" /><b><a href="qfont.html#QFont-4">__init__</a></b> (<i>self</i>, QVariant)</li><li><div class="fn" /><b><a href="qfont.html#QFont-5">__init__</a></b> (<i>self</i>, QFont)</li><li><div class="fn" />bool <b><a href="qfont.html#bold">bold</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfont.html#defaultFamily">defaultFamily</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#exactMatch">exactMatch</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfont.html#family">family</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#fixedPitch">fixedPitch</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#fromString">fromString</a></b> (<i>self</i>, QString)</li><li><div class="fn" />unsigned long <b><a href="qfont.html#handle">handle</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#isCopyOf">isCopyOf</a></b> (<i>self</i>, QFont)</li><li><div class="fn" />bool <b><a href="qfont.html#italic">italic</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#kerning">kerning</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfont.html#key">key</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfont.html#lastResortFamily">lastResortFamily</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfont.html#lastResortFont">lastResortFont</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#overline">overline</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qfont.html#pixelSize">pixelSize</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qfont.html#pointSize">pointSize</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qfont.html#pointSizeF">pointSizeF</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#rawMode">rawMode</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfont.html#rawName">rawName</a></b> (<i>self</i>)</li><li><div class="fn" />QFont <b><a href="qfont.html#resolve">resolve</a></b> (<i>self</i>, QFont)</li><li><div class="fn" /><b><a href="qfont.html#setBold">setBold</a></b> (<i>self</i>, bool&#160;<i>enable</i>)</li><li><div class="fn" /><b><a href="qfont.html#setFamily">setFamily</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qfont.html#setFixedPitch">setFixedPitch</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qfont.html#setItalic">setItalic</a></b> (<i>self</i>, bool&#160;<i>b</i>)</li><li><div class="fn" /><b><a href="qfont.html#setKerning">setKerning</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qfont.html#setOverline">setOverline</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qfont.html#setPixelSize">setPixelSize</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qfont.html#setPointSize">setPointSize</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qfont.html#setPointSizeF">setPointSizeF</a></b> (<i>self</i>, float)</li><li><div class="fn" /><b><a href="qfont.html#setRawMode">setRawMode</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qfont.html#setRawName">setRawName</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qfont.html#setStretch">setStretch</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qfont.html#setStrikeOut">setStrikeOut</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qfont.html#setStyle">setStyle</a></b> (<i>self</i>, Style&#160;<i>style</i>)</li><li><div class="fn" /><b><a href="qfont.html#setStyleHint">setStyleHint</a></b> (<i>self</i>, StyleHint, StyleStrategy&#160;=&#160;QFont.PreferDefault)</li><li><div class="fn" /><b><a href="qfont.html#setStyleStrategy">setStyleStrategy</a></b> (<i>self</i>, StyleStrategy&#160;<i>s</i>)</li><li><div class="fn" /><b><a href="qfont.html#setUnderline">setUnderline</a></b> (<i>self</i>, bool)</li><li><div class="fn" /><b><a href="qfont.html#setWeight">setWeight</a></b> (<i>self</i>, int)</li><li><div class="fn" />int <b><a href="qfont.html#stretch">stretch</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#strikeOut">strikeOut</a></b> (<i>self</i>)</li><li><div class="fn" />Style <b><a href="qfont.html#style">style</a></b> (<i>self</i>)</li><li><div class="fn" />StyleHint <b><a href="qfont.html#styleHint">styleHint</a></b> (<i>self</i>)</li><li><div class="fn" />StyleStrategy <b><a href="qfont.html#styleStrategy">styleStrategy</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qfont.html#toString">toString</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qfont.html#underline">underline</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qfont.html#weight">weight</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" /><b><a href="qfont.html#cacheStatistics">cacheStatistics</a></b> ()</li><li><div class="fn" /><b><a href="qfont.html#cleanup">cleanup</a></b> ()</li><li><div class="fn" /><b><a href="qfont.html#initialize">initialize</a></b> ()</li><li><div class="fn" /><b><a href="qfont.html#insertSubstitution">insertSubstitution</a></b> (QString, QString)</li><li><div class="fn" /><b><a href="qfont.html#insertSubstitutions">insertSubstitutions</a></b> (QString, QStringList)</li><li><div class="fn" /><b><a href="qfont.html#removeSubstitution">removeSubstitution</a></b> (QString)</li><li><div class="fn" />QString <b><a href="qfont.html#substitute">substitute</a></b> (QString)</li><li><div class="fn" />QStringList <b><a href="qfont.html#substitutes">substitutes</a></b> (QString)</li><li><div class="fn" />QStringList <b><a href="qfont.html#substitutions">substitutions</a></b> ()</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qfont.html#__eq__">__eq__</a></b> (<i>self</i>, QFont)</li><li><div class="fn" />bool <b><a href="qfont.html#__lt__">__lt__</a></b> (<i>self</i>, QFont)</li><li><div class="fn" />bool <b><a href="qfont.html#__ne__">__ne__</a></b> (<i>self</i>, QFont)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFont class specifies a font used for drawing text.</p>
<p>When you create a QFont object you specify various attributes that you want the font to have. Qt will use the font with the specified attributes, or if no matching font exists, Qt will use the closest matching installed font. The attributes of the font that is actually used are retrievable from a <a href="qfontinfo.html">QFontInfo</a> object. If the window system provides an exact match <a href="qfont.html#exactMatch">exactMatch</a>() returns true. Use <a href="qfontmetrics.html">QFontMetrics</a> to get measurements, e.g. the pixel length of a string using <a href="qfontmetrics.html#width">QFontMetrics.width</a>().</p>
<p>Use <a href="qapplication.html#setFont">QApplication.setFont</a>() to set the application's default font.</p>
<p>If a chosen font does not include all the characters that need to be displayed, QFont will try to find the characters in the nearest equivalent fonts. When a <a href="qpainter.html">QPainter</a> draws a character from a font the QFont will report whether or not it has the character; if it does not, <a href="qpainter.html">QPainter</a> will draw an unfilled square.</p>
<p>Create QFonts like this:</p>
<pre>
    QFont serifFont("Times", 10, Bold);
    QFont sansFont("Helvetica [Cronyx]", 12);
</pre>
<p>The attributes set in the constructor can also be set later, e.g. <a href="qfont.html#setFamily">setFamily</a>(), <a href="qfont.html#setPointSize">setPointSize</a>(), <a href="qfont-qt3.html#setPointSizeFloat">setPointSizeFloat</a>(), <a href="qfont.html#setWeight">setWeight</a>() and <a href="qfont.html#setItalic">setItalic</a>(). The remaining attributes must be set after contstruction, e.g. <a href="qfont.html#setBold">setBold</a>(), <a href="qfont.html#setUnderline">setUnderline</a>(), <a href="qfont.html#setOverline">setOverline</a>(), <a href="qfont.html#setStrikeOut">setStrikeOut</a>() and <a href="qfont.html#setFixedPitch">setFixedPitch</a>(). <a href="qfontinfo.html">QFontInfo</a> objects should be created <i>after</i> the font's attributes have been set. A <a href="qfontinfo.html">QFontInfo</a> object will not change, even if you change the font's attributes. The corresponding "get" functions, e.g. <a href="qfont.html#family">family</a>(), <a href="qfont.html#pointSize">pointSize</a>(), etc., return the values that were set, even though the values used may differ. The actual values are available from a <a href="qfontinfo.html">QFontInfo</a> object.</p>
<p>If the requested font family is unavailable you can influence the <a href="#fontmatching">font matching algorithm</a> by choosing a particular <a href="qfont.html#StyleHint-enum">QFont.StyleHint</a> and <a href="qfont.html#StyleStrategy-enum">QFont.StyleStrategy</a> with <a href="qfont.html#setStyleHint">setStyleHint</a>(). The default family (corresponding to the current style hint) is returned by <a href="qfont.html#defaultFamily">defaultFamily</a>().</p>
<p>The font-matching algorithm has a <a href="qfont.html#lastResortFamily">lastResortFamily</a>() and <a href="qfont.html#lastResortFont">lastResortFont</a>() in cases where a suitable match cannot be found. You can provide substitutions for font family names using <a href="qfont.html#insertSubstitution">insertSubstitution</a>() and <a href="qfont.html#insertSubstitutions">insertSubstitutions</a>(). Substitutions can be removed with <a href="qfont.html#removeSubstitution">removeSubstitution</a>(). Use <a href="qfont.html#substitute">substitute</a>() to retrieve a family's first substitute, or the family name itself if it has no substitutes. Use <a href="qfont.html#substitutes">substitutes</a>() to retrieve a list of a family's substitutes (which may be empty).</p>
<p>Every QFont has a <a href="qfont.html#key">key</a>() which you can use, for example, as the key in a cache or dictionary. If you want to store a user's font preferences you could use <a href="qsettings.html">QSettings</a>, writing the font information with <a href="qfont.html#toString">toString</a>() and reading it back with <a href="qfont.html#fromString">fromString</a>(). The operator&lt;&lt;() and operator&gt;&gt;() functions are also available, but they work on a data stream.</p>
<p>It is possible to set the height of characters shown on the screen to a specified number of pixels with <a href="qfont.html#setPixelSize">setPixelSize</a>(); however using <a href="qfont.html#setPointSize">setPointSize</a>() has a similar effect and provides device independence.</p>
<p>Under X11 you can set a font using its system specific name with <a href="qfont.html#setRawName">setRawName</a>().</p>
<p>Loading fonts can be expensive, especially on X11. QFont contains extensive optimizations to make the copying of QFont objects fast, and to cache the results of the slow window system functions it depends upon.</p>
<a id="fontmatching" name="fontmatching" />
<p>The font matching algorithm works as follows:</p>
<ol type="1">
<li>The specified font family is searched for.</li>
<li>If not found, the <a href="qfont.html#styleHint">styleHint</a>() is used to select a replacement family.</li>
<li>Each replacement font family is searched for.</li>
<li>If none of these are found or there was no <a href="qfont.html#styleHint">styleHint</a>(), "helvetica" will be searched for.</li>
<li>If "helvetica" isn't found Qt will try the <a href="qfont.html#lastResortFamily">lastResortFamily</a>().</li>
<li>If the <a href="qfont.html#lastResortFamily">lastResortFamily</a>() isn't found Qt will try the <a href="qfont.html#lastResortFont">lastResortFont</a>() which will always return a name of some kind.</li>
</ol>
<p>Note that the actual font matching algorithm varies from platform to platform.</p>
<p>Once a font is found, the remaining attributes are matched in order of priority:</p>
<ol type="1">
<li><a href="qfont.html#fixedPitch">fixedPitch</a>()</li>
<li><a href="qfont.html#pointSize">pointSize</a>() (see below)</li>
<li><a href="qfont.html#weight">weight</a>()</li>
<li><a href="qfont.html#style">style</a>()</li>
</ol>
<p>If you have a font which matches on family, even if none of the other attributes match, this font will be chosen in preference to a font which doesn't match on family but which does match on the other attributes. This is because font family is the dominant search criteria.</p>
<p>The point size is defined to match if it is within 20% of the requested point size. When several fonts match and are only distinguished by point size, the font with the closest point size to the one requested will be chosen.</p>
<p>The actual family, font size, weight and other font attributes used for drawing text will depend on what's available for the chosen family under the window system. A <a href="qfontinfo.html">QFontInfo</a> object can be used to determine the actual values used for drawing the text.</p>
<p>Examples:</p>
<pre>
    QFont f("Helvetica");
</pre>
<p>If you had both an Adobe and a Cronyx Helvetica, you might get either.</p>
<pre>
    QFont f("Helvetica [Cronyx]");
</pre>
<p>You can specify the foundry you want in the family name. The font f in the above example will be set to "Helvetica [Cronyx]".</p>
<p>To determine the attributes of the font actually used in the window system, use a <a href="qfontinfo.html">QFontInfo</a> object, e.g.</p>
<pre>
    QFontInfo info(f1);
    QString family = info.family();
</pre>
<p>To find out font metrics use a <a href="qfontmetrics.html">QFontMetrics</a> object, e.g.</p>
<pre>
    QFontMetrics fm(f1);
    int textWidthInPixels = fm.width("How many pixels wide is this text?");
    int textHeightInPixels = fm.height();
</pre>
<p>For more general information on fonts, see the <a href="http://nwalsh.com/comp.fonts/FAQ/">comp.fonts FAQ.</a> Information on encodings can be found from <a href="http://czyborra.com/">Roman Czyborra's</a> page.</p>
<p><a href="qwidget.html#font-prop">QWidget.setFont</a>() <a href="qpainter.html#setFont">QPainter.setFont</a>() <a href="qfont.html#StyleHint-enum">QFont.StyleHint</a> <a href="qfont.html#Weight-enum">QFont.Weight</a></p>
<p>See also <a href="qfontmetrics.html">QFontMetrics</a>, <a href="qfontinfo.html">QFontInfo</a>, <a href="qfontdatabase.html">QFontDatabase</a>, and <a href="qapplication.html#setFont">QApplication.setFont</a>().</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Stretch-enum" />QFont.Stretch</h3><p>Predefined stretch values that follow the CSS naming convention. The higher the value, the more stretched the text is.</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QFont.UltraCondensed</tt></td>
<td align="center" valign="top"><tt>50</tt></td>
<td valign="top">50</td>
</tr>
<tr>
<td valign="top"><tt>QFont.ExtraCondensed</tt></td>
<td align="center" valign="top"><tt>62</tt></td>
<td valign="top">62</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Condensed</tt></td>
<td align="center" valign="top"><tt>75</tt></td>
<td valign="top">75</td>
</tr>
<tr>
<td valign="top"><tt>QFont.SemiCondensed</tt></td>
<td align="center" valign="top"><tt>87</tt></td>
<td valign="top">87</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Unstretched</tt></td>
<td align="center" valign="top"><tt>100</tt></td>
<td valign="top">100</td>
</tr>
<tr>
<td valign="top"><tt>QFont.SemiExpanded</tt></td>
<td align="center" valign="top"><tt>112</tt></td>
<td valign="top">112</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Expanded</tt></td>
<td align="center" valign="top"><tt>125</tt></td>
<td valign="top">125</td>
</tr>
<tr>
<td valign="top"><tt>QFont.ExtraExpanded</tt></td>
<td align="center" valign="top"><tt>150</tt></td>
<td valign="top">150</td>
</tr>
<tr>
<td valign="top"><tt>QFont.UltraExpanded</tt></td>
<td align="center" valign="top"><tt>200</tt></td>
<td valign="top">200</td>
</tr>
</table>
<br />
<br />
<p>See also <a href="qfont.html#setStretch">setStretch</a>() and <a href="qfont.html#stretch">stretch</a>().</p>
<h3 class="fn"><a name="Style-enum" />QFont.Style</h3><p>This enum describes the different styles of glyphs that are used to display text.</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QFont.StyleNormal</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">Normal glyphs used in unstyled text.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.StyleItalic</tt></td>
<td align="center" valign="top"><tt>1</tt></td>
<td valign="top">Italic glyphs that are specifically designed for the purpose of representing italicized text.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.StyleOblique</tt></td>
<td align="center" valign="top"><tt>2</tt></td>
<td valign="top">Glyphs with an italic appearance that are typically based on the unstyled glyphs, but are not fine-tuned for the purpose of representing italicized text.</td>
</tr>
</table>
<br />
<br />
<p>See also <a href="qfont.html#Weight-enum">Weight</a>.</p>
<h3 class="fn"><a name="StyleHint-enum" />QFont.StyleHint</h3><p>Style hints are used by the <a href="qfont.html">font matching</a> algorithm to find an appropriate default family if a selected font family is not available.</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QFont.AnyStyle</tt></td>
<td align="center" valign="top"> </td>
<td valign="top">leaves the font matching algorithm to choose the family. This is the default.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.SansSerif</tt></td>
<td align="center" valign="top"><tt>Helvetica</tt></td>
<td valign="top">the font matcher prefer sans serif fonts.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Helvetica</tt></td>
<td align="center" valign="top"><tt>0</tt></td>
<td valign="top">is a synonym for <tt>SansSerif</tt>.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Serif</tt></td>
<td align="center" valign="top"><tt>Times</tt></td>
<td valign="top">the font matcher prefers serif fonts.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Times</tt></td>
<td align="center" valign="top"> </td>
<td valign="top">is a synonym for <tt>Serif</tt>.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.TypeWriter</tt></td>
<td align="center" valign="top"><tt>Courier</tt></td>
<td valign="top">the font matcher prefers fixed pitch fonts.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Courier</tt></td>
<td align="center" valign="top"> </td>
<td valign="top">a synonym for <tt>TypeWriter</tt>.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.OldEnglish</tt></td>
<td align="center" valign="top"> </td>
<td valign="top">the font matcher prefers decorative fonts.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Decorative</tt></td>
<td align="center" valign="top"><tt>OldEnglish</tt></td>
<td valign="top">is a synonym for <tt>OldEnglish</tt>.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.System</tt></td>
<td align="center" valign="top"> </td>
<td valign="top">the font matcher prefers system fonts.</td>
</tr>
</table>
<br />
<br />
<h3 class="fn"><a name="StyleStrategy-enum" />QFont.StyleStrategy</h3><p>The style strategy tells the <a href="qfont.html">font matching</a> algorithm what type of fonts should be used to find an appropriate default family.</p>
<p>The following strategies are available:</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QFont.PreferDefault</tt></td>
<td align="center" valign="top"><tt>0x0001</tt></td>
<td valign="top">the default style strategy. It does not prefer any type of font.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.PreferBitmap</tt></td>
<td align="center" valign="top"><tt>0x0002</tt></td>
<td valign="top">prefers bitmap fonts (as opposed to outline fonts).</td>
</tr>
<tr>
<td valign="top"><tt>QFont.PreferDevice</tt></td>
<td align="center" valign="top"><tt>0x0004</tt></td>
<td valign="top">prefers device fonts.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.PreferOutline</tt></td>
<td align="center" valign="top"><tt>0x0008</tt></td>
<td valign="top">prefers outline fonts (as opposed to bitmap fonts).</td>
</tr>
<tr>
<td valign="top"><tt>QFont.ForceOutline</tt></td>
<td align="center" valign="top"><tt>0x0010</tt></td>
<td valign="top">forces the use of outline fonts.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.NoAntialias</tt></td>
<td align="center" valign="top"><tt>0x0100</tt></td>
<td valign="top">don't antialias the fonts.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.PreferAntialias</tt></td>
<td align="center" valign="top"><tt>0x0080</tt></td>
<td valign="top">antialias if possible.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.OpenGLCompatible</tt></td>
<td align="center" valign="top"><tt>0x0200</tt></td>
<td valign="top">forces the use of OpenGL compatible fonts.</td>
</tr>
</table>
<br />
<br />
<p>Any of these may be OR-ed with one of these flags:</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QFont.PreferMatch</tt></td>
<td align="center" valign="top"><tt>0x0020</tt></td>
<td valign="top">prefer an exact match. The font matcher will try to use the exact font size that has been specified.</td>
</tr>
<tr>
<td valign="top"><tt>QFont.PreferQuality</tt></td>
<td align="center" valign="top"><tt>0x0040</tt></td>
<td valign="top">prefer the best quality font. The font matcher will use the nearest standard point size that the font supports.</td>
</tr>
</table>
<br />
<br />
<h3 class="fn"><a name="Weight-enum" />QFont.Weight</h3><p>Qt uses a weighting scale from 0 to 99 similar to, but not the same as, the scales used in Windows or CSS. A weight of 0 is ultralight, whilst 99 will be an extremely black.</p>
<p>This enum contains the predefined font weights:</p>
<table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr>
<th width="25%">Constant</th>
<th width="15%">Value</th>
<th width="60%">Description</th>
</tr>
<tr>
<td valign="top"><tt>QFont.Light</tt></td>
<td align="center" valign="top"><tt>25</tt></td>
<td valign="top">25</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Normal</tt></td>
<td align="center" valign="top"><tt>50</tt></td>
<td valign="top">50</td>
</tr>
<tr>
<td valign="top"><tt>QFont.DemiBold</tt></td>
<td align="center" valign="top"><tt>63</tt></td>
<td valign="top">63</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Bold</tt></td>
<td align="center" valign="top"><tt>75</tt></td>
<td valign="top">75</td>
</tr>
<tr>
<td valign="top"><tt>QFont.Black</tt></td>
<td align="center" valign="top"><tt>87</tt></td>
<td valign="top">87</td>
</tr>
</table>
<br />
<br />
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFont" />QFont.__init__ (<i>self</i>)</h3><p>Constructs a font object that uses the application's default font.</p>
<p>See also <a href="qapplication.html#setFont">QApplication.setFont</a>() and <a href="qapplication.html#font">QApplication.font</a>().</p>
<h3 class="fn"><a name="QFont-2" />QFont.__init__ (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>family</i>, int&#160;<i>pointSize</i>&#160;=&#160;-1, int&#160;<i>weight</i>&#160;=&#160;-1, bool&#160;<i>italic</i>&#160;=&#160;False)</h3><p>Constructs a font object with the specified <i>family</i>, <i>pointSize</i>, <i>weight</i> and <i>italic</i> settings.</p>
<p>If <i>pointSize</i> is &lt;= 0, it is set to 12.</p>
<p>The <i>family</i> name may optionally also include a foundry name, e.g. "Helvetica [Cronyx]". If the <i>family</i> is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. If the family isn't available a family will be set using the <a href="qfont.html">font matching</a> algorithm.</p>
<p>See also <a href="qfont.html#Weight-enum">Weight</a>, <a href="qfont.html#setFamily">setFamily</a>(), <a href="qfont.html#setPointSize">setPointSize</a>(), <a href="qfont.html#setWeight">setWeight</a>(), <a href="qfont.html#setItalic">setItalic</a>(), <a href="qfont.html#setStyleHint">setStyleHint</a>(), and <a href="qapplication.html#font">QApplication.font</a>().</p>
<h3 class="fn"><a name="QFont-3" />QFont.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>, <a href="qpaintdevice.html">QPaintDevice</a>&#160;<i>pd</i>)</h3><p>Constructs a font from <i>font</i> for use on the paint device <i>pd</i>.</p>
<h3 class="fn"><a name="QFont-4" />QFont.__init__ (<i>self</i>, <a href="qvariant.html">QVariant</a>)</h3><p>Constructs a font that is a copy of <i>font</i>.</p>
<h3 class="fn"><a name="QFont-5" />QFont.__init__ (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><h3 class="fn"><a name="bold" />bool QFont.bold (<i>self</i>)</h3><p>Returns true if <a href="qfont.html#weight">weight</a>() is a value greater than <a href="qfont.html#Weight-enum">QFont.Normal</a>; otherwise returns false.</p>
<p>See also <a href="qfont.html#weight">weight</a>(), <a href="qfont.html#setBold">setBold</a>(), and <a href="qfontinfo.html#bold">QFontInfo.bold</a>().</p>
<h3 class="fn"><a name="cacheStatistics" />QFont.cacheStatistics ()</h3><h3 class="fn"><a name="cleanup" />QFont.cleanup ()</h3><h3 class="fn"><a name="defaultFamily" /><a href="qstring.html">QString</a> QFont.defaultFamily (<i>self</i>)</h3><p>Returns the family name that corresponds to the current style hint.</p>
<p>See also <a href="qfont.html#StyleHint-enum">StyleHint</a>, <a href="qfont.html#styleHint">styleHint</a>(), and <a href="qfont.html#setStyleHint">setStyleHint</a>().</p>
<h3 class="fn"><a name="exactMatch" />bool QFont.exactMatch (<i>self</i>)</h3><p>Returns true if a window system font exactly matching the settings of this font is available.</p>
<p>See also <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="family" /><a href="qstring.html">QString</a> QFont.family (<i>self</i>)</h3><p>Returns the requested font family name, i.e. the name set in the constructor or the last setFont() call.</p>
<p>See also <a href="qfont.html#setFamily">setFamily</a>(), <a href="qfont.html#substitutes">substitutes</a>(), and <a href="qfont.html#substitute">substitute</a>().</p>
<h3 class="fn"><a name="fixedPitch" />bool QFont.fixedPitch (<i>self</i>)</h3><p>Returns true if fixed pitch has been set; otherwise returns false.</p>
<p>See also <a href="qfont.html#setFixedPitch">setFixedPitch</a>() and <a href="qfontinfo.html#fixedPitch">QFontInfo.fixedPitch</a>().</p>
<h3 class="fn"><a name="fromString" />bool QFont.fromString (<i>self</i>, <a href="qstring.html">QString</a>)</h3><p>Sets this font to match the description <i>descrip</i>. The description is a comma-separated list of the font attributes, as returned by <a href="qfont.html#toString">toString</a>().</p>
<p>See also <a href="qfont.html#toString">toString</a>().</p>
<h3 class="fn"><a name="handle" />unsigned long QFont.handle (<i>self</i>)</h3><p>Returns the window system handle to the font, for low-level access. Using this function is <i>not</i> portable.</p>
<h3 class="fn"><a name="initialize" />QFont.initialize ()</h3><h3 class="fn"><a name="insertSubstitution" />QFont.insertSubstitution (<a href="qstring.html">QString</a>, <a href="qstring.html">QString</a>)</h3><p>Inserts <i>substituteName</i> into the substitution table for the family <i>familyName</i>.</p>
<p>See also <a href="qfont.html#insertSubstitutions">insertSubstitutions</a>(), <a href="qfont.html#removeSubstitution">removeSubstitution</a>(), <a href="qfont.html#substitutions">substitutions</a>(), <a href="qfont.html#substitute">substitute</a>(), and <a href="qfont.html#substitutes">substitutes</a>().</p>
<h3 class="fn"><a name="insertSubstitutions" />QFont.insertSubstitutions (<a href="qstring.html">QString</a>, <a href="qstringlist.html">QStringList</a>)</h3><p>Inserts the list of families <i>substituteNames</i> into the substitution list for <i>familyName</i>.</p>
<p>See also <a href="qfont.html#insertSubstitution">insertSubstitution</a>(), <a href="qfont.html#removeSubstitution">removeSubstitution</a>(), <a href="qfont.html#substitutions">substitutions</a>(), and <a href="qfont.html#substitute">substitute</a>().</p>
<h3 class="fn"><a name="isCopyOf" />bool QFont.isCopyOf (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><p>Returns true if this font and <i>f</i> are copies of each other, i.e. one of them was created as a copy of the other and neither has been modified since. This is much stricter than equality.</p>
<p>See also <a href="qfont.html#operator-eq">operator=</a>() and <a href="qfont.html#operator-eq-eq">operator==</a>().</p>
<h3 class="fn"><a name="italic" />bool QFont.italic (<i>self</i>)</h3><p>Returns true if the <a href="qfont.html#style">style</a>() of the font is not <a href="qfont.html#Style-enum">QFont.StyleNormal</a></p>
<p>See also <a href="qfont.html#setItalic">setItalic</a>() and <a href="qfont.html#style">style</a>().</p>
<h3 class="fn"><a name="kerning" />bool QFont.kerning (<i>self</i>)</h3><p>Returns true if kerning should be used when drawing text with this font.</p>
<p>See also <a href="qfont.html#setKerning">setKerning</a>().</p>
<h3 class="fn"><a name="key" /><a href="qstring.html">QString</a> QFont.key (<i>self</i>)</h3><p>Returns the font's key, a textual representation of a font. It is typically used as the key for a cache or dictionary of fonts.</p>
<p>See also <a href="qmap.html">QMap</a>.</p>
<h3 class="fn"><a name="lastResortFamily" /><a href="qstring.html">QString</a> QFont.lastResortFamily (<i>self</i>)</h3><p>Returns the "last resort" font family name.</p>
<p>The current implementation tries a wide variety of common fonts, returning the first one it finds. Is is possible that no family is found in which case an empty string is returned.</p>
<p>See also <a href="qfont.html#lastResortFont">lastResortFont</a>().</p>
<h3 class="fn"><a name="lastResortFont" /><a href="qstring.html">QString</a> QFont.lastResortFont (<i>self</i>)</h3><p>Returns a "last resort" font name for the font matching algorithm. This is used if the last resort family is not available. It will always return a name, if necessary returning something like "fixed" or "system".</p>
<p>The current implementation tries a wide variety of common fonts, returning the first one it finds. The implementation may change at any time, but this function will always return a string containing something.</p>
<p>It is theoretically possible that there really isn't a lastResortFont() in which case Qt will abort with an error message. We have not been able to identify a case where this happens. Please <a href="bughowto.html">report it as a bug</a> if it does, preferably with a list of the fonts you have installed.</p>
<p>See also <a href="qfont.html#lastResortFamily">lastResortFamily</a>() and <a href="qfont.html#rawName">rawName</a>().</p>
<h3 class="fn"><a name="overline" />bool QFont.overline (<i>self</i>)</h3><p>Returns true if overline has been set; otherwise returns false.</p>
<p>See also <a href="qfont.html#setOverline">setOverline</a>().</p>
<h3 class="fn"><a name="pixelSize" />int QFont.pixelSize (<i>self</i>)</h3><p>Returns the pixel size of the font if it was set with <a href="qfont.html#setPixelSize">setPixelSize</a>(). Returns -1 if the size was set with <a href="qfont.html#setPointSize">setPointSize</a>() or <a href="qfont.html#setPointSizeF">setPointSizeF</a>().</p>
<p>See also <a href="qfont.html#setPixelSize">setPixelSize</a>(), <a href="qfont.html#pointSize">pointSize</a>(), <a href="qfontinfo.html#pointSize">QFontInfo.pointSize</a>(), and <a href="qfontinfo.html#pixelSize">QFontInfo.pixelSize</a>().</p>
<h3 class="fn"><a name="pointSize" />int QFont.pointSize (<i>self</i>)</h3><p>Returns the point size of the font. Returns -1 if the font size was specified in pixels.</p>
<p>See also <a href="qfont.html#setPointSize">setPointSize</a>() and <a href="qfont.html#pointSizeF">pointSizeF</a>().</p>
<h3 class="fn"><a name="pointSizeF" />float QFont.pointSizeF (<i>self</i>)</h3><p>Returns the point size of the font. Returns -1 if the font size was specified in pixels.</p>
<p>See also <a href="qfont.html#pointSize">pointSize</a>(), <a href="qfont.html#setPointSizeF">setPointSizeF</a>(), <a href="qfont.html#pixelSize">pixelSize</a>(), <a href="qfontinfo.html#pointSize">QFontInfo.pointSize</a>(), and <a href="qfontinfo.html#pixelSize">QFontInfo.pixelSize</a>().</p>
<h3 class="fn"><a name="rawMode" />bool QFont.rawMode (<i>self</i>)</h3><p>Returns true if raw mode is used for font name matching; otherwise returns false.</p>
<p>See also <a href="qfont.html#setRawMode">setRawMode</a>() and <a href="qfont.html#rawName">rawName</a>().</p>
<h3 class="fn"><a name="rawName" /><a href="qstring.html">QString</a> QFont.rawName (<i>self</i>)</h3><p>Returns the name of the font within the underlying window system.</p>
<p>On Windows and Mac OS X, this is usually just the family name of a TrueType font.</p>
<p>On X11, depending on whether Qt was built with FontConfig support, it is an XLFD (X Logical Font Description) or a FontConfig pattern. An XLFD may be returned even if FontConfig support is enabled..</p>
<p>Using the return value of this function is usually <i>not</i> <i>portable</i>.</p>
<p>See also <a href="qfont.html#setRawName">setRawName</a>().</p>
<h3 class="fn"><a name="removeSubstitution" />QFont.removeSubstitution (<a href="qstring.html">QString</a>)</h3><p>Removes all the substitutions for <i>familyName</i>.</p>
<p>See also <a href="qfont.html#insertSubstitutions">insertSubstitutions</a>(), <a href="qfont.html#insertSubstitution">insertSubstitution</a>(), <a href="qfont.html#substitutions">substitutions</a>(), and <a href="qfont.html#substitute">substitute</a>().</p>
<h3 class="fn"><a name="resolve" /><a href="qfont.html">QFont</a> QFont.resolve (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><p>Returns a new <a href="qfont.html">QFont</a> that has attributes copied from <i>other</i>.</p>
<h3 class="fn"><a name="setBold" />QFont.setBold (<i>self</i>, bool&#160;<i>enable</i>)</h3><p>If <i>enable</i> is true sets the font's weight to <a href="qfont.html#Weight-enum">QFont.Bold</a>; otherwise sets the weight to <a href="qfont.html#Weight-enum">QFont.Normal</a>.</p>
<p>For finer boldness control use <a href="qfont.html#setWeight">setWeight</a>().</p>
<p>See also <a href="qfont.html#bold">bold</a>() and <a href="qfont.html#setWeight">setWeight</a>().</p>
<h3 class="fn"><a name="setFamily" />QFont.setFamily (<i>self</i>, <a href="qstring.html">QString</a>)</h3><p>Sets the family name of the font. The name is case insensitive and may include a foundry name.</p>
<p>The <i>family</i> name may optionally also include a foundry name, e.g. "Helvetica [Cronyx]". If the <i>family</i> is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. If the family isn't available a family will be set using the <a href="qfont.html">font matching</a> algorithm.</p>
<p>See also <a href="qfont.html#family">family</a>(), <a href="qfont.html#setStyleHint">setStyleHint</a>(), and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="setFixedPitch" />QFont.setFixedPitch (<i>self</i>, bool)</h3><p>If <i>enable</i> is true, sets fixed pitch on; otherwise sets fixed pitch off.</p>
<p>See also <a href="qfont.html#fixedPitch">fixedPitch</a>() and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="setItalic" />QFont.setItalic (<i>self</i>, bool&#160;<i>b</i>)</h3><p>Sets the <a href="qfont.html#style">style</a>() of the font to <a href="qfont.html#Style-enum">QFont.StyleItalic</a> if <i>enable</i> is true; otherwise the style is set to <a href="qfont.html#Style-enum">QFont.StyleNormal</a>.</p>
<p>See also <a href="qfont.html#italic">italic</a>() and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="setKerning" />QFont.setKerning (<i>self</i>, bool)</h3><p>Enables kerning for this font if <i>enable</i> is true; otherwise disables it. By default, kerning is enabled.</p>
<p>When kerning is enabled, glyph metrics do not add up anymore, even for Latin text. In other words, the assumption that width('a') + width('b') is equal to width("ab") is not neccesairly true.</p>
<p>See also <a href="qfont.html#kerning">kerning</a>() and <a href="qfontmetrics.html">QFontMetrics</a>.</p>
<h3 class="fn"><a name="setOverline" />QFont.setOverline (<i>self</i>, bool)</h3><p>If <i>enable</i> is true, sets overline on; otherwise sets overline off.</p>
<p>See also <a href="qfont.html#overline">overline</a>() and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="setPixelSize" />QFont.setPixelSize (<i>self</i>, int)</h3><p>Sets the font size to <i>pixelSize</i> pixels.</p>
<p>Using this function makes the font device dependent. Use <a href="qfont.html#setPointSize">setPointSize</a>() or <a href="qfont.html#setPointSizeF">setPointSizeF</a>() to set the size of the font in a device independent manner.</p>
<p>See also <a href="qfont.html#pixelSize">pixelSize</a>().</p>
<h3 class="fn"><a name="setPointSize" />QFont.setPointSize (<i>self</i>, int)</h3><p>Sets the point size to <i>pointSize</i>. The point size must be greater than zero.</p>
<p>See also <a href="qfont.html#pointSize">pointSize</a>() and <a href="qfont.html#setPointSizeF">setPointSizeF</a>().</p>
<h3 class="fn"><a name="setPointSizeF" />QFont.setPointSizeF (<i>self</i>, float)</h3><p>Sets the point size to <i>pointSize</i>. The point size must be greater than zero. The requested precision may not be achieved on all platforms.</p>
<p>See also <a href="qfont.html#pointSizeF">pointSizeF</a>(), <a href="qfont.html#setPointSize">setPointSize</a>(), and <a href="qfont.html#setPixelSize">setPixelSize</a>().</p>
<h3 class="fn"><a name="setRawMode" />QFont.setRawMode (<i>self</i>, bool)</h3><p>If <i>enable</i> is true, turns raw mode on; otherwise turns raw mode off. This function only has an effect under X11.</p>
<p>If raw mode is enabled, Qt will search for an X font with a complete font name matching the family name, ignoring all other values set for the <a href="qfont.html">QFont</a>. If the font name matches several fonts, Qt will use the first font returned by X. <a href="qfontinfo.html">QFontInfo</a> <i>cannot</i> be used to fetch information about a <a href="qfont.html">QFont</a> using raw mode (it will return the values set in the <a href="qfont.html">QFont</a> for all parameters, including the family name).</p>
<p><b>Warning:</b> Do not use raw mode unless you really, really need it! In most (if not all) cases, <a href="qfont.html#setRawName">setRawName</a>() is a much better choice.</p>
<p>See also <a href="qfont.html#rawMode">rawMode</a>() and <a href="qfont.html#setRawName">setRawName</a>().</p>
<h3 class="fn"><a name="setRawName" />QFont.setRawName (<i>self</i>, <a href="qstring.html">QString</a>)</h3><p>Sets a font by its system specific name. The function is particularly useful under X, where system font settings (for example X resources) are usually available in XLFD (X Logical Font Description) form only. You can pass an XLFD as <i>name</i> to this function.</p>
<p>A font set with setRawName() is still a full-featured <a href="qfont.html">QFont</a>. It can be queried (for example with <a href="qfont.html#italic">italic</a>()) or modified (for example with <a href="qfont.html#setItalic">setItalic</a>()) and is therefore also suitable for rendering rich text.</p>
<p>If Qt's internal font database cannot resolve the raw name, the font becomes a raw font with <i>name</i> as its family.</p>
<p>Note that the present implementation does not handle wildcards in XLFDs well, and that font aliases (file <tt>fonts.alias</tt> in the font directory on X11) are not supported.</p>
<p>See also <a href="qfont.html#rawName">rawName</a>(), <a href="qfont.html#setRawMode">setRawMode</a>(), and <a href="qfont.html#setFamily">setFamily</a>().</p>
<h3 class="fn"><a name="setStretch" />QFont.setStretch (<i>self</i>, int)</h3><p>Sets the stretch factor for the font.</p>
<p>The stretch factor changes the width of all characters in the font by <i>factor</i> percent. For example, setting <i>factor</i> to 150 results in all characters in the font being 1.5 times (ie. 150%) wider. The default stretch factor is 100. The minimum stretch factor is 1, and the maximum stretch factor is 4000.</p>
<p>The stretch factor is only applied to outline fonts. The stretch factor is ignored for bitmap fonts.</p>
<p>NOTE: <a href="qfont.html">QFont</a> cannot stretch XLFD fonts. When loading XLFD fonts on X11, the stretch factor is matched against a predefined set of values for the SETWIDTH_NAME field of the XLFD.</p>
<p>See also <a href="qfont.html#stretch">stretch</a>() and <a href="qfont.html#Stretch-enum">QFont.Stretch</a>.</p>
<h3 class="fn"><a name="setStrikeOut" />QFont.setStrikeOut (<i>self</i>, bool)</h3><p>If <i>enable</i> is true, sets strikeout on; otherwise sets strikeout off.</p>
<p>See also <a href="qfont.html#strikeOut">strikeOut</a>() and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="setStyle" />QFont.setStyle (<i>self</i>, <a href="qfont.html#Style-enum">Style</a>&#160;<i>style</i>)</h3><p>Sets the style of the font to <i>style</i>.</p>
<p>See also <a href="qfont.html#style">style</a>(), <a href="qfont.html#italic">italic</a>(), and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="setStyleHint" />QFont.setStyleHint (<i>self</i>, <a href="qfont.html#StyleHint-enum">StyleHint</a>, <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a>&#160;=&#160;QFont.PreferDefault)</h3><p>Sets the style hint and strategy to <i>hint</i> and <i>strategy</i>, respectively.</p>
<p>If these aren't set explicitly the style hint will default to <tt>AnyStyle</tt> and the style strategy to <tt>PreferDefault</tt>.</p>
<p>Qt does not support style hints on X11 since this information is not provided by the window system.</p>
<p>See also <a href="qfont.html#StyleHint-enum">StyleHint</a>, <a href="qfont.html#styleHint">styleHint</a>(), <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a>, <a href="qfont.html#styleStrategy">styleStrategy</a>(), and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="setStyleStrategy" />QFont.setStyleStrategy (<i>self</i>, <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a>&#160;<i>s</i>)</h3><p>Sets the style strategy for the font to <i>s</i>.</p>
<p>See also <a href="qfont.html#styleStrategy">styleStrategy</a>() and <a href="qfont.html#StyleStrategy-enum">QFont.StyleStrategy</a>.</p>
<h3 class="fn"><a name="setUnderline" />QFont.setUnderline (<i>self</i>, bool)</h3><p>If <i>enable</i> is true, sets underline on; otherwise sets underline off.</p>
<p>See also <a href="qfont.html#underline">underline</a>() and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="setWeight" />QFont.setWeight (<i>self</i>, int)</h3><p>Sets the weight the font to <i>weight</i>, which should be a value from the <a href="qfont.html#Weight-enum">QFont.Weight</a> enumeration.</p>
<p>See also <a href="qfont.html#weight">weight</a>() and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="stretch" />int QFont.stretch (<i>self</i>)</h3><p>Returns the stretch factor for the font.</p>
<p>See also <a href="qfont.html#setStretch">setStretch</a>().</p>
<h3 class="fn"><a name="strikeOut" />bool QFont.strikeOut (<i>self</i>)</h3><p>Returns true if strikeout has been set; otherwise returns false.</p>
<p>See also <a href="qfont.html#setStrikeOut">setStrikeOut</a>().</p>
<h3 class="fn"><a name="style" /><a href="qfont.html#Style-enum">Style</a> QFont.style (<i>self</i>)</h3><p>Returns the style of the font.</p>
<p>See also <a href="qfont.html#setStyle">setStyle</a>().</p>
<h3 class="fn"><a name="styleHint" /><a href="qfont.html#StyleHint-enum">StyleHint</a> QFont.styleHint (<i>self</i>)</h3><p>Returns the <a href="qfont.html#StyleHint-enum">StyleHint</a>.</p>
<p>The style hint affects the <a href="qfont.html">font matching</a> algorithm. See <a href="qfont.html#StyleHint-enum">QFont.StyleHint</a> for the list of available hints.</p>
<p>See also <a href="qfont.html#setStyleHint">setStyleHint</a>(), <a href="qfont.html#StyleStrategy-enum">QFont.StyleStrategy</a>, and <a href="qfontinfo.html#styleHint">QFontInfo.styleHint</a>().</p>
<h3 class="fn"><a name="styleStrategy" /><a href="qfont.html#StyleStrategy-enum">StyleStrategy</a> QFont.styleStrategy (<i>self</i>)</h3><p>Returns the <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a>.</p>
<p>The style strategy affects the <a href="qfont.html">font matching</a> algorithm. See <a href="qfont.html#StyleStrategy-enum">QFont.StyleStrategy</a> for the list of available strategies.</p>
<p>See also <a href="qfont.html#setStyleStrategy">setStyleStrategy</a>(), <a href="qfont.html#setStyleHint">setStyleHint</a>(), and <a href="qfont.html#StyleHint-enum">QFont.StyleHint</a>.</p>
<h3 class="fn"><a name="substitute" /><a href="qstring.html">QString</a> QFont.substitute (<a href="qstring.html">QString</a>)</h3><p>Returns the first family name to be used whenever <i>familyName</i> is specified. The lookup is case insensitive.</p>
<p>If there is no substitution for <i>familyName</i>, <i>familyName</i> is returned.</p>
<p>To obtain a list of substitutions use <a href="qfont.html#substitutes">substitutes</a>().</p>
<p>See also <a href="qfont.html#setFamily">setFamily</a>(), <a href="qfont.html#insertSubstitutions">insertSubstitutions</a>(), <a href="qfont.html#insertSubstitution">insertSubstitution</a>(), and <a href="qfont.html#removeSubstitution">removeSubstitution</a>().</p>
<h3 class="fn"><a name="substitutes" /><a href="qstringlist.html">QStringList</a> QFont.substitutes (<a href="qstring.html">QString</a>)</h3><p>Returns a list of family names to be used whenever <i>familyName</i> is specified. The lookup is case insensitive.</p>
<p>If there is no substitution for <i>familyName</i>, an empty list is returned.</p>
<p>See also <a href="qfont.html#substitute">substitute</a>(), <a href="qfont.html#insertSubstitutions">insertSubstitutions</a>(), <a href="qfont.html#insertSubstitution">insertSubstitution</a>(), and <a href="qfont.html#removeSubstitution">removeSubstitution</a>().</p>
<h3 class="fn"><a name="substitutions" /><a href="qstringlist.html">QStringList</a> QFont.substitutions ()</h3><p>Returns a sorted list of substituted family names.</p>
<p>See also <a href="qfont.html#insertSubstitution">insertSubstitution</a>(), <a href="qfont.html#removeSubstitution">removeSubstitution</a>(), and <a href="qfont.html#substitute">substitute</a>().</p>
<h3 class="fn"><a name="toString" /><a href="qstring.html">QString</a> QFont.toString (<i>self</i>)</h3><p>Returns a description of the font. The description is a comma-separated list of the attributes, perfectly suited for use in <a href="qsettings.html">QSettings</a>.</p>
<p>See also <a href="qfont.html#fromString">fromString</a>().</p>
<h3 class="fn"><a name="underline" />bool QFont.underline (<i>self</i>)</h3><p>Returns true if underline has been set; otherwise returns false.</p>
<p>See also <a href="qfont.html#setUnderline">setUnderline</a>().</p>
<h3 class="fn"><a name="weight" />int QFont.weight (<i>self</i>)</h3><p>Returns the weight of the font which is one of the enumerated values from <a href="qfont.html#Weight-enum">QFont.Weight</a>.</p>
<p>See also <a href="qfont.html#setWeight">setWeight</a>(), <a href="qfont.html#Weight-enum">Weight</a>, and <a href="qfontinfo.html">QFontInfo</a>.</p>
<h3 class="fn"><a name="__eq__" />bool QFont.__eq__ (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><h3 class="fn"><a name="__lt__" />bool QFont.__lt__ (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><h3 class="fn"><a name="__ne__" />bool QFont.__ne__ (<i>self</i>, <a href="qfont.html">QFont</a>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>