textSize()
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.
Examples
// 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);
Syntax
textSize(pixels);
Parameters
Name | Type | Required? | Description |
---|---|---|---|
pixels | Number | The number of pixels for the height of the text. Should be a positive number. |
Returns
Found a bug in the documentation? Let us know at support@code.org.