JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Intro to JS+prossecingJS
Intro to JS+prossecingJS
More
Share
Explore
Session 3
Text and Strings
Text and Strings
text(message, x, y, width*, height*)
Draws a string of text at the specified location.
Parameters
Meaning of Parameters
Parameters
Meaning of Parameters
1
message
the string of text to display
2
x
the x-coordinate of the bottom left corner
3
y
the y-coordinate of the bottom left corner
4
width*
(Optional) the width of the box for text to auto wrap inside
5
height*
(Optional) the height of the box for text to auto wrap inside
There are no rows in this table
Example
Result
textSize(size)
Changes the size of text being drawn.
Parameters
Meaning of Parameters
Parameters
Meaning of Parameters
1
size
There are no rows in this table
Example
Result
textFont(font, size*)
Using textFont() with createFont(), it's possible to change the font of text drawn.
createFont(name, size)
createFont(name, size)
0
Parameters
Meaning of Parameters
Parameters
Meaning of Parameters
1
name
A font name, either "sans-serif", "serif", "monospace", "fantasy", or "cursive"
2
size
(Optional) The size of the font, in pixels
There are no rows in this table
textFont(font, size)
textFont(font, size)
0
Parameters
Meaning of Parameters
Parameters
Meaning of Parameters
1
font
A font returned by the createFont function
2
size
(Optional) The size of the font, in pixels
There are no rows in this table
Example
Result
text(message, x, y, width*, height*)
Example
Result
textSize(size)
Example
Result
textFont(font, size*)
createFont(name, size)
textFont(font, size)
Example
Result
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.