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"> |
---|
31 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
32 | <td class="sig"> |
---|
33 | <a id="Ext.util.TextMetrics-bind"></a> |
---|
34 | <b>bind</b>( <code>String/HTMLElement el</code> ) : void <div class="mdesc"> |
---|
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> |
---|
37 | <div class="long"> |
---|
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"> |
---|
40 | <strong>Parameters:</strong> |
---|
41 | <ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">The element, dom node or id</div></li> </ul> |
---|
42 | <strong>Returns:</strong> |
---|
43 | <ul> |
---|
44 | <li><code>void</code></li> |
---|
45 | </ul> |
---|
46 | </div> |
---|
47 | </div> |
---|
48 | </div> |
---|
49 | </td> |
---|
50 | <td class="msource">TextMetrics</td> |
---|
51 | </tr> |
---|
52 | <tr class="method-row alt expandable"> |
---|
53 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
54 | <td class="sig"> |
---|
55 | <a id="Ext.util.TextMetrics-createInstance"></a> |
---|
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"> |
---|
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> |
---|
59 | <div class="long"> |
---|
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"> |
---|
62 | <strong>Parameters:</strong> |
---|
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> |
---|
65 | <strong>Returns:</strong> |
---|
66 | <ul> |
---|
67 | <li><code>Ext.util.TextMetrics.Instance</code><div class="sub-desc">instance The new instance</div></li> |
---|
68 | </ul> |
---|
69 | </div> |
---|
70 | </div> |
---|
71 | </div> |
---|
72 | </td> |
---|
73 | <td class="msource">TextMetrics</td> |
---|
74 | </tr> |
---|
75 | <tr class="method-row expandable"> |
---|
76 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
77 | <td class="sig"> |
---|
78 | <a id="Ext.util.TextMetrics-getHeight"></a> |
---|
79 | <b>getHeight</b>( <code>String text</code> ) : Number <div class="mdesc"> |
---|
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> |
---|
82 | <div class="long"> |
---|
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"> |
---|
85 | <strong>Parameters:</strong> |
---|
86 | <ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul> |
---|
87 | <strong>Returns:</strong> |
---|
88 | <ul> |
---|
89 | <li><code>Number</code><div class="sub-desc">height The height in pixels</div></li> |
---|
90 | </ul> |
---|
91 | </div> |
---|
92 | </div> |
---|
93 | </div> |
---|
94 | </td> |
---|
95 | <td class="msource">TextMetrics</td> |
---|
96 | </tr> |
---|
97 | <tr class="method-row alt expandable"> |
---|
98 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
99 | <td class="sig"> |
---|
100 | <a id="Ext.util.TextMetrics-getSize"></a> |
---|
101 | <b>getSize</b>( <code>String text</code> ) : Object <div class="mdesc"> |
---|
102 | <div class="short">Returns the size of the specified text based on the internal element's style and width properties</div> |
---|
103 | <div class="long"> |
---|
104 | Returns the size of the specified text based on the internal element's style and width properties <div class="mdetail-params"> |
---|
105 | <strong>Parameters:</strong> |
---|
106 | <ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul> |
---|
107 | <strong>Returns:</strong> |
---|
108 | <ul> |
---|
109 | <li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li> |
---|
110 | </ul> |
---|
111 | </div> |
---|
112 | </div> |
---|
113 | </div> |
---|
114 | </td> |
---|
115 | <td class="msource">TextMetrics</td> |
---|
116 | </tr> |
---|
117 | <tr class="method-row expandable"> |
---|
118 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
119 | <td class="sig"> |
---|
120 | <a id="Ext.util.TextMetrics-getWidth"></a> |
---|
121 | <b>getWidth</b>( <code>String text</code> ) : Number <div class="mdesc"> |
---|
122 | <div class="short">Returns the measured width of the specified text</div> |
---|
123 | <div class="long"> |
---|
124 | Returns the measured width of the specified text <div class="mdetail-params"> |
---|
125 | <strong>Parameters:</strong> |
---|
126 | <ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul> |
---|
127 | <strong>Returns:</strong> |
---|
128 | <ul> |
---|
129 | <li><code>Number</code><div class="sub-desc">width The width in pixels</div></li> |
---|
130 | </ul> |
---|
131 | </div> |
---|
132 | </div> |
---|
133 | </div> |
---|
134 | </td> |
---|
135 | <td class="msource">TextMetrics</td> |
---|
136 | </tr> |
---|
137 | <tr class="method-row alt expandable"> |
---|
138 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
139 | <td class="sig"> |
---|
140 | <a id="Ext.util.TextMetrics-measure"></a> |
---|
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"> |
---|
142 | <div class="short">Measures the size of the specified text</div> |
---|
143 | <div class="long"> |
---|
144 | Measures the size of the specified text <div class="mdetail-params"> |
---|
145 | <strong>Parameters:</strong> |
---|
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> |
---|
149 | <strong>Returns:</strong> |
---|
150 | <ul> |
---|
151 | <li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li> |
---|
152 | </ul> |
---|
153 | </div> |
---|
154 | </div> |
---|
155 | </div> |
---|
156 | </td> |
---|
157 | <td class="msource">TextMetrics</td> |
---|
158 | </tr> |
---|
159 | <tr class="method-row expandable"> |
---|
160 | <td class="micon"><a class="exi" href="#expand"> </a></td> |
---|
161 | <td class="sig"> |
---|
162 | <a id="Ext.util.TextMetrics-setFixedWidth"></a> |
---|
163 | <b>setFixedWidth</b>( <code>Number width</code> ) : void <div class="mdesc"> |
---|
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> |
---|
166 | <div class="long"> |
---|
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"> |
---|
169 | <strong>Parameters:</strong> |
---|
170 | <ul><li><code>width</code> : Number<div class="sub-desc">The width to set on the element</div></li> </ul> |
---|
171 | <strong>Returns:</strong> |
---|
172 | <ul> |
---|
173 | <li><code>void</code></li> |
---|
174 | </ul> |
---|
175 | </div> |
---|
176 | </div> |
---|
177 | </div> |
---|
178 | </td> |
---|
179 | <td class="msource">TextMetrics</td> |
---|
180 | </tr> |
---|
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> |
---|