Texts provide sets of segments for each character or text strings. The segments can be used to create outlines for both 2D and 3D geometry. Note: Only ASCII characters are supported.
- Source:
Example
const { vectorChar, vectorText } = require('@jscad/modeling').text
Methods
(static) vectorChar(optionsopt, charopt) → {VectorCharObject}
- Source:
Construct a VectorCharObject from a ascii character whose code is between 31 and 127, if the character is not supported it is replaced by a question mark.
Example
let vectorCharObject = vectorChar()
or
let vectorCharObject = vectorChar('A')
or
let vectorCharObject = vectorChar({ xOffset: 57 }, 'C')
or
let vectorCharObject = vectorChar({ xOffset: 78, input: '!' })
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | String |
<optional> |
options for construction or ascii character Properties
|
|||||||||||||||||||||||||||||||
char |
String |
<optional> |
'?'
|
ascii character |
Returns:
- Type
- VectorCharObject
(static) vectorText(optionsopt, textopt) → {Array}
- Source:
Construct an array of character segments from a ascii string whose characters code is between 31 and 127, if one character is not supported it is replaced by a question mark.
Example
let textSegments = vectorText()
or
let textSegments = vectorText('OpenJSCAD')
or
let textSegments = vectorText({ yOffset: -50 }, 'OpenJSCAD')
or
let textSegments = vectorText({ yOffset: -80, input: 'OpenJSCAD' })
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | String |
<optional> |
options for construction or ascii string Properties
|
||||||||||||||||||||||||||||||||||||||||||||||
text |
String |
<optional> |
'?'
|
ascii string |
Returns:
characters segments [[[x, y], ...], ...]
- Type
- Array