summaryrefslogtreecommitdiffstats
path: root/doc/html/qfontinfo.html
blob: 9020ac85140c938cf203398829c32659e0f418b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qfont.cpp:2590 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QFontInfo Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QFontInfo Class Reference</h1>

<p>The QFontInfo class provides general information about fonts.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qfontinfo-h.html">qfontinfo.h</a>&gt;</tt>
<p><a href="qfontinfo-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QFontInfo"><b>QFontInfo</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;font )</li>
<li class=fn><a href="#QFontInfo-2"><b>QFontInfo</b></a> ( const&nbsp;QFont&nbsp;&amp;&nbsp;font, QFont::Script&nbsp;script )</li>
<li class=fn><a href="#QFontInfo-3"><b>QFontInfo</b></a> ( const&nbsp;QFontInfo&nbsp;&amp;&nbsp;fi )</li>
<li class=fn><a href="#~QFontInfo"><b>~QFontInfo</b></a> ()</li>
<li class=fn>QFontInfo &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QFontInfo&nbsp;&amp;&nbsp;fi )</li>
<li class=fn>QString <a href="#family"><b>family</b></a> () const</li>
<li class=fn>int <a href="#pixelSize"><b>pixelSize</b></a> () const</li>
<li class=fn>int <a href="#pointSize"><b>pointSize</b></a> () const</li>
<li class=fn>bool <a href="#italic"><b>italic</b></a> () const</li>
<li class=fn>int <a href="#weight"><b>weight</b></a> () const</li>
<li class=fn>bool <a href="#bold"><b>bold</b></a> () const</li>
<li class=fn>bool <a href="#fixedPitch"><b>fixedPitch</b></a> () const</li>
<li class=fn>QFont::StyleHint <a href="#styleHint"><b>styleHint</b></a> () const</li>
<li class=fn>bool <a href="#rawMode"><b>rawMode</b></a> () const</li>
<li class=fn>bool <a href="#exactMatch"><b>exactMatch</b></a> () const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


<p> The QFontInfo class provides general information about fonts.
<p> 

<p> The QFontInfo class provides the same access functions as <a href="qfont.html">QFont</a>,
e.g. <a href="#family">family</a>(), <a href="#pointSize">pointSize</a>(), <a href="#italic">italic</a>(), <a href="#weight">weight</a>(), <a href="#fixedPitch">fixedPitch</a>(),
<a href="#styleHint">styleHint</a>() etc. But whilst the QFont access functions return the
values that were set, a QFontInfo object returns the values that
apply to the font that will actually be used to draw the text.
<p> For example, when the program asks for a 25pt Courier font on a
machine that has a non-scalable 24pt Courier font, QFont will
(normally) use the 24pt Courier for rendering. In this case,
<a href="qfont.html#pointSize">QFont::pointSize</a>() returns 25 and <a href="#pointSize">QFontInfo::pointSize</a>() returns
24.
<p> There are three ways to create a QFontInfo object.
<ol type=1>
<li> Calling the QFontInfo constructor with a QFont creates a font
info object for a screen-compatible font, i.e. the font cannot be
a printer font<sup>*</sup>. If the font is changed later, the font
info object is <em>not</em> updated.
<p> <li> <a href="qwidget.html#fontInfo">QWidget::fontInfo</a>() returns the font info for a widget's font.
This is equivalent to calling QFontInfo(widget->font()). If the
widget's font is changed later, the font info object is <em>not</em>
updated.
<p> <li> <a href="qpainter.html#fontInfo">QPainter::fontInfo</a>() returns the font info for a painter's
current font. If the painter's font is changed later, the font
info object is <em>not</em> updated.
</ol>
<p> <sup>*</sup> If you use a printer font the values returned may be
inaccurate. Printer fonts are not always accessible so the nearest
screen font is used if a printer font is supplied.
<p> <p>See also <a href="qfont.html">QFont</a>, <a href="qfontmetrics.html">QFontMetrics</a>, <a href="qfontdatabase.html">QFontDatabase</a>, <a href="graphics.html">Graphics Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QFontInfo"></a>QFontInfo::QFontInfo ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font )
</h3>
Constructs a font info object for <em>font</em>.
<p> The font must be screen-compatible, i.e. a font you use when
drawing text in <a href="qwidget.html">widgets</a> or <a href="qpixmap.html">pixmaps</a>, not <a href="qpicture.html">QPicture</a> or <a href="qprinter.html">QPrinter</a>.
<p> The font info object holds the information for the font that is
passed in the constructor at the time it is created, and is not
updated if the font's attributes are changed later.
<p> Use <a href="qpainter.html#fontInfo">QPainter::fontInfo</a>() to get the font info when painting.
This will give correct results also when painting on paint device
that is not screen-compatible.

<h3 class=fn><a name="QFontInfo-2"></a>QFontInfo::QFontInfo ( const&nbsp;<a href="qfont.html">QFont</a>&nbsp;&amp;&nbsp;font, <a href="qfont.html#Script-enum">QFont::Script</a>&nbsp;script )
</h3>
Constructs a font info object for <em>font</em> using the specified <em>script</em>.

<h3 class=fn><a name="QFontInfo-3"></a>QFontInfo::QFontInfo ( const&nbsp;<a href="qfontinfo.html">QFontInfo</a>&nbsp;&amp;&nbsp;fi )
</h3>
Constructs a copy of <em>fi</em>.

<h3 class=fn><a name="~QFontInfo"></a>QFontInfo::~QFontInfo ()
</h3>
Destroys the font info object.

<h3 class=fn>bool <a name="bold"></a>QFontInfo::bold () const
</h3>

<p> Returns TRUE if <a href="#weight">weight</a>() would return a value greater than <a href="qfont.html#Weight-enum">QFont::Normal</a>; otherwise returns FALSE.
<p> <p>See also <a href="#weight">weight</a>() and <a href="qfont.html#bold">QFont::bold</a>().

<p>Example: <a href="qfd-example.html#x1982">qfd/fontdisplayer.cpp</a>.
<h3 class=fn>bool <a name="exactMatch"></a>QFontInfo::exactMatch () const
</h3>
Returns TRUE if the matched window system font is exactly the same
as the one specified by the font; otherwise returns FALSE.
<p> <p>See also <a href="qfont.html#exactMatch">QFont::exactMatch</a>().

<h3 class=fn><a href="qstring.html">QString</a> <a name="family"></a>QFontInfo::family () const
</h3>
Returns the family name of the matched window system font.
<p> <p>See also <a href="qfont.html#family">QFont::family</a>().

<p>Examples: <a href="simple-font-demo-example.html#x2848">fonts/simple-qfont-demo/viewer.cpp</a> and <a href="qfd-example.html#x1983">qfd/fontdisplayer.cpp</a>.
<h3 class=fn>bool <a name="fixedPitch"></a>QFontInfo::fixedPitch () const
</h3>
Returns the fixed pitch value of the matched window system font.
<p> <p>See also <a href="qfont.html#fixedPitch">QFont::fixedPitch</a>().

<h3 class=fn>bool <a name="italic"></a>QFontInfo::italic () const
</h3>
Returns the italic value of the matched window system font.
<p> <p>See also <a href="qfont.html#italic">QFont::italic</a>().

<p>Example: <a href="qfd-example.html#x1984">qfd/fontdisplayer.cpp</a>.
<h3 class=fn><a href="qfontinfo.html">QFontInfo</a>&nbsp;&amp; <a name="operator-eq"></a>QFontInfo::operator= ( const&nbsp;<a href="qfontinfo.html">QFontInfo</a>&nbsp;&amp;&nbsp;fi )
</h3>
Assigns the font info in <em>fi</em>.

<h3 class=fn>int <a name="pixelSize"></a>QFontInfo::pixelSize () const
</h3>
Returns the pixel size of the matched window system font.
<p> <p>See also <a href="qfont.html#pointSize">QFont::pointSize</a>().

<h3 class=fn>int <a name="pointSize"></a>QFontInfo::pointSize () const
</h3>
Returns the point size of the matched window system font.
<p> <p>See also <a href="qfont.html#pointSize">QFont::pointSize</a>().

<p>Examples: <a href="simple-font-demo-example.html#x2849">fonts/simple-qfont-demo/viewer.cpp</a> and <a href="qfd-example.html#x1985">qfd/fontdisplayer.cpp</a>.
<h3 class=fn>bool <a name="rawMode"></a>QFontInfo::rawMode () const
</h3>
Returns TRUE if the font is a raw mode font; otherwise returns
FALSE.
<p> If it is a raw mode font, all other functions in QFontInfo will
return the same values set in the <a href="qfont.html">QFont</a>, regardless of the font
actually used.
<p> <p>See also <a href="qfont.html#rawMode">QFont::rawMode</a>().

<h3 class=fn><a href="qfont.html#StyleHint-enum">QFont::StyleHint</a> <a name="styleHint"></a>QFontInfo::styleHint () const
</h3>
Returns the style of the matched window system font.
<p> Currently only returns the style hint set in <a href="qfont.html">QFont</a>.
<p> <p>See also <a href="qfont.html#styleHint">QFont::styleHint</a>() and <a href="qfont.html#StyleHint-enum">QFont::StyleHint</a>.

<h3 class=fn>int <a name="weight"></a>QFontInfo::weight () const
</h3>
Returns the weight of the matched window system font.
<p> <p>See also <a href="qfont.html#weight">QFont::weight</a>() and <a href="#bold">bold</a>().

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>