source: trunk/doc/html/qfont.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 55.6 KB
RevLine 
[190]1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qfont.cpp:236 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QFont Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QFont Class Reference</h1>
33
34<p>The QFont class specifies a font used for drawing text.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qfont-h.html">qfont.h</a>&gt;</tt>
37<p><a href="qfont-members.html">List of all member functions.</a>
38<h2>Public Members</h2>
39<ul>
40<li class=fn>enum <a href="#StyleHint-enum"><b>StyleHint</b></a> { Helvetica, SansSerif = Helvetica, Times, Serif = Times, Courier, TypeWriter = Courier, OldEnglish, Decorative = OldEnglish, System, AnyStyle }</li>
41<li class=fn>enum <a href="#StyleStrategy-enum"><b>StyleStrategy</b></a> { PreferDefault = 0x0001, PreferBitmap = 0x0002, PreferDevice = 0x0004, PreferOutline = 0x0008, ForceOutline = 0x0010, PreferMatch = 0x0020, PreferQuality = 0x0040, PreferAntialias = 0x0080, NoAntialias = 0x0100, OpenGLCompatible = 0x0200 }</li>
42<li class=fn>enum <a href="#Weight-enum"><b>Weight</b></a> { Light = 25, Normal = 50, DemiBold = 63, Bold = 75, Black = 87 }</li>
43<li class=fn>enum <a href="#Stretch-enum"><b>Stretch</b></a> { UltraCondensed = 50, ExtraCondensed = 62, Condensed = 75, SemiCondensed = 87, Unstretched = 100, SemiExpanded = 112, Expanded = 125, ExtraExpanded = 150, UltraExpanded = 200 }</li>
44<li class=fn><a href="#QFont"><b>QFont</b></a> ()</li>
45<li class=fn><a href="#QFont-2"><b>QFont</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;family, int&nbsp;pointSize = 12, int&nbsp;weight = Normal, bool&nbsp;italic = FALSE )</li>
46<li class=fn><a href="#QFont-3"><b>QFont</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;font )</li>
47<li class=fn><a href="#~QFont"><b>~QFont</b></a> ()</li>
48<li class=fn>QString <a href="#family"><b>family</b></a> () const</li>
49<li class=fn>void <a href="#setFamily"><b>setFamily</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;family )</li>
50<li class=fn>int <a href="#pointSize"><b>pointSize</b></a> () const</li>
51<li class=fn>float <a href="#pointSizeFloat"><b>pointSizeFloat</b></a> () const</li>
52<li class=fn>void <a href="#setPointSize"><b>setPointSize</b></a> ( int&nbsp;pointSize )</li>
53<li class=fn>void <a href="#setPointSizeFloat"><b>setPointSizeFloat</b></a> ( float&nbsp;pointSize )</li>
54<li class=fn>int <a href="#pixelSize"><b>pixelSize</b></a> () const</li>
55<li class=fn>void <a href="#setPixelSize"><b>setPixelSize</b></a> ( int&nbsp;pixelSize )</li>
56<li class=fn>void setPixelSizeFloat ( float&nbsp;pixelSize ) &nbsp;<em>(obsolete)</em></li>
57<li class=fn>int <a href="#weight"><b>weight</b></a> () const</li>
58<li class=fn>void <a href="#setWeight"><b>setWeight</b></a> ( int&nbsp;weight )</li>
59<li class=fn>bool <a href="#bold"><b>bold</b></a> () const</li>
60<li class=fn>void <a href="#setBold"><b>setBold</b></a> ( bool&nbsp;enable )</li>
61<li class=fn>bool <a href="#italic"><b>italic</b></a> () const</li>
62<li class=fn>void <a href="#setItalic"><b>setItalic</b></a> ( bool&nbsp;enable )</li>
63<li class=fn>bool <a href="#underline"><b>underline</b></a> () const</li>
64<li class=fn>void <a href="#setUnderline"><b>setUnderline</b></a> ( bool&nbsp;enable )</li>
65<li class=fn>bool <a href="#overline"><b>overline</b></a> () const</li>
66<li class=fn>void <a href="#setOverline"><b>setOverline</b></a> ( bool&nbsp;enable )</li>
67<li class=fn>bool <a href="#strikeOut"><b>strikeOut</b></a> () const</li>
68<li class=fn>void <a href="#setStrikeOut"><b>setStrikeOut</b></a> ( bool&nbsp;enable )</li>
69<li class=fn>bool <a href="#fixedPitch"><b>fixedPitch</b></a> () const</li>
70<li class=fn>void <a href="#setFixedPitch"><b>setFixedPitch</b></a> ( bool&nbsp;enable )</li>
71<li class=fn>StyleHint <a href="#styleHint"><b>styleHint</b></a> () const</li>
72<li class=fn>StyleStrategy <a href="#styleStrategy"><b>styleStrategy</b></a> () const</li>
73<li class=fn>void <a href="#setStyleHint"><b>setStyleHint</b></a> ( StyleHint&nbsp;hint, StyleStrategy&nbsp;strategy = PreferDefault )</li>
74<li class=fn>void <a href="#setStyleStrategy"><b>setStyleStrategy</b></a> ( StyleStrategy&nbsp;s )</li>
75<li class=fn>int <a href="#stretch"><b>stretch</b></a> () const</li>
76<li class=fn>void <a href="#setStretch"><b>setStretch</b></a> ( int&nbsp;factor )</li>
77<li class=fn>bool <a href="#rawMode"><b>rawMode</b></a> () const</li>
78<li class=fn>void <a href="#setRawMode"><b>setRawMode</b></a> ( bool&nbsp;enable )</li>
79<li class=fn>bool <a href="#exactMatch"><b>exactMatch</b></a> () const</li>
80<li class=fn>QFont &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;font )</li>
81<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;f ) const</li>
82<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;f ) const</li>
83<li class=fn>bool <a href="#isCopyOf"><b>isCopyOf</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;f ) const</li>
84<li class=fn>HFONT <a href="#handle"><b>handle</b></a> () const</li>
85<li class=fn>void <a href="#setRawName"><b>setRawName</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;name )</li>
86<li class=fn>QString <a href="#rawName"><b>rawName</b></a> () const</li>
87<li class=fn>QString <a href="#key"><b>key</b></a> () const</li>
88<li class=fn>QString <a href="#toString"><b>toString</b></a> () const</li>
89<li class=fn>bool <a href="#fromString"><b>fromString</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;descrip )</li>
90<li class=fn>void <a href="#qwsRenderToDisk"><b>qwsRenderToDisk</b></a> ( bool&nbsp;all = TRUE )</li>
91<li class=fn>enum <a href="#Script-enum"><b>Script</b></a> { Latin, Greek, Cyrillic, Armenian, Georgian, Runic, Ogham, SpacingModifiers, CombiningMarks, Hebrew, Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar, Khmer, Han, Hiragana, Katakana, Hangul, Bopomofo, Yi, Ethiopic, Cherokee, CanadianAboriginal, Mongolian, CurrencySymbols, LetterlikeSymbols, NumberForms, MathematicalOperators, TechnicalSymbols, GeometricSymbols, MiscellaneousSymbols, EnclosedAndSquare, Braille, Unicode, Tagalog, Hanunoo, Buhid, Tagbanwa, KatakanaHalfWidth, Limbu, TaiLe }</li>
92<li class=fn>QString <a href="#defaultFamily"><b>defaultFamily</b></a> () const</li>
93<li class=fn>QString <a href="#lastResortFamily"><b>lastResortFamily</b></a> () const</li>
94<li class=fn>QString <a href="#lastResortFont"><b>lastResortFont</b></a> () const</li>
95<li class=fn>QFont <a href="#resolve"><b>resolve</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;other ) const</li>
96</ul>
97<h2>Static Public Members</h2>
98<ul>
99<li class=fn>QString <a href="#substitute"><b>substitute</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;familyName )</li>
100<li class=fn>QStringList <a href="#substitutes"><b>substitutes</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;familyName )</li>
101<li class=fn>QStringList <a href="#substitutions"><b>substitutions</b></a> ()</li>
102<li class=fn>void <a href="#insertSubstitution"><b>insertSubstitution</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;familyName, const&nbsp;QString&nbsp;&amp;&nbsp;substituteName )</li>
103<li class=fn>void <a href="#insertSubstitutions"><b>insertSubstitutions</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;familyName, const&nbsp;QStringList&nbsp;&amp;&nbsp;substituteNames )</li>
104<li class=fn>void <a href="#removeSubstitution"><b>removeSubstitution</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;familyName )</li>
105<li class=fn>QFont defaultFont () &nbsp;<em>(obsolete)</em></li>
106<li class=fn>void setDefaultFont ( const&nbsp;QFont&nbsp;&amp;&nbsp;f ) &nbsp;<em>(obsolete)</em></li>
107</ul>
108<h2>Protected Members</h2>
109<ul>
110<li class=fn>bool <a href="#dirty"><b>dirty</b></a> () const</li>
111<li class=fn>int <a href="#deciPointSize"><b>deciPointSize</b></a> () const</li>
112</ul>
113<h2>Related Functions</h2>
114<ul>
115<li class=fn>QDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QFont&nbsp;&amp;&nbsp;font )</li>
116<li class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QFont&nbsp;&amp;&nbsp;font )</li>
117</ul>
118<hr><a name="details"></a><h2>Detailed Description</h2>
119
120
121The QFont class specifies a font used for drawing text.
122<p>
123
124
125
126<p> When you create a QFont object you specify various attributes that
127you want the font to have. Qt will use the font with the specified
128attributes, or if no matching font exists, Qt will use the closest
129matching installed font. The attributes of the font that is
130actually used are retrievable from a <a href="qfontinfo.html">QFontInfo</a> object. If the
131window system provides an exact match <a href="#exactMatch">exactMatch</a>() returns TRUE.
132Use <a href="qfontmetrics.html">QFontMetrics</a> to get measurements, e.g. the pixel length of a
133string using <a href="qfontmetrics.html#width">QFontMetrics::width</a>().
134<p> Use <a href="qapplication.html#setFont">QApplication::setFont</a>() to set the application's default font.
135<p> If a choosen X11 font does not include all the characters that
136need to be displayed, QFont will try to find the characters in the
137nearest equivalent fonts. When a <a href="qpainter.html">QPainter</a> draws a character from a
138font the QFont will report whether or not it has the character; if
139it does not, QPainter will draw an unfilled square.
140<p> Create QFonts like this:
141<pre>
142 QFont serifFont( "Times", 10, Bold );
143 QFont sansFont( "Helvetica [Cronyx]", 12 );
144 </pre>
145
146<p> The attributes set in the constructor can also be set later, e.g.
147<a href="#setFamily">setFamily</a>(), <a href="#setPointSize">setPointSize</a>(), <a href="#setPointSizeFloat">setPointSizeFloat</a>(), <a href="#setWeight">setWeight</a>() and
148<a href="#setItalic">setItalic</a>(). The remaining attributes must be set after
149contstruction, e.g. <a href="#setBold">setBold</a>(), <a href="#setUnderline">setUnderline</a>(), <a href="#setOverline">setOverline</a>(),
150<a href="#setStrikeOut">setStrikeOut</a>() and <a href="#setFixedPitch">setFixedPitch</a>(). <a href="qfontinfo.html">QFontInfo</a> objects should be
151created <em>after</em> the font's attributes have been set. A QFontInfo
152object will not change, even if you change the font's
153attributes. The corresponding "get" functions, e.g. <a href="#family">family</a>(),
154<a href="#pointSize">pointSize</a>(), etc., return the values that were set, even though
155the values used may differ. The actual values are available from a
156QFontInfo object.
157<p> If the requested font family is unavailable you can influence the
158<a href="#fontmatching">font matching algorithm</a> by choosing a
159particular <a href="#StyleHint-enum">QFont::StyleHint</a> and <a href="#StyleStrategy-enum">QFont::StyleStrategy</a> with
160<a href="#setStyleHint">setStyleHint</a>(). The default family (corresponding to the current
161style hint) is returned by <a href="#defaultFamily">defaultFamily</a>().
162<p> The font-matching algorithm has a <a href="#lastResortFamily">lastResortFamily</a>() and
163<a href="#lastResortFont">lastResortFont</a>() in cases where a suitable match cannot be found.
164You can provide substitutions for font family names using
165<a href="#insertSubstitution">insertSubstitution</a>() and <a href="#insertSubstitutions">insertSubstitutions</a>(). Substitutions can
166be removed with <a href="#removeSubstitution">removeSubstitution</a>(). Use <a href="#substitute">substitute</a>() to retrieve
167a family's first substitute, or the family name itself if it has
168no substitutes. Use <a href="#substitutes">substitutes</a>() to retrieve a list of a family's
169substitutes (which may be empty).
170<p> Every QFont has a <a href="#key">key</a>() which you can use, for example, as the key
171in a cache or dictionary. If you want to store a user's font
172preferences you could use <a href="qsettings.html">QSettings</a>, writing the font information
173with <a href="#toString">toString</a>() and reading it back with <a href="#fromString">fromString</a>(). The
174<a href="#operator-lt-lt">operator&lt;&lt;</a>() and <a href="#operator-gt-gt">operator&gt;&gt;</a>() functions are also available, but
175they work on a data stream.
176<p> It is possible to set the height of characters shown on the screen
177to a specified number of pixels with <a href="#setPixelSize">setPixelSize</a>(); however using
178<a href="#setPointSize">setPointSize</a>() has a similar effect and provides device
179independence.
180<p> Under the X Window System you can set a font using its system
181specific name with <a href="#setRawName">setRawName</a>().
182<p> Loading fonts can be expensive, especially on X11. QFont contains
183extensive optimizations to make the copying of QFont objects fast,
184and to cache the results of the slow window system functions it
185depends upon.
186<p> <a name="fontmatching"></a>
187The font matching algorithm works as follows:
188<ol type=1>
189<li> The specified font family is searched for.
190<li> If not found, the <a href="#styleHint">styleHint</a>() is used to select a replacement
191family.
192<li> Each replacement font family is searched for.
193<li> If none of these are found or there was no styleHint(), "helvetica"
194will be searched for.
195<li> If "helvetica" isn't found Qt will try the <a href="#lastResortFamily">lastResortFamily</a>().
196<li> If the lastResortFamily() isn't found Qt will try the
197<a href="#lastResortFont">lastResortFont</a>() which will always return a name of some kind.
198</ol>
199<p> Once a font is found, the remaining attributes are matched in order of
200priority:
201<ol type=1>
202<li> <a href="#fixedPitch">fixedPitch</a>()
203<li> <a href="#pointSize">pointSize</a>() (see below)
204<li> <a href="#weight">weight</a>()
205<li> <a href="#italic">italic</a>()
206</ol>
207<p> If you have a font which matches on family, even if none of the
208other attributes match, this font will be chosen in preference to
209a font which doesn't match on family but which does match on the
210other attributes. This is because font family is the dominant
211search criteria.
212<p> The point size is defined to match if it is within 20% of the
213requested point size. When several fonts match and are only
214distinguished by point size, the font with the closest point size
215to the one requested will be chosen.
216<p> The actual family, font size, weight and other font attributes
217used for drawing text will depend on what's available for the
218chosen family under the window system. A <a href="qfontinfo.html">QFontInfo</a> object can be
219used to determine the actual values used for drawing the text.
220<p> Examples:
221<p> <pre>
222 QFont f("Helvetica");
223 </pre>
224
225If you had both an Adobe and a Cronyx Helvetica, you might get
226either.
227<p> <pre>
228 QFont f1( "Helvetica [Cronyx]" ); // Qt 3.x
229 QFont f2( "Cronyx-Helvetica" ); // Qt 2.x compatibility
230 </pre>
231
232You can specify the foundry you want in the family name. Both fonts,
233f1 and f2, in the above example will be set to "Helvetica
234[Cronyx]".
235<p> To determine the attributes of the font actually used in the window
236system, use a QFontInfo object, e.g.
237<pre>
238 <a href="qfontinfo.html">QFontInfo</a> info( f1 );
239 <a href="qstring.html">QString</a> family = info.<a href="qfontinfo.html#family">family</a>();
240 </pre>
241
242<p> To find out font metrics use a <a href="qfontmetrics.html">QFontMetrics</a> object, e.g.
243<pre>
244 <a href="qfontmetrics.html">QFontMetrics</a> fm( f1 );
245 int pixelWidth = fm.<a href="qfontmetrics.html#width">width</a>( "How many pixels wide is this text?" );
246 int pixelHeight = fm.<a href="qfontmetrics.html#height">height</a>();
247 </pre>
248
249<p> For more general information on fonts, see the
250<a href="http://www.nwalsh.com/comp.fonts/FAQ/">comp.fonts FAQ.</a>
251Information on encodings can be found from
252<a href="http://czyborra.com/">Roman Czyborra's</a> page.
253<p> <p>See also <a href="qfontmetrics.html">QFontMetrics</a>, <a href="qfontinfo.html">QFontInfo</a>, <a href="qfontdatabase.html">QFontDatabase</a>, <a href="qapplication.html#setFont">QApplication::setFont</a>(), <a href="qwidget.html#font-prop">QWidget::font</a>, <a href="qpainter.html#setFont">QPainter::setFont</a>(), <a href="#StyleHint-enum">QFont::StyleHint</a>, <a href="#Weight-enum">QFont::Weight</a>, <a href="appearance.html">Widget Appearance and Style</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
254
255<hr><h2>Member Type Documentation</h2>
256<h3 class=fn><a name="Script-enum"></a>QFont::Script</h3>
257
258<p> This enum represents <a href="unicode.html">Unicode</a> allocated
259scripts. For exhaustive coverage see <a href="http://www.amazon.com/exec/obidos/ASIN/0201616335/trolltech/t">The
260 Unicode Standard Version 3.0</a>. The following scripts are
261supported:
262<p> Modern European alphabetic scripts (left to right):
263<ul>
264<li><tt>QFont::Latin</tt> - consists of most alphabets based on the original Latin alphabet.
265<li><tt>QFont::Greek</tt> - covers ancient and modern Greek and Coptic.
266<li><tt>QFont::Cyrillic</tt> - covers the Slavic and non-Slavic languages using
267cyrillic alphabets.
268<li><tt>QFont::Armenian</tt> - contains the Armenian alphabet used with the
269Armenian language.
270<li><tt>QFont::Georgian</tt> - covers at least the language Georgian.
271<li><tt>QFont::Runic</tt> - covers the known constituents of the Runic alphabets used
272by the early and medieval societies in the Germanic,
273Scandinavian, and Anglo-Saxon areas.
274<li><tt>QFont::Ogham</tt> - is an alphabetical script used to write a very early
275form of Irish.
276<li><tt>QFont::SpacingModifiers</tt> - are small signs indicating modifications
277to the preceeding letter.
278<li><tt>QFont::CombiningMarks</tt> - consist of diacritical marks not specific to
279a particular alphabet, diacritical marks used in
280combination with mathematical and technical symbols, and
281glyph encodings applied to multiple letterforms.
282</ul><p> Middle Eastern scripts (right to left):
283<ul>
284<li><tt>QFont::Hebrew</tt> - is used for writing Hebrew, Yiddish, and some other languages.
285<li><tt>QFont::Arabic</tt> - covers the Arabic language as well as Persian, Urdu,
286Kurdish and some others.
287<li><tt>QFont::Syriac</tt> - is used to write the active liturgical languages and
288dialects of several Middle Eastern and Southeast Indian
289communities.
290<li><tt>QFont::Thaana</tt> - is used to write the Maledivian Dhivehi language.
291</ul><p> South and Southeast Asian scripts (left to right with few historical exceptions):
292<ul>
293<li><tt>QFont::Devanagari</tt> - covers classical Sanskrit and modern Hindi as
294well as several other languages.
295<li><tt>QFont::Bengali</tt> - is a relative to Devanagari employed to write the
296Bengali language used in West Bengal/India and Bangladesh
297as well as several minority languages.
298<li><tt>QFont::Gurmukhi</tt> - is another Devanagari relative used to write Punjabi.
299<li><tt>QFont::Gujarati</tt> - is closely related to Devanagari and used to write
300the Gujarati language of the Gujarat state in India.
301<li><tt>QFont::Oriya</tt> - is used to write the Oriya language of Orissa state/India.
302<li><tt>QFont::Tamil</tt> - is used to write the Tamil language of Tamil Nadu state/India,
303Sri Lanka, Singapore and parts of Malaysia as well as some
304minority languages.
305<li><tt>QFont::Telugu</tt> - is used to write the Telugu language of Andhra
306Pradesh state/India and some minority languages.
307<li><tt>QFont::Kannada</tt> - is another South Indian script used to write the
308Kannada language of Karnataka state/India and some minority
309languages.
310<li><tt>QFont::Malayalam</tt> - is used to write the Malayalam language of Kerala
311state/India.
312<li><tt>QFont::Sinhala</tt> - is used for Sri Lanka's majority language Sinhala
313and is also employed to write Pali, Sanskrit, and Tamil.
314<li><tt>QFont::Thai</tt> - is used to write Thai and other Southeast Asian languages.
315<li><tt>QFont::Lao</tt> - is a language and script quite similar to Thai.
316<li><tt>QFont::Tibetan</tt> - is the script used to write Tibetan in several
317countries like Tibet, the bordering Indian regions and
318Nepal. It is also used in the Buddist philosophy and
319liturgy of the Mongolian cultural area.
320<li><tt>QFont::Myanmar</tt> - is mainly used to write the Burmese language of
321Myanmar (former Burma).
322<li><tt>QFont::Khmer</tt> - is the official language of Kampuchea.
323</ul><p> East Asian scripts (traditionally top-down, right to left, modern
324often horizontal left to right):
325<ul>
326<li><tt>QFont::Han</tt> - consists of the CJK (Chinese, Japanese, Korean)
327idiographic characters.
328<li><tt>QFont::Hiragana</tt> - is a cursive syllabary used to indicate phonetics
329and pronounciation of Japanese words.
330<li><tt>QFont::Katakana</tt> - is a non-cursive syllabic script used to write
331Japanese words with visual emphasis and non-Japanese words
332in a phonetical manner.
333<li><tt>QFont::Hangul</tt> - is a Korean script consisting of alphabetic components.
334<li><tt>QFont::Bopomofo</tt> - is a phonetic alphabet for Chinese (mainly Mandarin).
335<li><tt>QFont::Yi</tt> - (also called Cuan or Wei) is a syllabary used to write
336the Yi language of Southwestern China, Myanmar, Laos, and Vietnam.
337</ul><p> Additional scripts that do not fit well into the script categories above:
338<ul>
339<li><tt>QFont::Ethiopic</tt> - is a syllabary used by several Central East African languages.
340<li><tt>QFont::Cherokee</tt> - is a left-to-right syllabic script used to write
341the Cherokee language.
342<li><tt>QFont::CanadianAboriginal</tt> - consists of the syllabics used by some
343Canadian aboriginal societies.
344<li><tt>QFont::Mongolian</tt> - is the traditional (and recently reintroduced)
345script used to write Mongolian.
346</ul><p> Symbols:
347<ul>
348<li><tt>QFont::CurrencySymbols</tt> - contains currency symbols not encoded in other scripts.
349<li><tt>QFont::LetterlikeSymbols</tt> - consists of symbols derived from
350ordinary letters of an alphabetical script.
351<li><tt>QFont::NumberForms</tt> - are provided for compatibility with other
352existing character sets.
353<li><tt>QFont::MathematicalOperators</tt> - consists of encodings for operators,
354relations and other symbols like arrows used in a mathematical context.
355<li><tt>QFont::TechnicalSymbols</tt> - contains representations for control
356codes, the space symbol, APL symbols and other symbols
357mainly used in the context of electronic data processing.
358<li><tt>QFont::GeometricSymbols</tt> - covers block elements and geometric shapes.
359<li><tt>QFont::MiscellaneousSymbols</tt> - consists of a heterogeneous collection
360of symbols that do not fit any other Unicode character
361block, e.g. Dingbats.
362<li><tt>QFont::EnclosedAndSquare</tt> - is provided for compatibility with some
363East Asian standards.
364<li><tt>QFont::Braille</tt> - is an international writing system used by blind
365people. This script encodes the 256 eight-dot patterns with
366the 64 six-dot patterns as a subset.
367<li><tt>QFont::Tagalog</tt>
368<li><tt>QFont::Hanunoo</tt>
369<li><tt>QFont::Buhid</tt>
370<li><tt>QFont::Tagbanwa</tt>
371<li><tt>QFont::KatakanaHalfWidth</tt>
372<li><tt>QFont::Limbu</tt> - (Unicode 4.0)
373<li><tt>QFont::TaiLe</tt> - (Unicode 4.0)
374<li><tt>QFont::Unicode</tt> - includes all the above scripts.
375</ul>
376<h3 class=fn><a name="Stretch-enum"></a>QFont::Stretch</h3>
377
378<p> Predefined stretch values that follow the CSS naming convention.
379<ul>
380<li><tt>QFont::UltraCondensed</tt> - 50
381<li><tt>QFont::ExtraCondensed</tt> - 62
382<li><tt>QFont::Condensed</tt> - 75
383<li><tt>QFont::SemiCondensed</tt> - 87
384<li><tt>QFont::Unstretched</tt> - 100
385<li><tt>QFont::SemiExpanded</tt> - 112
386<li><tt>QFont::Expanded</tt> - 125
387<li><tt>QFont::ExtraExpanded</tt> - 150
388<li><tt>QFont::UltraExpanded</tt> - 200
389</ul><p> <p>See also <a href="#setStretch">setStretch</a>() and <a href="#stretch">stretch</a>().
390
391<h3 class=fn><a name="StyleHint-enum"></a>QFont::StyleHint</h3>
392
393<p> Style hints are used by the <a href="#fontmatching">font
394 matching</a> algorithm to find an appropriate default family
395if a selected font family is not available.
396<ul>
397<li><tt>QFont::AnyStyle</tt> - leaves the font matching algorithm to choose the
398family. This is the default.
399<li><tt>QFont::SansSerif</tt> - the font matcher prefer sans serif fonts.
400<li><tt>QFont::Helvetica</tt> - is a synonym for <a href="#StyleHint-enum">SansSerif</a>.
401<li><tt>QFont::Serif</tt> - the font matcher prefers serif fonts.
402<li><tt>QFont::Times</tt> - is a synonym for <a href="#StyleHint-enum">Serif</a>.
403<li><tt>QFont::TypeWriter</tt> - the font matcher prefers fixed pitch fonts.
404<li><tt>QFont::Courier</tt> - a synonym for <a href="#StyleHint-enum">TypeWriter</a>.
405<li><tt>QFont::OldEnglish</tt> - the font matcher prefers decorative fonts.
406<li><tt>QFont::Decorative</tt> - is a synonym for <a href="#StyleHint-enum">OldEnglish</a>.
407<li><tt>QFont::System</tt> - the font matcher prefers system fonts.
408</ul>
409<h3 class=fn><a name="StyleStrategy-enum"></a>QFont::StyleStrategy</h3>
410
411<p> The style strategy tells the <a href="#fontmatching">font
412 matching</a> algorithm what type of fonts should be used to
413find an appropriate default family.
414<p> The following strategies are available:
415<ul>
416<li><tt>QFont::PreferDefault</tt> - the default style strategy. It does not prefer
417any type of font.
418<li><tt>QFont::PreferBitmap</tt> - prefers bitmap fonts (as opposed to outline
419fonts).
420<li><tt>QFont::PreferDevice</tt> - prefers device fonts.
421<li><tt>QFont::PreferOutline</tt> - prefers outline fonts (as opposed to bitmap fonts).
422<li><tt>QFont::ForceOutline</tt> - forces the use of outline fonts.
423<li><tt>QFont::NoAntialias</tt> - don't antialias the fonts.
424<li><tt>QFont::PreferAntialias</tt> - antialias if possible.
425<li><tt>QFont::OpenGLCompatible</tt> - forces the use of OpenGL compatible
426fonts.
427</ul><p> Any of these may be OR-ed with one of these flags:
428<ul>
429<li><tt>QFont::PreferMatch</tt> - prefer an exact match. The font matcher will try to
430use the exact font size that has been specified.
431<li><tt>QFont::PreferQuality</tt> - prefer the best quality font. The font matcher
432will use the nearest standard point size that the font
433supports.
434</ul>
435<h3 class=fn><a name="Weight-enum"></a>QFont::Weight</h3>
436
437<p> Qt uses a weighting scale from 0 to 99 similar to, but not the
438same as, the scales used in Windows or CSS. A weight of 0 is
439ultralight, whilst 99 will be an extremely black.
440<p> This enum contains the predefined font weights:
441<ul>
442<li><tt>QFont::Light</tt> - 25
443<li><tt>QFont::Normal</tt> - 50
444<li><tt>QFont::DemiBold</tt> - 63
445<li><tt>QFont::Bold</tt> - 75
446<li><tt>QFont::Black</tt> - 87
447</ul>
448<hr><h2>Member Function Documentation</h2>
449<h3 class=fn><a name="QFont"></a>QFont::QFont ()
450</h3>
451Constructs a font object that uses the application's default font.
452<p> <p>See also <a href="qapplication.html#setFont">QApplication::setFont</a>() and <a href="qapplication.html#font">QApplication::font</a>().
453
454<h3 class=fn><a name="QFont-2"></a>QFont::QFont ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;family, int&nbsp;pointSize = 12, int&nbsp;weight = Normal, bool&nbsp;italic = FALSE )
455</h3>
456Constructs a font object with the specified <em>family</em>, <em>pointSize</em>, <em>weight</em> and <em>italic</em> settings.
457<p> If <em>pointSize</em> is <= 0 it is set to 1.
458<p> The <em>family</em> name may optionally also include a foundry name,
459e.g. "Helvetica [Cronyx]". (The Qt 2.x syntax, i.e.
460"Cronyx-Helvetica", is also supported.) If the <em>family</em> is
461available from more than one foundry and the foundry isn't
462specified, an arbitrary foundry is chosen. If the family isn't
463available a family will be set using the <a href="#fontmatching">font
464 matching</a> algorithm.
465<p> <p>See also <a href="#Weight-enum">Weight</a>, <a href="#setFamily">setFamily</a>(), <a href="#setPointSize">setPointSize</a>(), <a href="#setWeight">setWeight</a>(), <a href="#setItalic">setItalic</a>(), <a href="#setStyleHint">setStyleHint</a>(), and <a href="qapplication.html#font">QApplication::font</a>().
466
467<h3 class=fn><a name="QFont-3"></a>QFont::QFont ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )
468</h3>
469Constructs a font that is a copy of <em>font</em>.
470
471<h3 class=fn><a name="~QFont"></a>QFont::~QFont ()
472</h3>
473Destroys the font object and frees all allocated resources.
474
475<h3 class=fn>bool <a name="bold"></a>QFont::bold () const
476</h3>
477
478<p> Returns TRUE if <a href="#weight">weight</a>() is a value greater than <a href="#Weight-enum">QFont::Normal</a>; otherwise returns FALSE.
479<p> <p>See also <a href="#weight">weight</a>(), <a href="#setBold">setBold</a>(), and <a href="qfontinfo.html#bold">QFontInfo::bold</a>().
480
481<p>Example: <a href="tutorial2-09.html#x2634">chart/optionsform.cpp</a>.
482<h3 class=fn>int <a name="deciPointSize"></a>QFont::deciPointSize () const<tt> [protected]</tt>
483</h3>
484Returns the point size in 1/10ths of a point.
485<p> The returned value will be -1 if the font size has been specified
486in pixels.
487<p> <p>See also <a href="#pointSize">pointSize</a>() and <a href="#pointSizeFloat">pointSizeFloat</a>().
488
489<h3 class=fn><a href="qstring.html">QString</a> <a name="defaultFamily"></a>QFont::defaultFamily () const
490</h3>
491Returns the family name that corresponds to the current style
492hint.
493<p> <p>See also <a href="#StyleHint-enum">StyleHint</a>, <a href="#styleHint">styleHint</a>(), and <a href="#setStyleHint">setStyleHint</a>().
494
495<h3 class=fn><a href="qfont.html">QFont</a> <a name="defaultFont"></a>QFont::defaultFont ()<tt> [static]</tt>
496</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
497<p> Please use <a href="qapplication.html#font">QApplication::font</a>() instead.
498
499<h3 class=fn>bool <a name="dirty"></a>QFont::dirty () const<tt> [protected]</tt>
500</h3>
501Returns TRUE if the font attributes have been changed and the font
502has to be (re)loaded; otherwise returns FALSE.
503
504<h3 class=fn>bool <a name="exactMatch"></a>QFont::exactMatch () const
505</h3>
506Returns TRUE if a window system font exactly matching the settings
507of this font is available.
508<p> <p>See also <a href="qfontinfo.html">QFontInfo</a>.
509
510<h3 class=fn><a href="qstring.html">QString</a> <a name="family"></a>QFont::family () const
511</h3>
512Returns the requested font family name, i.e. the name set in the
513constructor or the last setFont() call.
514<p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#substitutes">substitutes</a>(), and <a href="#substitute">substitute</a>().
515
516<p>Examples: <a href="tutorial2-09.html#x2635">chart/optionsform.cpp</a> and <a href="simple-font-demo-example.html#x2838">fonts/simple-qfont-demo/viewer.cpp</a>.
517<h3 class=fn>bool <a name="fixedPitch"></a>QFont::fixedPitch () const
518</h3>
519Returns TRUE if fixed pitch has been set; otherwise returns FALSE.
520<p> <p>See also <a href="#setFixedPitch">setFixedPitch</a>() and <a href="qfontinfo.html#fixedPitch">QFontInfo::fixedPitch</a>().
521
522<h3 class=fn>bool <a name="fromString"></a>QFont::fromString ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;descrip )
523</h3>
524Sets this font to match the description <em>descrip</em>. The description
525is a comma-separated list of the font attributes, as returned by
526<a href="#toString">toString</a>().
527<p> <p>See also <a href="#toString">toString</a>() and <a href="#operator-gt-gt">operator&gt;&gt;</a>().
528
529<h3 class=fn>HFONT <a name="handle"></a>QFont::handle () const
530</h3>
531Returns the window system handle to the font, for low-level
532access. Using this function is <em>not</em> portable.
533
534<h3 class=fn>void <a name="insertSubstitution"></a>QFont::insertSubstitution ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;familyName, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;substituteName )<tt> [static]</tt>
535</h3>
536Inserts the family name <em>substituteName</em> into the substitution
537table for <em>familyName</em>.
538<p> <p>See also <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#removeSubstitution">removeSubstitution</a>(), <a href="#substitutions">substitutions</a>(), <a href="#substitute">substitute</a>(), and <a href="#substitutes">substitutes</a>().
539
540<p>Example: <a href="simple-font-demo-example.html#x2839">fonts/simple-qfont-demo/viewer.cpp</a>.
541<h3 class=fn>void <a name="insertSubstitutions"></a>QFont::insertSubstitutions ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;familyName, const&nbsp;<a href="qstringlist.html">QStringList</a>&nbsp;&amp;&nbsp;substituteNames )<tt> [static]</tt>
542</h3>
543Inserts the list of families <em>substituteNames</em> into the
544substitution list for <em>familyName</em>.
545<p> <p>See also <a href="#insertSubstitution">insertSubstitution</a>(), <a href="#removeSubstitution">removeSubstitution</a>(), <a href="#substitutions">substitutions</a>(), and <a href="#substitute">substitute</a>().
546
547<p>Example: <a href="simple-font-demo-example.html#x2840">fonts/simple-qfont-demo/viewer.cpp</a>.
548<h3 class=fn>bool <a name="isCopyOf"></a>QFont::isCopyOf ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;f ) const
549</h3>
550Returns TRUE if this font and <em>f</em> are copies of each other, i.e.
551one of them was created as a copy of the other and neither has
552been modified since. This is much stricter than equality.
553<p> <p>See also <a href="#operator-eq">operator=</a>() and <a href="#operator-eq-eq">operator==</a>().
554
555<h3 class=fn>bool <a name="italic"></a>QFont::italic () const
556</h3>
557Returns TRUE if italic has been set; otherwise returns FALSE.
558<p> <p>See also <a href="#setItalic">setItalic</a>().
559
560<p>Example: <a href="tutorial2-09.html#x2636">chart/optionsform.cpp</a>.
561<h3 class=fn><a href="qstring.html">QString</a> <a name="key"></a>QFont::key () const
562</h3>
563Returns the font's key, a textual representation of a font. It is
564typically used as the key for a cache or dictionary of fonts.
565<p> <p>See also <a href="qmap.html">QMap</a>.
566
567<h3 class=fn><a href="qstring.html">QString</a> <a name="lastResortFamily"></a>QFont::lastResortFamily () const
568</h3>
569Returns the "last resort" font family name.
570<p> The current implementation tries a wide variety of common fonts,
571returning the first one it finds. Is is possible that no family is
572found in which case a null string is returned.
573<p> <p>See also <a href="#lastResortFont">lastResortFont</a>().
574
575<h3 class=fn><a href="qstring.html">QString</a> <a name="lastResortFont"></a>QFont::lastResortFont () const
576</h3>
577Returns a "last resort" font name for the font matching algorithm.
578This is used if the last resort family is not available. It will
579always return a name, if necessary returning something like
580"fixed" or "system".
581<p> The current implementation tries a wide variety of common fonts,
582returning the first one it finds. The implementation may change
583at any time, but this function will always return a string
584containing something.
585<p> It is theoretically possible that there really isn't a
586<a href="#lastResortFont">lastResortFont</a>() in which case Qt will abort with an error
587message. We have not been able to identify a case where this
588happens. Please <a href="bughowto.html">report it as a bug</a> if
589it does, preferably with a list of the fonts you have installed.
590<p> <p>See also <a href="#lastResortFamily">lastResortFamily</a>() and <a href="#rawName">rawName</a>().
591
592<h3 class=fn>bool <a name="operator!-eq"></a>QFont::operator!= ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;f ) const
593</h3>
594Returns TRUE if this font is different from <em>f</em>; otherwise
595returns FALSE.
596<p> Two QFonts are considered to be different if their font attributes
597are different. If <a href="#rawMode">rawMode</a>() is enabled for both fonts, only the
598family fields are compared.
599<p> <p>See also <a href="#operator-eq-eq">operator==</a>().
600
601<h3 class=fn><a href="qfont.html">QFont</a>&nbsp;&amp; <a name="operator-eq"></a>QFont::operator= ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )
602</h3>
603Assigns <em>font</em> to this font and returns a reference to it.
604
605<h3 class=fn>bool <a name="operator-eq-eq"></a>QFont::operator== ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;f ) const
606</h3>
607Returns TRUE if this font is equal to <em>f</em>; otherwise returns
608FALSE.
609<p> Two QFonts are considered equal if their font attributes are
610equal. If <a href="#rawMode">rawMode</a>() is enabled for both fonts, only the family
611fields are compared.
612<p> <p>See also <a href="#operator!-eq">operator!=</a>() and <a href="#isCopyOf">isCopyOf</a>().
613
614<h3 class=fn>bool <a name="overline"></a>QFont::overline () const
615</h3>
616Returns TRUE if overline has been set; otherwise returns FALSE.
617<p> <p>See also <a href="#setOverline">setOverline</a>().
618
619<h3 class=fn>int <a name="pixelSize"></a>QFont::pixelSize () const
620</h3>
621Returns the pixel size of the font if it was set with
622<a href="#setPixelSize">setPixelSize</a>(). Returns -1 if the size was set with <a href="#setPointSize">setPointSize</a>()
623or <a href="#setPointSizeFloat">setPointSizeFloat</a>().
624<p> <p>See also <a href="#setPixelSize">setPixelSize</a>(), <a href="#pointSize">pointSize</a>(), <a href="qfontinfo.html#pointSize">QFontInfo::pointSize</a>(), and <a href="qfontinfo.html#pixelSize">QFontInfo::pixelSize</a>().
625
626<h3 class=fn>int <a name="pointSize"></a>QFont::pointSize () const
627</h3>
628Returns the point size of the font. Returns -1 if the font size
629was specified in pixels.
630<p> <p>See also <a href="#setPointSize">setPointSize</a>(), <a href="#deciPointSize">deciPointSize</a>(), and <a href="#pointSizeFloat">pointSizeFloat</a>().
631
632<p>Examples: <a href="tutorial2-09.html#x2637">chart/optionsform.cpp</a> and <a href="simple-font-demo-example.html#x2841">fonts/simple-qfont-demo/viewer.cpp</a>.
633<h3 class=fn>float <a name="pointSizeFloat"></a>QFont::pointSizeFloat () const
634</h3>
635Returns the point size of the font. Returns -1 if the font size was
636specified in pixels.
637<p> <p>See also <a href="#pointSize">pointSize</a>(), <a href="#setPointSizeFloat">setPointSizeFloat</a>(), <a href="#pixelSize">pixelSize</a>(), <a href="qfontinfo.html#pointSize">QFontInfo::pointSize</a>(), and <a href="qfontinfo.html#pixelSize">QFontInfo::pixelSize</a>().
638
639<h3 class=fn>void <a name="qwsRenderToDisk"></a>QFont::qwsRenderToDisk ( bool&nbsp;all = TRUE )
640</h3>
641Saves the glyphs in the font that have previously been accessed as
642a QPF file. If <em>all</em> is TRUE (the default), then before saving,
643all glyphs are marked as used.
644<p> If the font is large and you are sure that only a subset of
645characters will ever be required on the target device, passing
646FALSE for the <em>all</em> parameter can save a significant amount of
647disk space.
648<p> Note that this function is only applicable on Qt/Embedded.
649
650<h3 class=fn>bool <a name="rawMode"></a>QFont::rawMode () const
651</h3>
652Returns TRUE if raw mode is used for font name matching; otherwise
653returns FALSE.
654<p> <p>See also <a href="#setRawMode">setRawMode</a>() and <a href="#rawName">rawName</a>().
655
656<h3 class=fn><a href="qstring.html">QString</a> <a name="rawName"></a>QFont::rawName () const
657</h3>
658Returns the name of the font within the underlying window system.
659<p> On Windows, this is usually just the family name of a TrueType
660font.
661<p> On X11, it is an XLFD (X Logical Font Description). When Qt is
662build with Xft support on X11, the return value can be an Xft
663pattern or an XLFD.
664<p> Using the return value of this function is usually <em>not</em> <em>portable</em>.
665<p> <p>See also <a href="#setRawName">setRawName</a>().
666
667<h3 class=fn>void <a name="removeSubstitution"></a>QFont::removeSubstitution ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;familyName )<tt> [static]</tt>
668</h3>
669Removes all the substitutions for <em>familyName</em>.
670<p> <p>See also <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#insertSubstitution">insertSubstitution</a>(), <a href="#substitutions">substitutions</a>(), and <a href="#substitute">substitute</a>().
671
672<h3 class=fn><a href="qfont.html">QFont</a> <a name="resolve"></a>QFont::resolve ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;other ) const
673</h3>
674Returns a new QFont that has attributes copied from <em>other</em>.
675
676<h3 class=fn>void <a name="setBold"></a>QFont::setBold ( bool&nbsp;enable )
677</h3>
678
679<p> If <em>enable</em> is true sets the font's weight to <a href="#Weight-enum">QFont::Bold</a>; otherwise sets the weight to <a href="#Weight-enum">QFont::Normal</a>.
680<p> For finer boldness control use <a href="#setWeight">setWeight</a>().
681<p> <p>See also <a href="#bold">bold</a>() and <a href="#setWeight">setWeight</a>().
682
683<p>Examples: <a href="menu-example.html#x1860">menu/menu.cpp</a> and <a href="themes-example.html#x280">themes/metal.cpp</a>.
684<h3 class=fn>void <a name="setDefaultFont"></a>QFont::setDefaultFont ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;f )<tt> [static]</tt>
685</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
686<p> Please use <a href="qapplication.html#setFont">QApplication::setFont</a>() instead.
687
688<h3 class=fn>void <a name="setFamily"></a>QFont::setFamily ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;family )
689</h3>
690Sets the family name of the font. The name is case insensitive and
691may include a foundry name.
692<p> The <em>family</em> name may optionally also include a foundry name,
693e.g. "Helvetica [Cronyx]". (The Qt 2.x syntax, i.e.
694"Cronyx-Helvetica", is also supported.) If the <em>family</em> is
695available from more than one foundry and the foundry isn't
696specified, an arbitrary foundry is chosen. If the family isn't
697available a family will be set using the <a href="#fontmatching">font
698 matching</a> algorithm.
699<p> <p>See also <a href="#family">family</a>(), <a href="#setStyleHint">setStyleHint</a>(), and <a href="qfontinfo.html">QFontInfo</a>.
700
701<h3 class=fn>void <a name="setFixedPitch"></a>QFont::setFixedPitch ( bool&nbsp;enable )
702</h3>
703If <em>enable</em> is TRUE, sets fixed pitch on; otherwise sets fixed
704pitch off.
705<p> <p>See also <a href="#fixedPitch">fixedPitch</a>() and <a href="qfontinfo.html">QFontInfo</a>.
706
707<h3 class=fn>void <a name="setItalic"></a>QFont::setItalic ( bool&nbsp;enable )
708</h3>
709If <em>enable</em> is TRUE, italic is set on; otherwise italic is set
710off.
711<p> <p>See also <a href="#italic">italic</a>() and <a href="qfontinfo.html">QFontInfo</a>.
712
713<p>Examples: <a href="fileiconview-example.html#x828">fileiconview/qfileiconview.cpp</a>, <a href="simple-font-demo-example.html#x2842">fonts/simple-qfont-demo/viewer.cpp</a>, and <a href="themes-example.html#x281">themes/metal.cpp</a>.
714<h3 class=fn>void <a name="setOverline"></a>QFont::setOverline ( bool&nbsp;enable )
715</h3>
716If <em>enable</em> is TRUE, sets overline on; otherwise sets overline off.
717<p> <p>See also <a href="#overline">overline</a>() and <a href="qfontinfo.html">QFontInfo</a>.
718
719<h3 class=fn>void <a name="setPixelSize"></a>QFont::setPixelSize ( int&nbsp;pixelSize )
720</h3>
721Sets the font size to <em>pixelSize</em> pixels.
722<p> Using this function makes the font device dependent. Use
723<a href="#setPointSize">setPointSize</a>() or <a href="#setPointSizeFloat">setPointSizeFloat</a>() to set the size of the font
724in a device independent manner.
725<p> <p>See also <a href="#pixelSize">pixelSize</a>().
726
727<p>Example: <a href="qwerty-example.html#x367">qwerty/qwerty.cpp</a>.
728<h3 class=fn>void <a name="setPixelSizeFloat"></a>QFont::setPixelSizeFloat ( float&nbsp;pixelSize )
729</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
730<p> Sets the logical pixel height of font characters when shown on
731the screen to <em>pixelSize</em>.
732
733<h3 class=fn>void <a name="setPointSize"></a>QFont::setPointSize ( int&nbsp;pointSize )
734</h3>
735Sets the point size to <em>pointSize</em>. The point size must be
736greater than zero.
737<p> <p>See also <a href="#pointSize">pointSize</a>() and <a href="#setPointSizeFloat">setPointSizeFloat</a>().
738
739<p>Example: <a href="simple-font-demo-example.html#x2843">fonts/simple-qfont-demo/viewer.cpp</a>.
740<h3 class=fn>void <a name="setPointSizeFloat"></a>QFont::setPointSizeFloat ( float&nbsp;pointSize )
741</h3>
742Sets the point size to <em>pointSize</em>. The point size must be
743greater than zero. The requested precision may not be achieved on
744all platforms.
745<p> <p>See also <a href="#pointSizeFloat">pointSizeFloat</a>(), <a href="#setPointSize">setPointSize</a>(), and <a href="#setPixelSize">setPixelSize</a>().
746
747<h3 class=fn>void <a name="setRawMode"></a>QFont::setRawMode ( bool&nbsp;enable )
748</h3>
749If <em>enable</em> is TRUE, turns raw mode on; otherwise turns raw mode
750off. This function only has an effect under X11.
751<p> If raw mode is enabled, Qt will search for an X font with a
752complete font name matching the family name, ignoring all other
753values set for the QFont. If the font name matches several fonts,
754Qt will use the first font returned by X. <a href="qfontinfo.html">QFontInfo</a> <em>cannot</em> be
755used to fetch information about a QFont using raw mode (it will
756return the values set in the QFont for all parameters, including
757the family name).
758<p> <b>Warning:</b> Do not use raw mode unless you really, really need it! In
759most (if not all) cases, <a href="#setRawName">setRawName</a>() is a much better choice.
760<p> <p>See also <a href="#rawMode">rawMode</a>() and <a href="#setRawName">setRawName</a>().
761
762<h3 class=fn>void <a name="setRawName"></a>QFont::setRawName ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name )
763</h3>
764Sets a font by its system specific name. The function is
765particularly useful under X, where system font settings (for
766example X resources) are usually available in XLFD (X Logical Font
767Description) form only. You can pass an XLFD as <em>name</em> to this
768function.
769<p> A font set with <a href="#setRawName">setRawName</a>() is still a full-featured QFont. It can
770be queried (for example with <a href="#italic">italic</a>()) or modified (for example with
771<a href="#setItalic">setItalic</a>()) and is therefore also suitable for rendering rich text.
772<p> If Qt's internal font database cannot resolve the raw name, the
773font becomes a raw font with <em>name</em> as its family.
774<p> Note that the present implementation does not handle wildcards in
775XLFDs well, and that font aliases (file <tt>fonts.alias</tt> in the font
776directory on X11) are not supported.
777<p> <p>See also <a href="#rawName">rawName</a>(), <a href="#setRawMode">setRawMode</a>(), and <a href="#setFamily">setFamily</a>().
778
779<h3 class=fn>void <a name="setStretch"></a>QFont::setStretch ( int&nbsp;factor )
780</h3>
781Sets the <a href="layout.html#stretch-factor">stretch factor</a> for the font.
782<p> The stretch factor changes the width of all characters in the font
783by <em>factor</em> percent. For example, setting <em>factor</em> to 150
784results in all characters in the font being 1.5 times ( ie. 150% )
785wider. The default stretch factor is 100. The minimum stretch
786factor is 1, and the maximum stretch factor is 4000.
787<p> The stretch factor is only applied to outline fonts. The stretch
788factor is ignored for bitmap fonts.
789<p> NOTE: QFont cannot stretch XLFD fonts. When loading XLFD fonts on
790X11, the stretch factor is matched against a predefined set of
791values for the SETWIDTH_NAME field of the XLFD.
792<p> <p>See also <a href="#stretch">stretch</a>() and <a href="#StyleStrategy-enum">QFont::StyleStrategy</a>.
793
794<h3 class=fn>void <a name="setStrikeOut"></a>QFont::setStrikeOut ( bool&nbsp;enable )
795</h3>
796If <em>enable</em> is TRUE, sets strikeout on; otherwise sets strikeout
797off.
798<p> <p>See also <a href="#strikeOut">strikeOut</a>() and <a href="qfontinfo.html">QFontInfo</a>.
799
800<h3 class=fn>void <a name="setStyleHint"></a>QFont::setStyleHint ( <a href="qfont.html#StyleHint-enum">StyleHint</a>&nbsp;hint, <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a>&nbsp;strategy = PreferDefault )
801</h3>
802Sets the style hint and strategy to <em>hint</em> and <em>strategy</em>,
803respectively.
804<p> If these aren't set explicitly the style hint will default to
805<a href="#StyleHint-enum">AnyStyle</a> and the style strategy to <a href="#StyleStrategy-enum">PreferDefault</a>.
806<p> Qt does not support style hints on X11 since this information
807is not provided by the window system.
808<p> <p>See also <a href="#StyleHint-enum">StyleHint</a>, <a href="#styleHint">styleHint</a>(), <a href="#StyleStrategy-enum">StyleStrategy</a>, <a href="#styleStrategy">styleStrategy</a>(), and <a href="qfontinfo.html">QFontInfo</a>.
809
810<p>Examples: <a href="desktop-example.html#x1728">desktop/desktop.cpp</a> and <a href="simple-font-demo-example.html#x2844">fonts/simple-qfont-demo/viewer.cpp</a>.
811<h3 class=fn>void <a name="setStyleStrategy"></a>QFont::setStyleStrategy ( <a href="qfont.html#StyleStrategy-enum">StyleStrategy</a>&nbsp;s )
812</h3>
813Sets the style strategy for the font to <em>s</em>.
814<p> <p>See also <a href="#StyleStrategy-enum">QFont::StyleStrategy</a>.
815
816<h3 class=fn>void <a name="setUnderline"></a>QFont::setUnderline ( bool&nbsp;enable )
817</h3>
818If <em>enable</em> is TRUE, sets underline on; otherwise sets underline
819off.
820<p> <p>See also <a href="#underline">underline</a>() and <a href="qfontinfo.html">QFontInfo</a>.
821
822<p>Examples: <a href="simple-font-demo-example.html#x2845">fonts/simple-qfont-demo/viewer.cpp</a> and <a href="menu-example.html#x1861">menu/menu.cpp</a>.
823<h3 class=fn>void <a name="setWeight"></a>QFont::setWeight ( int&nbsp;weight )
824</h3>
825Sets the weight the font to <em>weight</em>, which should be a value
826from the <a href="#Weight-enum">QFont::Weight</a> enumeration.
827<p> <p>See also <a href="#weight">weight</a>() and <a href="qfontinfo.html">QFontInfo</a>.
828
829<p>Example: <a href="simple-font-demo-example.html#x2846">fonts/simple-qfont-demo/viewer.cpp</a>.
830<h3 class=fn>int <a name="stretch"></a>QFont::stretch () const
831</h3>
832Returns the <a href="layout.html#stretch-factor">stretch factor</a> for the font.
833<p> <p>See also <a href="#setStretch">setStretch</a>().
834
835<h3 class=fn>bool <a name="strikeOut"></a>QFont::strikeOut () const
836</h3>
837Returns TRUE if strikeout has been set; otherwise returns FALSE.
838<p> <p>See also <a href="#setStrikeOut">setStrikeOut</a>().
839
840<h3 class=fn><a href="qfont.html#StyleHint-enum">StyleHint</a> <a name="styleHint"></a>QFont::styleHint () const
841</h3>
842Returns the StyleHint.
843<p> The style hint affects the <a href="#fontmatching">font
844 matching</a> algorithm. See <a href="#StyleHint-enum">QFont::StyleHint</a> for the list
845of strategies.
846<p> <p>See also <a href="#setStyleHint">setStyleHint</a>(), <a href="#StyleStrategy-enum">QFont::StyleStrategy</a>, and <a href="qfontinfo.html#styleHint">QFontInfo::styleHint</a>().
847
848<h3 class=fn><a href="qfont.html#StyleStrategy-enum">StyleStrategy</a> <a name="styleStrategy"></a>QFont::styleStrategy () const
849</h3>
850Returns the StyleStrategy.
851<p> The style strategy affects the <a href="#fontmatching">font
852 matching</a> algorithm. See <a href="#StyleStrategy-enum">QFont::StyleStrategy</a> for the
853list of strategies.
854<p> <p>See also <a href="#setStyleHint">setStyleHint</a>() and <a href="#StyleHint-enum">QFont::StyleHint</a>.
855
856<h3 class=fn><a href="qstring.html">QString</a> <a name="substitute"></a>QFont::substitute ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;familyName )<tt> [static]</tt>
857</h3>
858Returns the first family name to be used whenever <em>familyName</em> is
859specified. The lookup is case insensitive.
860<p> If there is no substitution for <em>familyName</em>, <em>familyName</em> is
861returned.
862<p> To obtain a list of substitutions use <a href="#substitutes">substitutes</a>().
863<p> <p>See also <a href="#setFamily">setFamily</a>(), <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#insertSubstitution">insertSubstitution</a>(), and <a href="#removeSubstitution">removeSubstitution</a>().
864
865<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="substitutes"></a>QFont::substitutes ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;familyName )<tt> [static]</tt>
866</h3>
867Returns a list of family names to be used whenever <em>familyName</em>
868is specified. The lookup is case insensitive.
869<p> If there is no substitution for <em>familyName</em>, an empty list is
870returned.
871<p> <p>See also <a href="#substitute">substitute</a>(), <a href="#insertSubstitutions">insertSubstitutions</a>(), <a href="#insertSubstitution">insertSubstitution</a>(), and <a href="#removeSubstitution">removeSubstitution</a>().
872
873<p>Example: <a href="simple-font-demo-example.html#x2847">fonts/simple-qfont-demo/viewer.cpp</a>.
874<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="substitutions"></a>QFont::substitutions ()<tt> [static]</tt>
875</h3>
876Returns a sorted list of substituted family names.
877<p> <p>See also <a href="#insertSubstitution">insertSubstitution</a>(), <a href="#removeSubstitution">removeSubstitution</a>(), and <a href="#substitute">substitute</a>().
878
879<h3 class=fn><a href="qstring.html">QString</a> <a name="toString"></a>QFont::toString () const
880</h3>
881Returns a description of the font. The description is a
882comma-separated list of the attributes, perfectly suited for use
883in <a href="qsettings.html">QSettings</a>.
884<p> <p>See also <a href="#fromString">fromString</a>() and <a href="#operator-lt-lt">operator&lt;&lt;</a>().
885
886<h3 class=fn>bool <a name="underline"></a>QFont::underline () const
887</h3>
888Returns TRUE if underline has been set; otherwise returns FALSE.
889<p> <p>See also <a href="#setUnderline">setUnderline</a>().
890
891<h3 class=fn>int <a name="weight"></a>QFont::weight () const
892</h3>
893Returns the weight of the font which is one of the enumerated
894values from <a href="#Weight-enum">QFont::Weight</a>.
895<p> <p>See also <a href="#setWeight">setWeight</a>(), <a href="#Weight-enum">Weight</a>, and <a href="qfontinfo.html">QFontInfo</a>.
896
897<hr><h2>Related Functions</h2>
898<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )
899</h3>
900
901<p> Writes the font <em>font</em> to the data stream <em>s</em>. (<a href="#toString">toString</a>()
902writes to a text stream.)
903<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
904
905<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )
906</h3>
907
908<p> Reads the font <em>font</em> from the data stream <em>s</em>. (<a href="#fromString">fromString</a>()
909reads from a text stream.)
910<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.
911
912<!-- eof -->
913<hr><p>
914This file is part of the <a href="index.html">Qt toolkit</a>.
915Copyright &copy; 1995-2007
916<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
917<table width=100% cellspacing=0 border=0><tr>
918<td>Copyright &copy; 2007
919<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
920<td align=right><div align=right>Qt 3.3.8</div>
921</table></div></address></body>
922</html>
Note: See TracBrowser for help on using the repository browser.