To test examples, append them to the boilerplate
// Custom Font
figure.add({
make: 'text',
text: 'Hello World',
font: { family: 'Times New Roman', style: 'italic', underline: true },
});
// Aligned text
figure.add({
make: 'text',
text: 'Aligned Text',
xAlign: 'center',
yAlign: 'top',
color: [0, 0, 1, 1],
});
// Multi Text
figure.add({
make: 'text',
text: ['0', '1', '2'],
location: [[-0.5, -0.5], [0, 0.5], [0.5, -0.5]],
});
Text options object that extends OBJ_FigurePrimitive.
A text element can either be defined as a single string, or an array of strings combined with an array of locations.
The
adjustmentsproperty allows customization of the borders around the text. This may be needed when the browser or FigureOne does not accurately calculate the size of the text (usually for non-standard fonts, and sometimes italized fonts).Atlernately
borderandtouchBordercan also be used for complete customization.All text in this element will use the same font, x and y alignment, and adjustments.
Note - Text can be rendered to either the WebGL canvas or the 2D canvas using the
renderproperty infont. For more information, see OBJ_Font.