Font
On this page you find the documentation for the Font
class.
Introduction
The Font
class represents information about how text should be formatted, such as:
- The color of the text
- The size of the text
- The boldness of the text
- Etc.
Example
bold()
- Making the text bold
Use the configuration method bold()
to make the text bold.
Example
Open in Online Editorclass StartPage extends Page{
createGui(){
return Text.font(Font.bold()).text(`Here is some text!`)
}
}
color()
- Setting the text color
Use the configuration method color()
to specify which color the text should have. Pass it a string containing the name of the color in English, such as `red`
or `blue`
.
Example
Open in Online Editorclass StartPage extends Page{
createGui(){
return Text.font(Font.color(`red`)).text(`Here is some text!`)
}
}
italic()
- Making the text italic
Use the configuration method italic()
to make the text italic.
Example
Open in Online Editorclass StartPage extends Page{
createGui(){
return Text.font(Font.italic()).text(`Here is some text!`)
}
}
size()
- Setting the text size
Use the configuration method size()
to specify how tall the text should be. Pass it a number representing how many millimeters tall the text should be, such as `10`
or `15`
.
Example
Open in Online Editorclass StartPage extends Page{
createGui(){
return Text.font(Font.size(10)).text(`Here is some text!`)
}
}
strikethrough()
- Making the text strikethroughed
Use the configuration method strikethrough()
to make the text strikethroughed.
Example
Open in Online Editorclass StartPage extends Page{
createGui(){
return Text.font(Font.strikethrough()).text(`Here is some text!`)
}
}
underline()
- Making the text underlined
Use the configuration method underline()
to make the text underlined.
Example
Open in Online Editorclass StartPage extends Page{
createGui(){
return Text.font(Font.underline()).text(`Here is some text!`)
}
}