Text

class Markup.Shapes.Text()

This object represents markup text that is drawn on the canvas.

Constructors


Constructors

Text.constructor(text, position)
Arguments:
  • text (string()) – the text associated with this item.
  • position (Point2()) – the screen space point of the top left of the text string.

Creates a new markup text item.

Return type:Text

Methods

getFillColor

Text.getFillColor()

Gets the fill color for this shape

Returns:the fill color
Return type:Color

getFillOpacity

Text.getFillOpacity()

Gets the fill opacity for this shape

Returns:the fill opacity
Return type:number

getFontFamily

Text.getFontFamily()

Gets the font family for this text

Returns:the font family
Return type:null | string

getFontSize

Text.getFontSize()

Gets the font size for this text

Returns:the font size
Return type:number

getPosition

Text.getPosition()

Gets the text position

Returns:the text position
Return type:Point2

getStrokeColor

Text.getStrokeColor()

Gets the stroke color for this shape

Returns:the stroke color
Return type:Color

getStrokeWidth

Text.getStrokeWidth()

Gets the stroke width for this shape in pixels

Returns:the stroke width in pixels
Return type:number

getText

Text.getText()

Gets the text content

Returns:the text content
Return type:string

setFillColor

Text.setFillColor(color)
Arguments:
  • color (Color()) – the fill color

Sets the fill color for this shape

Return type:void

setFillOpacity

Text.setFillOpacity(fillOpacity)
Arguments:
  • fillOpacity (number()) – the fill opacity

Sets the fill opacity for this shape

Return type:void

setFontFamily

Text.setFontFamily(fontFamily)
Arguments:
  • fontFamily (string()) – font family to use for this text

Sets the font family this shape

Return type:void

setFontSize

Text.setFontSize(fontSize)
Arguments:
  • fontSize (number()) – size to use for this text

Sets the font size for this text

Return type:void

setPosition

Text.setPosition(position)
Arguments:

Sets the text position

Returns:the top left position to render text from
Return type:void

setStrokeColor

Text.setStrokeColor(color)
Arguments:
  • color (Color()) – the stroke color

Sets the stroke color for this shape

Return type:void

setStrokeWidth

Text.setStrokeWidth(strokeWidth)
Arguments:
  • strokeWidth (number()) – the stroke width in pixels

Sets the stroke width for this shape in pixels

Return type:void

setText

Text.setText(text)
Arguments:
  • text (string()) – the text to render

Sets the text content

Return type:void