Text¶
Since: KET 2.0.0
A styled, multi-paragraph text box on the canvas.
Styles cascade: a key set on the text object is the default for its paragraphs, a key set on a paragraph the default for its parts. A part’s own keys win.
This structured form was introduced by KET 2.0. The KET 1.0 text form wraps a serialised Draft.js document in a data key instead; both are "type": "text" nodes, and the presence of data tells them apart.
Appears in¶
An inline element of root.nodes; it has no top-level key of its own.
Identified by¶
"type": "text" with boundingBox and paragraphs, and without data.
Attributes¶
type¶
Type: string
Required: yes
Values:
"text"
Node type; always text.
boundingBox¶
Type: object
Required: yes
The box the text is laid out in: its top-left corner, width and height.
y is the top edge: with the y axis pointing up, the box extends down to y − height.
boundingBox.x¶
Type: number
Required: yes
Left edge.
boundingBox.y¶
Type: number
Required: yes
Top edge.
boundingBox.z¶
Type: number
Required: no
Depth; 0 in a two-dimensional drawing.
boundingBox.width¶
Type: number
Required: yes
Values: at least 0
Width of the box.
boundingBox.height¶
Type: number
Required: yes
Values: at least 0
Height of the box.
paragraphs¶
Type: array of Text paragraph
Required: yes
The paragraphs of the text, top to bottom.
alignment¶
Type: string
Required: no
Values: Text alignment
Default alignment of the paragraphs.
indent¶
Type: number
Required: no
Units: KET length units
Default indentation of the paragraphs.
font¶
Type: Text font
Required: no
Default font of the whole text.
color¶
Type: string
Required: no
Values:
#RRGGBBor#RGBPattern:
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
Default colour of the whole text.
bold¶
Type: boolean
Required: no
Default:
false
Bold default for the whole text.
italic¶
Type: boolean
Required: no
Default:
false
Italic default for the whole text.
subscript¶
Type: boolean
Required: no
Default:
false
Subscript default for the whole text.
superscript¶
Type: boolean
Required: no
Default:
false
Superscript default for the whole text.
selected¶
Type: boolean
Required: no
Default:
false
Editor state: the text is selected. Carries no meaning for the drawing; written only as true.
Rules¶
boundingBoxandparagraphsare required, and every paragraph hasparts.The object has no
datakey.The document declares
"ket_version": "2.0.0".