$width » History » Version 3
Per Amundsen, 02/23/2023 07:57 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 | 3 | Per Amundsen | table(ktable). |
12 | |*Parameter*|*Description*| |
||
13 | | text | Text to measure. | |
||
14 | | font | Font to measure. | |
||
15 | | size | Font size to measure. | |
||
16 | | [B] | If B is non-zero, the font is bold. (optional) | |
||
17 | | [C] | If C is non-zero, [[Formatting_text<notextile>|</notextile>control codes]] are processed. (optional) | |
||
18 | | [D] | TODO | |
||
19 | 1 | Per Amundsen | |
20 | *Example* |
||
21 | |||
22 | <pre> |
||
23 | ; Measure the width of text 'Hello World' using font 'Verdana 9'. |
||
24 | //echo -ag $width(Hello world, Verdana, 9) |
||
25 | </pre> |