<!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 Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped 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 <<a href="qfontmetrics-h.html">ntqfontmetrics.h</a>></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 TQFont & font )</li> <li class=fn><a href="#TQFontMetrics-2"><b>TQFontMetrics</b></a> ( const TQFont & font, TQFont::Script script )</li> <li class=fn><a href="#TQFontMetrics-3"><b>TQFontMetrics</b></a> ( const TQFontMetrics & fm )</li> <li class=fn><a href="#~TQFontMetrics"><b>~TQFontMetrics</b></a> ()</li> <li class=fn>TQFontMetrics & <a href="#operator-eq"><b>operator=</b></a> ( const TQFontMetrics & 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 ch ) const</li> <li class=fn>int <a href="#leftBearing"><b>leftBearing</b></a> ( TQChar ch ) const</li> <li class=fn>int <a href="#rightBearing"><b>rightBearing</b></a> ( TQChar ch ) const</li> <li class=fn>int <a href="#width-2"><b>width</b></a> ( const TQString & str, int len = -1 ) const</li> <li class=fn>int <a href="#width"><b>width</b></a> ( TQChar ch ) const</li> <li class=fn>int width ( char c ) const <em>(obsolete)</em></li> <li class=fn>int <a href="#charWidth"><b>charWidth</b></a> ( const TQString & str, int pos ) const</li> <li class=fn>TQRect <a href="#boundingRect-2"><b>boundingRect</b></a> ( const TQString & str, int len = -1 ) const</li> <li class=fn>TQRect <a href="#boundingRect"><b>boundingRect</b></a> ( TQChar ch ) const</li> <li class=fn>TQRect <a href="#boundingRect-3"><b>boundingRect</b></a> ( int x, int y, int w, int h, int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, TQTextParag ** intern = 0 ) const</li> <li class=fn>TQSize <a href="#size"><b>size</b></a> ( int flgs, const TQString & str, int len = -1, int tabstops = 0, int * tabarray = 0, TQTextParag ** 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="ntqwidget.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 <a href="ntqfont.html">TQFont</a> & 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="ntqwidget.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 <a href="ntqfont.html">TQFont</a> & font, <a href="ntqfont.html#Script-enum">TQFont::Script</a> 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 <a href="ntqfontmetrics.html">TQFontMetrics</a> & 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> 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="ntqstring.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 <a href="ntqstring.html">TQString</a> & str, int 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 x, int y, int w, int h, int flgs, const <a href="ntqstring.html">TQString</a> & str, int len = -1, int tabstops = 0, int * tabarray = 0, TQTextParag ** 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 "&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 <a href="ntqstring.html">TQString</a> & str, int 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> 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> 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> & <a name="operator-eq"></a>TQFontMetrics::operator= ( const <a href="ntqfontmetrics.html">TQFontMetrics</a> & 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> 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 flgs, const <a href="ntqstring.html">TQString</a> & str, int len = -1, int tabstops = 0, int * tabarray = 0, TQTextParag ** 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 "&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> 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 <a href="ntqstring.html">TQString</a> & str, int 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 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 © 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 © 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>