fabric_text: Insert text within canvas element

Description Usage Arguments Value Examples

View source: R/fabric_text.R

Description

Insert text within canvas element

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fabric_text(
  cid,
  cwidth = 800,
  cheight = 600,
  cfill = "#FFFFFF",
  textId,
  text,
  left = 100,
  top = 100,
  fill = "#2F3941",
  angle = 0,
  opacity = 1,
  fontFamily = "Comic Sans",
  fontSize = 40,
  fontStyle = "normal",
  strokecolor = "#282A36",
  strokewidth = 1,
  fontWeight = "normal",
  underline = FALSE,
  linethrough = FALSE,
  overline = FALSE,
  selectable = TRUE,
  shadow = FALSE,
  shadowCol = "#FFFAF0",
  textAlign = "center",
  lineHeight = 1,
  textBackgroundColor = NULL,
  isDrawingMode = FALSE
)

Arguments

cid

the id of the canvas element

cwidth

the width of the canvas element. Defaults to 800

cheight

the height of the canvas element. Defaults to 600

cfill

the color of the canvas element

textId

the id of the text

text

the content of the text

left

the text's position from the left relative to the canvas element. Defaults to 100

top

the text's position from the top relative to the canvas element. Defaults to 100

fill

the text's color. Defaults to '#2F3941' (dark shade of cyan-blue)

angle

the angle of rotation of the text. Defaults to 0 (no rotation)

opacity

text opacity (from 0 to 1). Defaults to 1

fontFamily

the font family of the text. Defaults to 'Comic Sans'

fontSize

text sizing. Defaults to 40

fontStyle

the font style of the text. Either 'normal' or 'italic'

strokecolor

the stroke color of the text Defaults to '#282A36' (Very dark grayish blue)

strokewidth

the stroke width of the text. Defaults to 1

fontWeight

allows the user to make text thicker or thinner. Keywords can be used ('normal', 'bold'), or numbers. Defaults to 'normal'

underline

logical. Whether to underline the text or not. Defaults to FALSE

linethrough

logical. Whether to insert a line through the text or not. Defaults to FALSE

overline

logical. Whether to put a line above the text or not. Defaults to FALSE

selectable

logical. If TRUE, the user can modify interactively the image's size, position and rotation. Defaults to TRUE

shadow

logical. If TRUE a text shadow will be inserted behind the raw text. Defaults to FALSE

shadowCol

the color of the text shadow. Defaults to #FFFAF0 (floral white)

textAlign

the alignment of text. Useful when there are line breaks. Defaults to "center"

lineHeight

the height of the line breaks.Defaults to 1

textBackgroundColor

the background color of the text, defaults to NULL

isDrawingMode

logical. If TRUE, the user can draw inside the canvas element.

Value

a text object within a canvas element

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
if (interactive()) {


ui <- fluidPage(


fabric_text(cid = "can",
         textId = "text",
         text = "But A Hero Is A Guy Who Gives Out The Meat To Everyone Else.",
         cfill = "#DD5347",
         left = 120,
         shadowCol = "blue",
         fontSize = 20,
         fontWeight = "bold",
         lineHeight = 3
         )
)
server <- function(input, output) {}

shinyApp(ui = ui, server = server)

}

fabricerin documentation built on Aug. 15, 2020, 1:06 a.m.