$width » History » Version 2
Per Amundsen, 04/02/2020 04:36 PM
1 | 1 | Per Amundsen | _Added in 1.9.1_ |
---|---|---|---|
2 | |||
3 | 2 | Per Amundsen | *$width(text,font,size,[B],[C],[D])* |
4 | 1 | Per Amundsen | |
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 | 2 | Per Amundsen | [D] - TODO |
17 | 1 | Per Amundsen | |
18 | *Example* |
||
19 | |||
20 | <pre> |
||
21 | ; Measure the width of text 'Hello World' using font 'Verdana 9'. |
||
22 | //echo -ag $width(Hello world, Verdana, 9) |
||
23 | </pre> |