2 |
aperonnet |
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="../source/util/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 |
Provides precise pixel measurements for blocks of text so that you can determine exactly how high and
|
|
|
17 |
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>
|
|
|
18 |
|
|
|
19 |
<div class="hr"></div>
|
|
|
20 |
<a id="Ext.util.TextMetrics-props"></a>
|
|
|
21 |
<h2>Public Properties</h2>
|
|
|
22 |
<div class="no-members">This class has no public properties.</div> <a id="Ext.util.TextMetrics-methods"></a>
|
|
|
23 |
<h2>Public Methods</h2>
|
|
|
24 |
<table cellspacing="0" class="member-table">
|
|
|
25 |
<tr>
|
|
|
26 |
<th class="sig-header" colspan="2">Method</th>
|
|
|
27 |
<th class="msource-header">Defined By</th>
|
|
|
28 |
</tr>
|
|
|
29 |
<tr class="method-row expandable">
|
|
|
30 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
31 |
<td class="sig">
|
|
|
32 |
<a id="Ext.util.TextMetrics-bind"></a>
|
|
|
33 |
<b>bind</b>( <code>String/HTMLElement el</code> ) : void <div class="mdesc">
|
|
|
34 |
<div class="short">Binds this TextMetrics instance to an element from which to copy existing CSS styles
|
|
|
35 |
that can affect the size of the ...</div>
|
|
|
36 |
<div class="long">
|
|
|
37 |
Binds this TextMetrics instance to an element from which to copy existing CSS styles
|
|
|
38 |
that can affect the size of the rendered text <div class="mdetail-params">
|
|
|
39 |
<strong>Parameters:</strong>
|
|
|
40 |
<ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">The element, dom node or id</div></li> </ul>
|
|
|
41 |
<strong>Returns:</strong>
|
|
|
42 |
<ul>
|
|
|
43 |
<li><code>void</code></li>
|
|
|
44 |
</ul>
|
|
|
45 |
</div>
|
|
|
46 |
</div>
|
|
|
47 |
</div>
|
|
|
48 |
</td>
|
|
|
49 |
<td class="msource">TextMetrics</td>
|
|
|
50 |
</tr>
|
|
|
51 |
<tr class="method-row alt expandable">
|
|
|
52 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
53 |
<td class="sig">
|
|
|
54 |
<a id="Ext.util.TextMetrics-createInstance"></a>
|
|
|
55 |
<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">
|
|
|
56 |
<div class="short">Return a unique TextMetrics instance that can be bound directly to an element and reused. This reduces
|
|
|
57 |
the overhead ...</div>
|
|
|
58 |
<div class="long">
|
|
|
59 |
Return a unique TextMetrics instance that can be bound directly to an element and reused. This reduces
|
|
|
60 |
the overhead of multiple calls to initialize the style properties on each measurement. <div class="mdetail-params">
|
|
|
61 |
<strong>Parameters:</strong>
|
|
|
62 |
<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
|
|
|
63 |
in order to accurately measure the text height</div></li> </ul>
|
|
|
64 |
<strong>Returns:</strong>
|
|
|
65 |
<ul>
|
|
|
66 |
<li><code>Ext.util.TextMetrics.Instance</code><div class="sub-desc">instance The new instance</div></li>
|
|
|
67 |
</ul>
|
|
|
68 |
</div>
|
|
|
69 |
</div>
|
|
|
70 |
</div>
|
|
|
71 |
</td>
|
|
|
72 |
<td class="msource">TextMetrics</td>
|
|
|
73 |
</tr>
|
|
|
74 |
<tr class="method-row expandable">
|
|
|
75 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
76 |
<td class="sig">
|
|
|
77 |
<a id="Ext.util.TextMetrics-getHeight"></a>
|
|
|
78 |
<b>getHeight</b>( <code>String text</code> ) : Number <div class="mdesc">
|
|
|
79 |
<div class="short">Returns the measured height of the specified text. For multiline text, be sure to call
|
|
|
80 |
<a ext:cls="Ext.util.TextMetrics" ext:member="setFixedWidth" href="output/Ext.util.TextMetrics.html#setFixedWidth">setFixedWidth</a> if necessary.</div>
|
|
|
81 |
<div class="long">
|
|
|
82 |
Returns the measured height of the specified text. For multiline text, be sure to call
|
|
|
83 |
<a ext:cls="Ext.util.TextMetrics" ext:member="setFixedWidth" href="output/Ext.util.TextMetrics.html#setFixedWidth">setFixedWidth</a> if necessary. <div class="mdetail-params">
|
|
|
84 |
<strong>Parameters:</strong>
|
|
|
85 |
<ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
|
|
|
86 |
<strong>Returns:</strong>
|
|
|
87 |
<ul>
|
|
|
88 |
<li><code>Number</code><div class="sub-desc">height The height in pixels</div></li>
|
|
|
89 |
</ul>
|
|
|
90 |
</div>
|
|
|
91 |
</div>
|
|
|
92 |
</div>
|
|
|
93 |
</td>
|
|
|
94 |
<td class="msource">TextMetrics</td>
|
|
|
95 |
</tr>
|
|
|
96 |
<tr class="method-row alt expandable">
|
|
|
97 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
98 |
<td class="sig">
|
|
|
99 |
<a id="Ext.util.TextMetrics-getSize"></a>
|
|
|
100 |
<b>getSize</b>( <code>String text</code> ) : Object <div class="mdesc">
|
|
|
101 |
<div class="short">Returns the size of the specified text based on the internal element's style and width properties</div>
|
|
|
102 |
<div class="long">
|
|
|
103 |
Returns the size of the specified text based on the internal element's style and width properties <div class="mdetail-params">
|
|
|
104 |
<strong>Parameters:</strong>
|
|
|
105 |
<ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
|
|
|
106 |
<strong>Returns:</strong>
|
|
|
107 |
<ul>
|
|
|
108 |
<li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li>
|
|
|
109 |
</ul>
|
|
|
110 |
</div>
|
|
|
111 |
</div>
|
|
|
112 |
</div>
|
|
|
113 |
</td>
|
|
|
114 |
<td class="msource">TextMetrics</td>
|
|
|
115 |
</tr>
|
|
|
116 |
<tr class="method-row expandable">
|
|
|
117 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
118 |
<td class="sig">
|
|
|
119 |
<a id="Ext.util.TextMetrics-getWidth"></a>
|
|
|
120 |
<b>getWidth</b>( <code>String text</code> ) : Number <div class="mdesc">
|
|
|
121 |
<div class="short">Returns the measured width of the specified text</div>
|
|
|
122 |
<div class="long">
|
|
|
123 |
Returns the measured width of the specified text <div class="mdetail-params">
|
|
|
124 |
<strong>Parameters:</strong>
|
|
|
125 |
<ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
|
|
|
126 |
<strong>Returns:</strong>
|
|
|
127 |
<ul>
|
|
|
128 |
<li><code>Number</code><div class="sub-desc">width The width in pixels</div></li>
|
|
|
129 |
</ul>
|
|
|
130 |
</div>
|
|
|
131 |
</div>
|
|
|
132 |
</div>
|
|
|
133 |
</td>
|
|
|
134 |
<td class="msource">TextMetrics</td>
|
|
|
135 |
</tr>
|
|
|
136 |
<tr class="method-row alt expandable">
|
|
|
137 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
138 |
<td class="sig">
|
|
|
139 |
<a id="Ext.util.TextMetrics-measure"></a>
|
|
|
140 |
<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">
|
|
|
141 |
<div class="short">Measures the size of the specified text</div>
|
|
|
142 |
<div class="long">
|
|
|
143 |
Measures the size of the specified text <div class="mdetail-params">
|
|
|
144 |
<strong>Parameters:</strong>
|
|
|
145 |
<ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">The element, dom node or id from which to copy existing CSS styles
|
|
|
146 |
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
|
|
|
147 |
in order to accurately measure the text height</div></li> </ul>
|
|
|
148 |
<strong>Returns:</strong>
|
|
|
149 |
<ul>
|
|
|
150 |
<li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li>
|
|
|
151 |
</ul>
|
|
|
152 |
</div>
|
|
|
153 |
</div>
|
|
|
154 |
</div>
|
|
|
155 |
</td>
|
|
|
156 |
<td class="msource">TextMetrics</td>
|
|
|
157 |
</tr>
|
|
|
158 |
<tr class="method-row expandable">
|
|
|
159 |
<td class="micon"><a class="exi" href="#expand"> </a></td>
|
|
|
160 |
<td class="sig">
|
|
|
161 |
<a id="Ext.util.TextMetrics-setFixedWidth"></a>
|
|
|
162 |
<b>setFixedWidth</b>( <code>Number width</code> ) : void <div class="mdesc">
|
|
|
163 |
<div class="short">Sets a fixed width on the internal measurement element. If the text will be multiline, you have
|
|
|
164 |
to set a fixed width...</div>
|
|
|
165 |
<div class="long">
|
|
|
166 |
Sets a fixed width on the internal measurement element. If the text will be multiline, you have
|
|
|
167 |
to set a fixed width in order to accurately measure the text height. <div class="mdetail-params">
|
|
|
168 |
<strong>Parameters:</strong>
|
|
|
169 |
<ul><li><code>width</code> : Number<div class="sub-desc">The width to set on the element</div></li> </ul>
|
|
|
170 |
<strong>Returns:</strong>
|
|
|
171 |
<ul>
|
|
|
172 |
<li><code>void</code></li>
|
|
|
173 |
</ul>
|
|
|
174 |
</div>
|
|
|
175 |
</div>
|
|
|
176 |
</div>
|
|
|
177 |
</td>
|
|
|
178 |
<td class="msource">TextMetrics</td>
|
|
|
179 |
</tr>
|
|
|
180 |
</table>
|
|
|
181 |
<a id="Ext.util.TextMetrics-events"></a>
|
|
|
182 |
<h2>Public Events</h2>
|
|
|
183 |
<div class="no-members">This class has no public events.</div>
|
|
|
184 |
</div>
|