Documentation ¶
Overview ¶
Package text is a simple text component with customisable content, size, colour, location and font.
Index ¶
- type Component
- func (component Component) GetJSONFormat() interface{}
- func (component Component) SetNamedProperties(properties render.NamedProperties) (render.Component, error)
- func (component Component) VerifyAndSetJSONData(data interface{}) (render.Component, render.NamedProperties, error)
- func (component Component) Write(canvas render.Canvas) (c render.Canvas, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct { /* NamedPropertiesMap maps user/application variables to properties of the component. This field is filled automatically by VerifyAndSetJSONData, then used in SetNamedProperties to determine whether a variable being passed in is relevant to this component. For example, map[string][]string{"username": []string{"content"}} would indicate that the user specified variable "username" will fill the Content property. */ NamedPropertiesMap map[string][]string // Content is the text to render. Content string // Start is the coordinates of the dot relative to the top-left corner of the canvas. Start image.Point // Size is the size of the text in points. Size float64 // MaxWidth is the maximum number of horizontal pixels the dot can move before scaling text. MaxWidth int // cutils.TextAlignment aligns text to the left, right or centre. TextAlignment cutils.TextAlignment // Font is the typeface to use. Font *truetype.Font // Colour is the colour of the text. Colour color.NRGBA // contains filtered or unexported fields }
Component implements the Component interface for text.
func (Component) GetJSONFormat ¶
func (component Component) GetJSONFormat() interface{}
GetJSONFormat returns the JSON structure of a text component.
func (Component) SetNamedProperties ¶
func (component Component) SetNamedProperties(properties render.NamedProperties) (render.Component, error)
SetNamedProperties processes the named properties and sets them into the text properties.
func (Component) VerifyAndSetJSONData ¶
func (component Component) VerifyAndSetJSONData(data interface{}) (render.Component, render.NamedProperties, error)
VerifyAndSetJSONData processes the data parsed from JSON and uses it to set text properties and fill the named properties map.
Click to show internal directories.
Click to hide internal directories.