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

<p>The TQFontMetrics class provides font metrics information.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qfontmetrics-h.html">ntqfontmetrics.h</a>&gt;</tt>
<p><a href="qfontmetrics-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQFontMetrics"><b>TQFontMetrics</b></a> ( const&nbsp;TQFont&nbsp;&amp;&nbsp;font )</li>
<li class=fn><a href="#TQFontMetrics-2"><b>TQFontMetrics</b></a> ( const&nbsp;TQFont&nbsp;&amp;&nbsp;font, TQFont::Script&nbsp;script )</li>
<li class=fn><a href="#TQFontMetrics-3"><b>TQFontMetrics</b></a> ( const&nbsp;TQFontMetrics&nbsp;&amp;&nbsp;fm )</li>
<li class=fn><a href="#~TQFontMetrics"><b>~TQFontMetrics</b></a> ()</li>
<li class=fn>TQFontMetrics &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQFontMetrics&nbsp;&amp;&nbsp;fm )</li>
<li class=fn>int <a href="#ascent"><b>ascent</b></a> () const</li>
<li class=fn>int <a href="#descent"><b>descent</b></a> () const</li>
<li class=fn>int <a href="#height"><b>height</b></a> () const</li>
<li class=fn>int <a href="#leading"><b>leading</b></a> () const</li>
<li class=fn>int <a href="#lineSpacing"><b>lineSpacing</b></a> () const</li>
<li class=fn>int <a href="#minLeftBearing"><b>minLeftBearing</b></a> () const</li>
<li class=fn>int <a href="#minRightBearing"><b>minRightBearing</b></a> () const</li>
<li class=fn>int <a href="#maxWidth"><b>maxWidth</b></a> () const</li>
<li class=fn>bool <a href="#inFont"><b>inFont</b></a> ( TQChar&nbsp;ch ) const</li>
<li class=fn>int <a href="#leftBearing"><b>leftBearing</b></a> ( TQChar&nbsp;ch ) const</li>
<li class=fn>int <a href="#rightBearing"><b>rightBearing</b></a> ( TQChar&nbsp;ch ) const</li>
<li class=fn>int <a href="#width-2"><b>width</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;str, int&nbsp;len = -1 ) const</li>
<li class=fn>int <a href="#width"><b>width</b></a> ( TQChar&nbsp;ch ) const</li>
<li class=fn>int width ( char&nbsp;c ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>int <a href="#charWidth"><b>charWidth</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;str, int&nbsp;pos ) const</li>
<li class=fn>TQRect <a href="#boundingRect-2"><b>boundingRect</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;str, int&nbsp;len = -1 ) const</li>
<li class=fn>TQRect <a href="#boundingRect"><b>boundingRect</b></a> ( TQChar&nbsp;ch ) const</li>
<li class=fn>TQRect <a href="#boundingRect-3"><b>boundingRect</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;flgs, const&nbsp;TQString&nbsp;&amp;&nbsp;str, int&nbsp;len = -1, int&nbsp;tabstops = 0, int&nbsp;*&nbsp;tabarray = 0, TQTextParag&nbsp;**&nbsp;intern = 0 ) const</li>
<li class=fn>TQSize <a href="#size"><b>size</b></a> ( int&nbsp;flgs, const&nbsp;TQString&nbsp;&amp;&nbsp;str, int&nbsp;len = -1, int&nbsp;tabstops = 0, int&nbsp;*&nbsp;tabarray = 0, TQTextParag&nbsp;**&nbsp;intern = 0 ) const</li>
<li class=fn>int <a href="#underlinePos"><b>underlinePos</b></a> () const</li>
<li class=fn>int <a href="#overlinePos"><b>overlinePos</b></a> () const</li>
<li class=fn>int <a href="#strikeOutPos"><b>strikeOutPos</b></a> () const</li>
<li class=fn>int <a href="#lineWidth"><b>lineWidth</b></a> () const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The TQFontMetrics class provides font metrics information.
<p> 

<p> TQFontMetrics functions calculate the size of characters and
strings for a given font. There are three ways you can create a
TQFontMetrics object:
<p> <ol type=1>
<li> Calling the TQFontMetrics constructor with a <a href="ntqfont.html">TQFont</a> creates a
font metrics 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 metrics object is <em>not</em> updated.
<p> <li> <a href="tqwidget.html#fontMetrics">TQWidget::fontMetrics</a>() returns the font metrics for a widget's
font. This is equivalent to TQFontMetrics(widget->font()). If the
widget's font is changed later, the font metrics object is <em>not</em>
updated.
<p> <li> <a href="ntqpainter.html#fontMetrics">TQPainter::fontMetrics</a>() returns the font metrics for a
painter's current font. If the painter's font is changed later, the
font metrics 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> Once created, the object provides functions to access the
individual metrics of the font, its characters, and for strings
rendered in the font.
<p> There are several functions that operate on the font: <a href="#ascent">ascent</a>(),
<a href="#descent">descent</a>(), <a href="#height">height</a>(), <a href="#leading">leading</a>() and <a href="#lineSpacing">lineSpacing</a>() return the basic
size properties of the font. The <a href="#underlinePos">underlinePos</a>(), <a href="#overlinePos">overlinePos</a>(),
<a href="#strikeOutPos">strikeOutPos</a>() and <a href="#lineWidth">lineWidth</a>() functions, return the properties of
the line that underlines, overlines or strikes out the
characters. These functions are all fast.
<p> There are also some functions that operate on the set of glyphs in
the font: <a href="#minLeftBearing">minLeftBearing</a>(), <a href="#minRightBearing">minRightBearing</a>() and <a href="#maxWidth">maxWidth</a>().
These are by necessity slow, and we recommend avoiding them if
possible.
<p> For each character, you can get its <a href="#width">width</a>(), <a href="#leftBearing">leftBearing</a>() and
<a href="#rightBearing">rightBearing</a>() and find out whether it is in the font using
<a href="#inFont">inFont</a>(). You can also treat the character as a string, and use
the string functions on it.
<p> The string functions include width(), to return the width of a
string in pixels (or points, for a printer), <a href="#boundingRect">boundingRect</a>(), to
return a rectangle large enough to contain the rendered string,
and <a href="#size">size</a>(), to return the size of that rectangle.
<p> Example:
<pre>
    <a href="ntqfont.html">TQFont</a> font( "times", 24 );
    TQFontMetrics fm( font );
    int pixelsWide = fm.<a href="#width">width</a>( "What's the width of this text?" );
    int pixelsHigh = fm.<a href="#height">height</a>();
    </pre>
 
<p> <p>See also <a href="ntqfont.html">TQFont</a>, <a href="ntqfontinfo.html">TQFontInfo</a>, <a href="ntqfontdatabase.html">TQFontDatabase</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="TQFontMetrics"></a>TQFontMetrics::TQFontMetrics ( const&nbsp;<a href="ntqfont.html">TQFont</a>&nbsp;&amp;&nbsp;font )
</h3>
Constructs a font metrics object for <em>font</em>.
<p> The font must be screen-compatible, i.e. a font you use when
drawing text in <a href="tqwidget.html">widgets</a> or <a href="ntqpixmap.html">pixmaps</a>, not <a href="ntqpicture.html">TQPicture</a> or <a href="ntqprinter.html">TQPrinter</a>.
<p> The font metrics 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="ntqpainter.html#fontMetrics">TQPainter::fontMetrics</a>() to get the font metrics when painting.
This will give correct results also when painting on paint device
that is not screen-compatible.

<h3 class=fn><a name="TQFontMetrics-2"></a>TQFontMetrics::TQFontMetrics ( const&nbsp;<a href="ntqfont.html">TQFont</a>&nbsp;&amp;&nbsp;font, <a href="ntqfont.html#Script-enum">TQFont::Script</a>&nbsp;script )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Constructs a font metrics object for <em>font</em> using the given <em>script</em>.

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

<h3 class=fn><a name="~TQFontMetrics"></a>TQFontMetrics::~TQFontMetrics ()
</h3>
Destroys the font metrics object and frees all allocated
resources.

<h3 class=fn>int <a name="ascent"></a>TQFontMetrics::ascent () const
</h3>
Returns the ascent of the font.
<p> The ascent of a font is the distance from the baseline to the
highest position characters extend to. In practice, some font
designers break this rule, e.g. when they put more than one accent
on top of a character, or to accommodate an unusual character in
an exotic language, so it is possible (though rare) that this
value will be too small.
<p> <p>See also <a href="#descent">descent</a>().

<p>Examples: <a href="drawdemo-example.html#x1064">drawdemo/drawdemo.cpp</a> and <a href="scrollview-example.html#x619">scrollview/scrollview.cpp</a>.
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="boundingRect"></a>TQFontMetrics::boundingRect ( <a href="qchar.html">TQChar</a>&nbsp;ch ) const
</h3>
Returns the rectangle that is covered by ink if the character
specified by <em>ch</em> were to be drawn at the origin of the coordinate
system.
<p> Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the text output may cover <em>all</em> pixels in the bounding rectangle. For a space character the rectangle
will usually be empty.
<p> Note that the rectangle usually extends both above and below the
base line.
<p> <b>Warning:</b> The width of the returned rectangle is not the advance width
of the character. Use <a href="#boundingRect">boundingRect</a>(const <a href="tqstring.html">TQString</a> &) or <a href="#width">width</a>() instead.
<p> <p>See also <a href="#width">width</a>().

<p>Example: <a href="xform-example.html#x1225">xform/xform.cpp</a>.
<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="boundingRect-2"></a>TQFontMetrics::boundingRect ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;str, int&nbsp;len = -1 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the bounding rectangle that contains the first <em>len</em>
characters of string <em>str</em>.

<h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="boundingRect-3"></a>TQFontMetrics::boundingRect ( int&nbsp;x, int&nbsp;y, int&nbsp;w, int&nbsp;h, int&nbsp;flgs, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;str, int&nbsp;len = -1, int&nbsp;tabstops = 0, int&nbsp;*&nbsp;tabarray = 0, TQTextParag&nbsp;**&nbsp;intern = 0 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the bounding rectangle of the first <em>len</em> characters of
<em>str</em>, which is the set of pixels the text would cover if drawn
at (0, 0). The drawing, and hence the bounding rectangle, is
constrained to the rectangle (<em>x</em>, <em>y</em>, <em>w</em>, <em>h</em>).
<p> If <em>len</em> is negative (which is the default), the entire string is
used.
<p> The <em>flgs</em> argument is the bitwise OR of the following flags:
<ul>
<li> <tt>AlignAuto</tt> aligns to the left border for all languages except
Arabic and Hebrew where it aligns to the right.
<li> <tt>AlignLeft</tt> aligns to the left border.
<li> <tt>AlignRight</tt> aligns to the right border.
<li> <tt>AlignJustify</tt> produces justified text.
<li> <tt>AlignHCenter</tt> aligns horizontally centered.
<li> <tt>AlignTop</tt> aligns to the top border.
<li> <tt>AlignBottom</tt> aligns to the bottom border.
<li> <tt>AlignVCenter</tt> aligns vertically centered
<li> <tt>AlignCenter</tt> (== <tt>AlignHCenter | AlignVCenter</tt>)
<li> <tt>SingleLine</tt> ignores newline characters in the text.
<li> <tt>ExpandTabs</tt> expands tabs (see below)
<li> <tt>ShowPrefix</tt> interprets "&amp;x" as "<u>x</u>", i.e. underlined.
<li> <tt>WordBreak</tt> breaks the text to fit the rectangle.
</ul>
<p> Horizontal alignment defaults to <tt>AlignAuto</tt> and vertical
alignment defaults to <tt>AlignTop</tt>.
<p> If several of the horizontal or several of the vertical alignment
flags are set, the resulting alignment is undefined.
<p> These flags are defined in <a href="qnamespace-h.html">ntqnamespace.h</a>.
<p> If <tt>ExpandTabs</tt> is set in <em>flgs</em>, then: if <em>tabarray</em> is
non-null, it specifies a 0-terminated sequence of pixel-positions
for tabs; otherwise if <em>tabstops</em> is non-zero, it is used as the
tab spacing (in pixels).
<p> Note that the bounding rectangle may extend to the left of (0, 0),
e.g. for italicized fonts, and that the text output may cover <em>all</em> pixels in the bounding rectangle.
<p> Newline characters are processed as linebreaks.
<p> Despite the different actual character heights, the heights of the
bounding rectangles of "Yes" and "yes" are the same.
<p> The bounding rectangle given by this function is somewhat larger
than that calculated by the simpler <a href="#boundingRect">boundingRect</a>() function. This
function uses the <a href="#minLeftBearing">maximum left</a> and
<a href="#minRightBearing">right</a> font bearings as is
necessary for multi-line text to align correctly. Also,
fontHeight() and <a href="#lineSpacing">lineSpacing</a>() are used to calculate the height,
rather than individual character heights.
<p> The <em>intern</em> argument should not be used.
<p> <p>See also <a href="#width">width</a>(), <a href="ntqpainter.html#boundingRect">TQPainter::boundingRect</a>(), and <a href="ntqt.html#AlignmentFlags-enum">TQt::AlignmentFlags</a>.

<h3 class=fn>int <a name="charWidth"></a>TQFontMetrics::charWidth ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;str, int&nbsp;pos ) const
</h3> 
Returns the width of the character at position <em>pos</em> in the
string <em>str</em>.
<p> The whole string is needed, as the glyph drawn may change
depending on the context (the letter before and after the current
one) for some languages (e.g. Arabic).
<p> This function also takes non spacing marks and ligatures into
account.

<h3 class=fn>int <a name="descent"></a>TQFontMetrics::descent () const
</h3>
Returns the descent of the font.
<p> The descent is the distance from the base line to the lowest point
characters extend to. (Note that this is different from X, which
adds 1 pixel.) In practice, some font designers break this rule,
e.g. to accommodate an unusual character in an exotic language, so
it is possible (though rare) that this value will be too small.
<p> <p>See also <a href="#ascent">ascent</a>().

<p>Examples: <a href="drawdemo-example.html#x1065">drawdemo/drawdemo.cpp</a> and <a href="hello-example.html#x1629">hello/hello.cpp</a>.
<h3 class=fn>int <a name="height"></a>TQFontMetrics::height () const
</h3>
Returns the height of the font.
<p> This is always equal to <a href="#ascent">ascent</a>()+descent()+1 (the 1 is for the
base line).
<p> <p>See also <a href="#leading">leading</a>() and <a href="#lineSpacing">lineSpacing</a>().

<p>Examples: <a href="grapher-nsplugin-example.html#x2741">grapher/grapher.cpp</a>, <a href="hello-example.html#x1630">hello/hello.cpp</a>, and <a href="qfd-example.html#x1986">qfd/fontdisplayer.cpp</a>.
<h3 class=fn>bool <a name="inFont"></a>TQFontMetrics::inFont ( <a href="qchar.html">TQChar</a>&nbsp;ch ) const
</h3>
Returns TRUE if character <em>ch</em> is a valid character in the font;
otherwise returns FALSE.

<p>Example: <a href="qfd-example.html#x1987">qfd/fontdisplayer.cpp</a>.
<h3 class=fn>int <a name="leading"></a>TQFontMetrics::leading () const
</h3>
Returns the leading of the font.
<p> This is the natural inter-line spacing.
<p> <p>See also <a href="#height">height</a>() and <a href="#lineSpacing">lineSpacing</a>().

<h3 class=fn>int <a name="leftBearing"></a>TQFontMetrics::leftBearing ( <a href="qchar.html">TQChar</a>&nbsp;ch ) const
</h3> 
Returns the left bearing of character <em>ch</em> in the font.
<p> The left bearing is the right-ward distance of the left-most pixel
of the character from the logical origin of the character. This
value is negative if the pixels of the character extend to the
left of the logical origin.
<p> See <a href="#width">width</a>(<a href="qchar.html">TQChar</a>) for a graphical description of this metric.
<p> <p>See also <a href="#rightBearing">rightBearing</a>(), <a href="#minLeftBearing">minLeftBearing</a>(), and <a href="#width">width</a>().

<p>Example: <a href="qfd-example.html#x1988">qfd/fontdisplayer.cpp</a>.
<h3 class=fn>int <a name="lineSpacing"></a>TQFontMetrics::lineSpacing () const
</h3>
Returns the distance from one base line to the next.
<p> This value is always equal to <a href="#leading">leading</a>()+height().
<p> <p>See also <a href="#height">height</a>() and <a href="#leading">leading</a>().

<p>Examples: <a href="qfd-example.html#x1989">qfd/fontdisplayer.cpp</a>, <a href="qwerty-example.html#x369">qwerty/qwerty.cpp</a>, and <a href="scrollview-example.html#x620">scrollview/scrollview.cpp</a>.
<h3 class=fn>int <a name="lineWidth"></a>TQFontMetrics::lineWidth () const
</h3>
Returns the width of the underline and strikeout lines, adjusted
for the point size of the font.
<p> <p>See also <a href="#underlinePos">underlinePos</a>(), <a href="#overlinePos">overlinePos</a>(), and <a href="#strikeOutPos">strikeOutPos</a>().

<h3 class=fn>int <a name="maxWidth"></a>TQFontMetrics::maxWidth () const
</h3>
Returns the width of the widest character in the font.

<p>Example: <a href="qfd-example.html#x1990">qfd/fontdisplayer.cpp</a>.
<h3 class=fn>int <a name="minLeftBearing"></a>TQFontMetrics::minLeftBearing () const
</h3>
Returns the minimum left bearing of the font.
<p> This is the smallest <a href="#leftBearing">leftBearing</a>(char) of all characters in the
font.
<p> Note that this function can be very slow if the font is large.
<p> <p>See also <a href="#minRightBearing">minRightBearing</a>() and <a href="#leftBearing">leftBearing</a>().

<p>Example: <a href="qfd-example.html#x1991">qfd/fontdisplayer.cpp</a>.
<h3 class=fn>int <a name="minRightBearing"></a>TQFontMetrics::minRightBearing () const
</h3>
Returns the minimum right bearing of the font.
<p> This is the smallest <a href="#rightBearing">rightBearing</a>(char) of all characters in the
font.
<p> Note that this function can be very slow if the font is large.
<p> <p>See also <a href="#minLeftBearing">minLeftBearing</a>() and <a href="#rightBearing">rightBearing</a>().

<p>Example: <a href="qfd-example.html#x1992">qfd/fontdisplayer.cpp</a>.
<h3 class=fn><a href="ntqfontmetrics.html">TQFontMetrics</a>&nbsp;&amp; <a name="operator-eq"></a>TQFontMetrics::operator= ( const&nbsp;<a href="ntqfontmetrics.html">TQFontMetrics</a>&nbsp;&amp;&nbsp;fm )
</h3>
Assigns the font metrics <em>fm</em>.

<h3 class=fn>int <a name="overlinePos"></a>TQFontMetrics::overlinePos () const
</h3>
Returns the distance from the base line to where an overline
should be drawn.
<p> <p>See also <a href="#underlinePos">underlinePos</a>(), <a href="#strikeOutPos">strikeOutPos</a>(), and <a href="#lineWidth">lineWidth</a>().

<h3 class=fn>int <a name="rightBearing"></a>TQFontMetrics::rightBearing ( <a href="qchar.html">TQChar</a>&nbsp;ch ) const
</h3> 
Returns the right bearing of character <em>ch</em> in the font.
<p> The right bearing is the left-ward distance of the right-most
pixel of the character from the logical origin of a subsequent
character. This value is negative if the pixels of the character
extend to the right of the <a href="#width">width</a>() of the character.
<p> See width() for a graphical description of this metric.
<p> <p>See also <a href="#leftBearing">leftBearing</a>(), <a href="#minRightBearing">minRightBearing</a>(), and <a href="#width">width</a>().

<p>Example: <a href="qfd-example.html#x1993">qfd/fontdisplayer.cpp</a>.
<h3 class=fn><a href="ntqsize.html">TQSize</a> <a name="size"></a>TQFontMetrics::size ( int&nbsp;flgs, const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;str, int&nbsp;len = -1, int&nbsp;tabstops = 0, int&nbsp;*&nbsp;tabarray = 0, TQTextParag&nbsp;**&nbsp;intern = 0 ) const
</h3>
Returns the size in pixels of the first <em>len</em> characters of <em>str</em>.
<p> If <em>len</em> is negative (the default), the entire string is used.
<p> The <em>flgs</em> argument is the bitwise OR of the following flags:
<ul>
<li> <tt>SingleLine</tt> ignores newline characters.
<li> <tt>ExpandTabs</tt> expands tabs (see below)
<li> <tt>ShowPrefix</tt> interprets "&amp;x" as "<u>x</u>", i.e. underlined.
<li> <tt>WordBreak</tt> breaks the text to fit the rectangle.
</ul>
<p> These flags are defined in <a href="qnamespace-h.html">ntqnamespace.h</a>.
<p> If <tt>ExpandTabs</tt> is set in <em>flgs</em>, then: if <em>tabarray</em> is
non-null, it specifies a 0-terminated sequence of pixel-positions
for tabs; otherwise if <em>tabstops</em> is non-zero, it is used as the
tab spacing (in pixels).
<p> Newline characters are processed as linebreaks.
<p> Despite the different actual character heights, the heights of the
bounding rectangles of "Yes" and "yes" are the same.
<p> The <em>intern</em> argument should not be used.
<p> <p>See also <a href="#boundingRect">boundingRect</a>().

<h3 class=fn>int <a name="strikeOutPos"></a>TQFontMetrics::strikeOutPos () const
</h3>
Returns the distance from the base line to where the strikeout
line should be drawn.
<p> <p>See also <a href="#underlinePos">underlinePos</a>(), <a href="#overlinePos">overlinePos</a>(), and <a href="#lineWidth">lineWidth</a>().

<h3 class=fn>int <a name="underlinePos"></a>TQFontMetrics::underlinePos () const
</h3>
Returns the distance from the base line to where an underscore
should be drawn.
<p> <p>See also <a href="#overlinePos">overlinePos</a>(), <a href="#strikeOutPos">strikeOutPos</a>(), and <a href="#lineWidth">lineWidth</a>().

<h3 class=fn>int <a name="width"></a>TQFontMetrics::width ( <a href="qchar.html">TQChar</a>&nbsp;ch ) const
</h3> 
<p> <img src="bearings.png" align=right>
<p> Returns the logical width of character <em>ch</em> in pixels. This is a
distance appropriate for drawing a subsequent character after <em>ch</em>.
<p> Some of the metrics are described in the image to the right. The
central dark rectangles cover the logical <a href="#width">width</a>() of each
character. The outer pale rectangles cover the <a href="#leftBearing">leftBearing</a>() and
<a href="#rightBearing">rightBearing</a>() of each character. Notice that the bearings of "f"
in this particular font are both negative, while the bearings of
"o" are both positive.
<p> <b>Warning:</b> This function will produce incorrect results for Arabic
characters or non spacing marks in the middle of a string, as the
glyph shaping and positioning of marks that happens when
processing strings cannot be taken into account. Use <a href="#charWidth">charWidth</a>()
instead if you aren't looking for the width of isolated
characters.
<p> <p>See also <a href="#boundingRect">boundingRect</a>() and <a href="#charWidth">charWidth</a>().

<p>Examples: <a href="drawdemo-example.html#x1066">drawdemo/drawdemo.cpp</a>, <a href="hello-example.html#x1631">hello/hello.cpp</a>, <a href="movies-example.html#x496">movies/main.cpp</a>, <a href="qfd-example.html#x1994">qfd/fontdisplayer.cpp</a>, and <a href="scrollview-example.html#x621">scrollview/scrollview.cpp</a>.
<h3 class=fn>int <a name="width-2"></a>TQFontMetrics::width ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;str, int&nbsp;len = -1 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the width of the first <em>len</em> characters of string <em>str</em>.

<h3 class=fn>int <a name="width-3"></a>TQFontMetrics::width ( char&nbsp;c ) const
</h3> 
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Provided to aid porting from TQt 1.x.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>