Sets/gets the current font size.
This size will be used in all subsequent calls to text()
. Font size is measured in pixels and the default font size is 12 pixels. Text that does not fit completely within the display area will not be drawn or seen.
// Display various font sizes. textSize(12); text("Font Size "+textSize(), 10, 30); textSize(16); text("Font Size "+textSize(), 10, 60); textSize(25); text("Font Size "+textSize(), 10, 90);
textSize(pixels);
Name | Type | Required? | Description |
---|---|---|---|
pixels | Number | The number of pixels for the height of the text. Should be a positive number. |
The current text size in pixels. Also changes future text output to the display.
Found a bug in the documentation? Let us know at documentation@code.org