1 <div class="body-wrap">
2 <div class="top-tools">
3 <a class="inner-link" href="#Ext.util.TextMetrics-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
4 <a class="inner-link" href="#Ext.util.TextMetrics-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
5 <a class="inner-link" href="#Ext.util.TextMetrics-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
6 <a class="bookmark" href="../docs/?class=Ext.util.TextMetrics"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
8 <h1>Class Ext.util.TextMetrics</h1>
9 <table cellspacing="0">
10 <tr><td class="label">Package:</td><td class="hd-info">Ext.util</td></tr>
11 <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/TextMetrics.js" target="_blank">TextMetrics.js</a></td></tr>
12 <tr><td class="label">Class:</td><td class="hd-info">TextMetrics</td></tr>
13 <tr><td class="label">Extends:</td><td class="hd-info">Object</td></tr>
15 <div class="description">
17 Provides precise pixel measurements for blocks of text so that you can determine exactly how high and
18 wide, in pixels, a given block of text will be.<br><br><i>This class is a singleton and cannot be created directly.</i> </div>
20 <div class="hr"></div>
21 <a id="Ext.util.TextMetrics-props"></a>
22 <h2>Public Properties</h2>
23 <div class="no-members">This class has no public properties.</div> <a id="Ext.util.TextMetrics-methods"></a>
24 <h2>Public Methods</h2>
25 <table cellspacing="0" class="member-table">
27 <th class="sig-header" colspan="2">Method</th>
28 <th class="msource-header">Defined By</th>
30 <tr class="method-row expandable">
\r
31 <td class="micon"><a class="exi" href="#expand"> </a></td>
\r
33 <a id="Ext.util.TextMetrics-bind"></a>
\r
34 <b>bind</b>( <code>String/HTMLElement el</code> ) : void <div class="mdesc">
\r
35 <div class="short">Binds this TextMetrics instance to an element from which to copy existing CSS styles
36 that can affect the size of the ...</div>
\r
38 Binds this TextMetrics instance to an element from which to copy existing CSS styles
39 that can affect the size of the rendered text <div class="mdetail-params">
\r
40 <strong>Parameters:</strong>
\r
41 <ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">The element, dom node or id</div></li> </ul>
\r
42 <strong>Returns:</strong>
\r
44 <li><code>void</code></li>
\r
50 <td class="msource">TextMetrics</td>
\r
52 <tr class="method-row alt expandable">
\r
53 <td class="micon"><a class="exi" href="#expand"> </a></td>
\r
55 <a id="Ext.util.TextMetrics-createInstance"></a>
\r
56 <b>createInstance</b>( <code>String/HTMLElement el</code>, <span class="optional" title="Optional">[<code>Number fixedWidth</code>]</span> ) : Ext.util.TextMetrics.Instance <div class="mdesc">
\r
57 <div class="short">Return a unique TextMetrics instance that can be bound directly to an element and reused. This reduces
58 the overhead ...</div>
\r
60 Return a unique TextMetrics instance that can be bound directly to an element and reused. This reduces
61 the overhead of multiple calls to initialize the style properties on each measurement. <div class="mdetail-params">
\r
62 <strong>Parameters:</strong>
\r
63 <ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">The element, dom node or id that the instance will be bound to</div></li><li><code>fixedWidth</code> : Number<div class="sub-desc">(optional) If the text will be multiline, you have to set a fixed width
64 in order to accurately measure the text height</div></li> </ul>
\r
65 <strong>Returns:</strong>
\r
67 <li><code>Ext.util.TextMetrics.Instance</code><div class="sub-desc">instance The new instance</div></li>
\r
73 <td class="msource">TextMetrics</td>
\r
75 <tr class="method-row expandable">
\r
76 <td class="micon"><a class="exi" href="#expand"> </a></td>
\r
78 <a id="Ext.util.TextMetrics-getHeight"></a>
\r
79 <b>getHeight</b>( <code>String text</code> ) : Number <div class="mdesc">
\r
80 <div class="short">Returns the measured height of the specified text. For multiline text, be sure to call
81 <a ext:cls="Ext.util.TextMetrics" ext:member="setFixedWidth" href="output/Ext.util.TextMetrics.html#setFixedWidth">setFixedWidth</a> if necessary.</div>
\r
83 Returns the measured height of the specified text. For multiline text, be sure to call
84 <a ext:cls="Ext.util.TextMetrics" ext:member="setFixedWidth" href="output/Ext.util.TextMetrics.html#setFixedWidth">setFixedWidth</a> if necessary. <div class="mdetail-params">
\r
85 <strong>Parameters:</strong>
\r
86 <ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
\r
87 <strong>Returns:</strong>
\r
89 <li><code>Number</code><div class="sub-desc">height The height in pixels</div></li>
\r
95 <td class="msource">TextMetrics</td>
\r
97 <tr class="method-row alt expandable">
\r
98 <td class="micon"><a class="exi" href="#expand"> </a></td>
\r
100 <a id="Ext.util.TextMetrics-getSize"></a>
\r
101 <b>getSize</b>( <code>String text</code> ) : Object <div class="mdesc">
\r
102 <div class="short">Returns the size of the specified text based on the internal element's style and width properties</div>
\r
104 Returns the size of the specified text based on the internal element's style and width properties <div class="mdetail-params">
\r
105 <strong>Parameters:</strong>
\r
106 <ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
\r
107 <strong>Returns:</strong>
\r
109 <li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li>
\r
115 <td class="msource">TextMetrics</td>
\r
117 <tr class="method-row expandable">
\r
118 <td class="micon"><a class="exi" href="#expand"> </a></td>
\r
120 <a id="Ext.util.TextMetrics-getWidth"></a>
\r
121 <b>getWidth</b>( <code>String text</code> ) : Number <div class="mdesc">
\r
122 <div class="short">Returns the measured width of the specified text</div>
\r
124 Returns the measured width of the specified text <div class="mdetail-params">
\r
125 <strong>Parameters:</strong>
\r
126 <ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
\r
127 <strong>Returns:</strong>
\r
129 <li><code>Number</code><div class="sub-desc">width The width in pixels</div></li>
\r
135 <td class="msource">TextMetrics</td>
\r
137 <tr class="method-row alt expandable">
\r
138 <td class="micon"><a class="exi" href="#expand"> </a></td>
\r
140 <a id="Ext.util.TextMetrics-measure"></a>
\r
141 <b>measure</b>( <code>String/HTMLElement el</code>, <code>String text</code>, <span class="optional" title="Optional">[<code>Number fixedWidth</code>]</span> ) : Object <div class="mdesc">
\r
142 <div class="short">Measures the size of the specified text</div>
\r
144 Measures the size of the specified text <div class="mdetail-params">
\r
145 <strong>Parameters:</strong>
\r
146 <ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">The element, dom node or id from which to copy existing CSS styles
147 that can affect the size of the rendered text</div></li><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li><li><code>fixedWidth</code> : Number<div class="sub-desc">(optional) If the text will be multiline, you have to set a fixed width
148 in order to accurately measure the text height</div></li> </ul>
\r
149 <strong>Returns:</strong>
\r
151 <li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li>
\r
157 <td class="msource">TextMetrics</td>
\r
159 <tr class="method-row expandable">
\r
160 <td class="micon"><a class="exi" href="#expand"> </a></td>
\r
162 <a id="Ext.util.TextMetrics-setFixedWidth"></a>
\r
163 <b>setFixedWidth</b>( <code>Number width</code> ) : void <div class="mdesc">
\r
164 <div class="short">Sets a fixed width on the internal measurement element. If the text will be multiline, you have
165 to set a fixed width...</div>
\r
167 Sets a fixed width on the internal measurement element. If the text will be multiline, you have
168 to set a fixed width in order to accurately measure the text height. <div class="mdetail-params">
\r
169 <strong>Parameters:</strong>
\r
170 <ul><li><code>width</code> : Number<div class="sub-desc">The width to set on the element</div></li> </ul>
\r
171 <strong>Returns:</strong>
\r
173 <li><code>void</code></li>
\r
179 <td class="msource">TextMetrics</td>
\r
182 <a id="Ext.util.TextMetrics-events"></a>
183 <h2>Public Events</h2>
184 <div class="no-members">This class has no public events.</div>