Copyright © 2021 by K4.org
  (v.0.48.124)

A line or lines of text. There are two different kinds of text: '2D' (the default) and '3D', although both are positionable, 3D objects, 2D text is created by the browser font rendering process, while 3D text is actual solid geometry. Both kinds of text are positioned by the center of their bounding box, just like a Rectangle.

2D text is more than 100 times faster and consumes less resources than 3D text, and also supports multiline justification, all browser fonts, and several other features supported in HTML5. The only real drawback to 2D text is that it can look rasterized when zoomed in (somewhat controllable by the resolution parameter).

3D text is able to be rendered like any other geometry, supporting shadows, lighting, reflections, materials, etc. However, it does not support all of the fonts or other typography features of 2D text.

Text

2D Text with showBox set to true.

Index

Rules

font

font: String

The name of the font to use.

Flags : Cached, Parameter (Note this is uncached)

Expression : "default"

fontFamily

fontFamily: String

The name of the fontFamily to use. This is supported by 2D text only at this time.

Flags : Cached, Parameter (Note this is uncached)

Expression : "default"

fontSpec

fontSpec: Any

2D Text only. This object gets added to spec sent to HTML5, and is a way to further customize the output. Not all HTML5 features are supported. It supports 'fontDescriptor' property which needs to be a complete font description such as {fontDescriptor: "italic small-caps bold 12px arial"} and will override particular options. Size in pixels is used as a resolution.

Flags : Cached, Parameter (Note this is uncached)

Expression : {}

fontUrl

fontUrl: String

3D Text only. The path to the 3D font file. Font files must be specially created; these are not 'Windows fonts', but specially converted outlines.

Flags : Cached, Parameter (Note this is uncached)

Expression : "" //R.settings.hosts.THREE.defaultFont

height

height: Number

Text vertical size is based on the height of an uppercase 'M' in world units. Ascenders and descenders add to this.

Flags : Cached, Parameter (Note this is uncached)

Expression : 1

horizontalJustification

horizontalJustification: String

One of: 'left', 'center', or 'right'. This only applies to multiline blocks of 2D text only.

Text

Text with horizontalJustification set to "right". The small sphere in the center is at the origin of the text object. showBox is true.

Flags : Cached, Parameter (Note this is uncached)

Expression : "center"

resolution

resolution: Number

This number specifies how many vertical pixels are used to render characters in 2D text. This number is independent of height. For best performance, this should be set as low as possible. For example, on a drawing where the main dimension characters are only 0.125 (3mm) high, the resolution can be 25 without loss of readability. Warning: high resolutions will crash the renderer in the browser. Values over 200 are extremely high.

Flags : Cached, Parameter (Note this is uncached)

Expression : 100

showBox

showBox: Boolean

If true, draws a tight (width x height) bounding box around the text.

Flags : Cached, Parameter (Note this is uncached)

Expression : false

showOutline

showOutline: Boolean

If true, strokes the text outline. Used by 2D text only.

Flags : Cached, Parameter (Note this is uncached)

Expression : false

text

text: String

The set of characters to be rendered as text.

Flags : Cached, Parameter (Note this is uncached)

Expression : ""

use3D

use3D: Boolean

Set to true to use 3D text modelling.

Flags : Cached, Parameter (Note this is uncached)

Expression : false

verticalJustification

verticalJustification: String

One of: 'top', 'center', 'baseline', or 'bottom'. 2D text only. This is currently not used.

Flags : Cached, Parameter (Note this is uncached)

Expression : "center"