commit extjs-2.2.1
[extjs.git] / docs / output / Ext.util.TextMetrics.html
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>
7         </div>
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>
14                     </table>
15         <div class="description">
16             *
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>
19         
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">
26             <tr>
27                 <th class="sig-header" colspan="2">Method</th>
28                 <th class="msource-header">Defined By</th>
29             </tr>
30                 <tr class="method-row expandable">\r
31         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
32         <td class="sig">\r
33         <a id="Ext.util.TextMetrics-bind"></a>\r
34             <b>bind</b>(&nbsp;<code>String/HTMLElement el</code>&nbsp;) : 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
37             <div class="long">\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
43         <ul>\r
44             <li><code>void</code></li>\r
45         </ul>\r
46     </div>\r
47                 </div>\r
48                         </div>\r
49         </td>\r
50         <td class="msource">TextMetrics</td>\r
51     </tr>\r
52         <tr class="method-row alt expandable">\r
53         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
54         <td class="sig">\r
55         <a id="Ext.util.TextMetrics-createInstance"></a>\r
56             <b>createInstance</b>(&nbsp;<code>String/HTMLElement el</code>, <span class="optional" title="Optional">[<code>Number fixedWidth</code>]</span>&nbsp;) : 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
59             <div class="long">\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
66         <ul>\r
67             <li><code>Ext.util.TextMetrics.Instance</code><div class="sub-desc">instance The new instance</div></li>\r
68         </ul>\r
69     </div>\r
70                 </div>\r
71                         </div>\r
72         </td>\r
73         <td class="msource">TextMetrics</td>\r
74     </tr>\r
75         <tr class="method-row expandable">\r
76         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
77         <td class="sig">\r
78         <a id="Ext.util.TextMetrics-getHeight"></a>\r
79             <b>getHeight</b>(&nbsp;<code>String text</code>&nbsp;) : 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
82             <div class="long">\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
88         <ul>\r
89             <li><code>Number</code><div class="sub-desc">height The height in pixels</div></li>\r
90         </ul>\r
91     </div>\r
92                 </div>\r
93                         </div>\r
94         </td>\r
95         <td class="msource">TextMetrics</td>\r
96     </tr>\r
97         <tr class="method-row alt expandable">\r
98         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
99         <td class="sig">\r
100         <a id="Ext.util.TextMetrics-getSize"></a>\r
101             <b>getSize</b>(&nbsp;<code>String text</code>&nbsp;) : 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
103             <div class="long">\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
108         <ul>\r
109             <li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li>\r
110         </ul>\r
111     </div>\r
112                 </div>\r
113                         </div>\r
114         </td>\r
115         <td class="msource">TextMetrics</td>\r
116     </tr>\r
117         <tr class="method-row expandable">\r
118         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
119         <td class="sig">\r
120         <a id="Ext.util.TextMetrics-getWidth"></a>\r
121             <b>getWidth</b>(&nbsp;<code>String text</code>&nbsp;) : Number            <div class="mdesc">\r
122                         <div class="short">Returns the measured width of the specified text</div>\r
123             <div class="long">\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
128         <ul>\r
129             <li><code>Number</code><div class="sub-desc">width The width in pixels</div></li>\r
130         </ul>\r
131     </div>\r
132                 </div>\r
133                         </div>\r
134         </td>\r
135         <td class="msource">TextMetrics</td>\r
136     </tr>\r
137         <tr class="method-row alt expandable">\r
138         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
139         <td class="sig">\r
140         <a id="Ext.util.TextMetrics-measure"></a>\r
141             <b>measure</b>(&nbsp;<code>String/HTMLElement el</code>, <code>String text</code>, <span class="optional" title="Optional">[<code>Number fixedWidth</code>]</span>&nbsp;) : Object            <div class="mdesc">\r
142                         <div class="short">Measures the size of the specified text</div>\r
143             <div class="long">\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
150         <ul>\r
151             <li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li>\r
152         </ul>\r
153     </div>\r
154                 </div>\r
155                         </div>\r
156         </td>\r
157         <td class="msource">TextMetrics</td>\r
158     </tr>\r
159         <tr class="method-row expandable">\r
160         <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>\r
161         <td class="sig">\r
162         <a id="Ext.util.TextMetrics-setFixedWidth"></a>\r
163             <b>setFixedWidth</b>(&nbsp;<code>Number width</code>&nbsp;) : 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
166             <div class="long">\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
172         <ul>\r
173             <li><code>void</code></li>\r
174         </ul>\r
175     </div>\r
176                 </div>\r
177                         </div>\r
178         </td>\r
179         <td class="msource">TextMetrics</td>\r
180     </tr>\r
181             </table>
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>
185         </div>