d499d5e24b299402274d0b9a2b501448adfbc73c.svn-base 11 KB

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