Scenic.Primitives.text
You're seeing just the function
text
, go back to Scenic.Primitives module for more information.
Specs
text( source :: Scenic.Graph.t() | Scenic.Primitive.t(), text :: String.t(), options :: list() ) :: Scenic.Graph.t() | Scenic.Primitive.t()
Adds text to a graph.
Text is pretty simple. Specify the string you would like drawn.
The following example will draw some text on the screen.
graph
|> text( "Hello World", translate: {20, 20} )
Styles
Text honors the following styles
:hidden
- Iftrue
, the outline is rendered. Iffalse
, it is skipped. Default:false
.:fill
- The paint to color the text with. If not specified, the default is :white. Note: Text can only be filled with solid colors at this time.:font
- Specifies font family to draw the text with. The built-in system fonts are:roboto
and:roboto_mono
. If not specified, the default is:roboto
. You can also load your own font into theScenic.Cache
, then specify its key for the font.:font_blur
- Draw the text with a blur effect. If you draw text with blur, then draw it again without blur, slightly offset, you get a nice drop shadow effect. The default is to draw with no blur.:text_align
- Specify the alignment of the text you are drawing. You will usually specify one of::left
,:center
, or:right
. You can also specify vertical alignment. SeeScenic.Primitive.Style.TextAlign
for details.:text_height
- Specify the vertical spacing between rows of text.
Example:
graph
|> text( "Hello World", fill: :yellow, font: :roboto_mono
font_blur: 2.0, text_align: :center )