$width » History » Version 1
Per Amundsen, 08/10/2015 06:56 AM
| 1 | 1 | Per Amundsen | _Added in 1.9.1_ |
|---|---|---|---|
| 2 | |||
| 3 | *$width(text,font,size,[B],[C])* |
||
| 4 | |||
| 5 | Returns width of text in pixels for the specified font. |
||
| 6 | |||
| 7 | _If you use a negative number for the font size, it will match the size of fonts in the font dialogs._ |
||
| 8 | |||
| 9 | *Parameters* |
||
| 10 | |||
| 11 | text - Text to measure. |
||
| 12 | font - Font to measure. |
||
| 13 | size - Font size to measure. |
||
| 14 | [B] - If B is non-zero, the font is bold. (optional) |
||
| 15 | [C] - If C is non-zero, [[Formatting_text|control codes]] are processed. (optional) |
||
| 16 | |||
| 17 | *Example* |
||
| 18 | |||
| 19 | <pre> |
||
| 20 | ; Measure the width of text 'Hello World' using font 'Verdana 9'. |
||
| 21 | //echo -ag $width(Hello world, Verdana, 9) |
||
| 22 | </pre> |