View Source Scenic.Primitive.Style.Font (Scenic v0.11.2)
Set the font used to draw text.
Example:
graph
|> text( "Hello World", font: "fonts/my_fancy_font.ttf" )
data-format
Data Format
You can use any font loaded into your static assets library. You can also refer to the font by either it's library file name, or an alias that you have configured.
The following example shows both ways to identify a font.
Graph.build()
|> text( "By name", font: "fonts/roboto.ttf" )
|> text( "By alias", font: :roboto )
Standard Fonts
You are highly encouraged to use Roboto and Roboto Mono as the standard system fonts for Scenic. Aliases are automatically set up for them.
Alias | Font |
---|---|
:roboto | "fonts/roboto.ttf" |
:roboto_mono | "fonts/roboto_mono.ttf" |
It is expected that you will include the roboto.ttf and roboto_mono.ttf files in your asset source folder. You don't technically need to, but if you don't then those aliases won't work.