The height and width fields get or set the rendered on-screen dimensions of a presentation tag.
<box width=300 {...}> makes the box 300 pixels wide.<box width=50,% {...}> makes it half the width of its container.<box height=3,em {...}> makes it three lines of text high.<putLn b.width> sends the actual width of b, in pixels.This field takes a distance value specified with either one or two value elements.
If the units are not specified, the distance is interpreted in pixels (px) by default.
| Unit specifier | Description | Example | Interpretation |
|---|---|---|---|
| None | Pixels (default units) | 5 | 5 pixels |
| px | Pixels (explicitly stated) | 5,px | 5 pixels |
| % | Percentage units | 20,% | 20% |
| pt | Typesetting point units | 12,pt | 12pt text size |
| em | Multiple of current font size | 1.2,em | 1.2 × current font size |
Some programming languages use % symbols as placeholders when printing output to the console. In such cases, you might need to ouput the % character in a different way. For example, in C's printf function, you would need to specify50,%as50,%%.
When getting a value for this field, a single numerical value in pixels is generated.
For the height and width fields, getting the current value of the field enables you to check the actual rendered dimensions of the tag in pixels.
Note: when applied to the console tag instance, you can get the values from the height and width fields in order to check the current size of the console in pixels. Assigning to them does not resize the console.
Programs cannot resize their own consoles.