You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
vectorize-text
2
2
==============
3
-
Convert a string of text into a vectorized geometric representation. Works in both node.js and [browserify](http://browserify.org/).
3
+
Convert a string of text into a vectorized geometric representation. Works in both node.js and [browserify](http://browserify.org/).
4
4
5
5
# Example
6
6
@@ -119,14 +119,18 @@ Renders a string to a 2D cell complex
119
119
*`string` is a string of text (single line)
120
120
*`options` is an optional object of parameters
121
121
122
-
+`options.font` is the font to use (default: `"normal"`)
123
-
+`options.triangles` if set, then output a triangulation
124
-
+`options.polygons` if set, output a list of polygons
122
+
+`options.font` is the font family to use (default: `"normal"`)
123
+
+`options.fontStyle` if set, determines the [font-style](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style)
124
+
+`options.fontVariant` if set, determines the [font-variant](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant)
125
+
+`options.fontWeight` if set, determines the [font-weight](https://developer.mozilla.org/en/docs/Web/CSS/font-weight)
126
+
+`options.size` is the [font-size](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size) used for the rasterization step (determines level of detail of the mesh)
125
127
+`options.textBaseline` determines the baseline, same semantics as the canvas [textBaseline](https://developer.mozilla.org/en-US/docs/Drawing_text_using_a_canvas#Attributes) property. Default: `"alphabetic"`
126
128
+`options.textAlign` determines the alignment for the text, same semantics as canvas [textAlign](https://developer.mozilla.org/en-US/docs/Drawing_text_using_a_canvas#Attributes). Default: `"start"`
127
129
+`options.lineHeight` determines the height of a line. Default: `1.0`
128
130
+`options.width` determines the width of the text, overrides `lineHeight` if specified
129
131
+`options.height` determines the height of the text, overrides `lineHeight` if specified
132
+
+`options.triangles` if set, then output a triangulation
133
+
+`options.polygons` if set, output a list of polygons
130
134
+`options.orientation` determines the orientation of any output triangles/polygon curves. Must be either `"cw"` for clockwise or `"ccw"` for counter clockwise. Default is `"cw"`.
131
135
+`options.canvas` an optional canvas element
132
136
+`options.context` an optional canvas 2D context
@@ -145,7 +149,7 @@ Renders a string to a 2D cell complex
145
149
+`cells` are the faces of the triangulation, encoded as triples of indices into the vertex array
146
150
+`positions` are the positions of the vertices in the triangulation
147
151
148
-
**Note** In node.js, this library requires Cairo. For more information on how to set this up, look at the documentation for the [canvas module](https://www.npmjs.org/package/canvas).
152
+
**Note** In node.js, this library requires Cairo. For more information on how to set this up, look at the documentation for the [canvas module](https://www.npmjs.org/package/canvas).
0 commit comments