webgui/www/extras/extjs/docs/output/Ext.util.TextMetrics.html

238 lines
No EOL
13 KiB
HTML

<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Ext.util.TextMetrics</title>
<link rel="stylesheet" type="text/css" href="../resources/reset.css"/>
<link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/>
<link rel="stylesheet" type="text/css" href="../resources/print.css" media="print">
<!-- GC -->
</head>
<body>
<div class="body-wrap">
<div class="top-tools">
<img src="../resources/print.gif" width="16" height="16" align="absmiddle">&nbsp;<a href="Ext.util.TextMetrics.html" target="_blank">Print Friendly</a><br/>
</div>
<h1>Class Ext.util.TextMetrics</h1>
<table cellspacing="0">
<tr><td class="label">Package:</td><td>Ext.util</td></tr>
<tr><td class="label">Class:</td><td>TextMetrics</td></tr>
<tr><td class="label">Extends:</td><td>Object</td></tr>
<tr><td class="label">Defined In:</td><td><a href="TextMetrics.jss.html">TextMetrics.js</a></td></tr>
</table>
<div class="description">
Provides precise pixel measurements for blocks of text so that you can determine exactly how high and
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>
<br />
<a href="#properties">Properties</a>
&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#methods">Methods</a>
&nbsp;&nbsp;-&nbsp;&nbsp;<a href="#events">Events</a>
<hr />
<a name="properties"></a>
<h2>Public Properties</h2>
<div class="no-members">This class has no public properties.</div> <a name="methods"></a>
<h2>Public Methods</h2>
<table cellspacing="0" class="member-table">
<tr>
<th class="sig-header" colspan="2">Method</th>
<th class="msource-header">Defined By</th>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#bind">bind</a>(<code>String/HTMLElement el</code>) : void</td>
<td class="msource" rowspan="2">TextMetrics</td>
</tr>
<tr>
<td class="mdesc">Binds this TextMetrics instance to an element from which to copy existing CSS styles
that can affect the size of the ...</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#createInstance">createInstance</a>(<code>String/HTMLElement el</code>, <span class="optional" title="Optional">[<code>Number fixedWidth</code>]</span>) : Ext.util.TextMetrics.Instance</td>
<td class="msource" rowspan="2">TextMetrics</td>
</tr>
<tr class="alt">
<td class="mdesc">Return a unique TextMetrics instance that can be bound directly to an element and reused. This reduces
the overhead ...</td>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#getHeight">getHeight</a>(<code>String text</code>) : Number</td>
<td class="msource" rowspan="2">TextMetrics</td>
</tr>
<tr>
<td class="mdesc">Returns the measured height of the specified text. For multiline text, be sure to call
<a href="#setFixedWidth">setFixedWidth</a> if necessary.</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#getSize">getSize</a>(<code>String text</code>) : Object</td>
<td class="msource" rowspan="2">TextMetrics</td>
</tr>
<tr class="alt">
<td class="mdesc">Returns the size of the specified text based on the internal element's style and width properties</td>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#getWidth">getWidth</a>(<code>String text</code>) : Number</td>
<td class="msource" rowspan="2">TextMetrics</td>
</tr>
<tr>
<td class="mdesc">Returns the measured width of the specified text</td>
</tr>
<tr class="alt">
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#measure">measure</a>(<code>String/HTMLElement el</code>, <code>String text</code>, <span class="optional" title="Optional">[<code>Number fixedWidth</code>]</span>) : Object</td>
<td class="msource" rowspan="2">TextMetrics</td>
</tr>
<tr class="alt">
<td class="mdesc">Measures the size of the specified text</td>
</tr>
<tr>
<td class="micon" rowspan="2">&nbsp;</td>
<td class="sig"><a class="mlink" href="#setFixedWidth">setFixedWidth</a>(<code>Number width</code>) : void</td>
<td class="msource" rowspan="2">TextMetrics</td>
</tr>
<tr>
<td class="mdesc">Sets a fixed width on the internal measurement element. If the text will be multiline, you have
to set a fixed width...</td>
</tr>
</table>
<a name="events"></a>
<h2>Public Events</h2>
<div class="no-members">This class has no public events.</div>
<h2 class="mdetail-head">Method Details</h2>
<div class="detail-wrap">
<a name="bind"></a>
<div class="mdetail">
<h3>bind</i></h3>
<code>public function bind(<code>String/HTMLElement el</code>)</code>
<div class="mdetail-desc">
Binds this TextMetrics instance to an element from which to copy existing CSS styles
that can affect the size of the rendered text
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">The element, dom node or id</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by TextMetrics.</div>
</div>
<a name="createInstance"></a>
<div class="mdetail alt">
<h3>createInstance</i></h3>
<code>public function createInstance(<code>String/HTMLElement el</code>, <span class="optional" title="Optional">[<code>Number fixedWidth</code>]</span>)</code>
<div class="mdetail-desc">
Return a unique TextMetrics instance that can be bound directly to an element and reused. This reduces
the overhead of multiple calls to initialize the style properties on each measurement.
<div class="mdetail-params">
<strong>Parameters:</strong>
<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 in order to accurately measure the text height</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Ext.util.TextMetrics.Instance</code><div class="sub-desc">instance The new instance</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by TextMetrics.</div>
</div>
<a name="getHeight"></a>
<div class="mdetail">
<h3>getHeight</i></h3>
<code>public function getHeight(<code>String text</code>)</code>
<div class="mdetail-desc">
Returns the measured height of the specified text. For multiline text, be sure to call
<a href="#setFixedWidth">setFixedWidth</a> if necessary.
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Number</code><div class="sub-desc">height The height in pixels</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by TextMetrics.</div>
</div>
<a name="getSize"></a>
<div class="mdetail alt">
<h3>getSize</i></h3>
<code>public function getSize(<code>String text</code>)</code>
<div class="mdetail-desc">
Returns the size of the specified text based on the internal element's style and width properties
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by TextMetrics.</div>
</div>
<a name="getWidth"></a>
<div class="mdetail">
<h3>getWidth</i></h3>
<code>public function getWidth(<code>String text</code>)</code>
<div class="mdetail-desc">
Returns the measured width of the specified text
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>text</code> : String<div class="sub-desc">The text to measure</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Number</code><div class="sub-desc">width The width in pixels</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by TextMetrics.</div>
</div>
<a name="measure"></a>
<div class="mdetail alt">
<h3>measure</i></h3>
<code>public function measure(<code>String/HTMLElement el</code>, <code>String text</code>, <span class="optional" title="Optional">[<code>Number fixedWidth</code>]</span>)</code>
<div class="mdetail-desc">
Measures the size of the specified text
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>el</code> : String/HTMLElement<div class="sub-desc">The element, dom node or id from which to copy existing CSS styles 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 in order to accurately measure the text height</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>Object</code><div class="sub-desc">An object containing the text's size {width: (width), height: (height)}</div></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by TextMetrics.</div>
</div>
<a name="setFixedWidth"></a>
<div class="mdetail">
<h3>setFixedWidth</i></h3>
<code>public function setFixedWidth(<code>Number width</code>)</code>
<div class="mdetail-desc">
Sets a fixed width on the internal measurement element. If the text will be multiline, you have
to set a fixed width in order to accurately measure the text height.
<div class="mdetail-params">
<strong>Parameters:</strong>
<ul><li><code>width</code> : Number<div class="sub-desc">The width to set on the element</div></li> </ul>
<strong>Returns:</strong>
<ul>
<li><code>void</code></li>
</ul>
</div>
</div>
<div class="mdetail-def">This method is defined by TextMetrics.</div>
</div>
</div>
</div>
<hr>
<div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
</body>
</html>