diff --git a/README.md b/README.md index 64b0b3e..55bf983 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ Renders a string to a 2D cell complex + `options.fontStyle` if set, determines the [font-style](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style) + `options.fontVariant` if set, determines the [font-variant](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant) + `options.fontWeight` if set, determines the [font-weight](https://developer.mozilla.org/en/docs/Web/CSS/font-weight) + + `options.fontStretch` if set, determines the [font-stretch](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fontStretch) + `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) + `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"` + `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"` diff --git a/lib/vtext.js b/lib/vtext.js index b1ce2d8..3712772 100644 --- a/lib/vtext.js +++ b/lib/vtext.js @@ -436,6 +436,7 @@ function vectorizeText(str, canvas, context, options) { options.styletags.superscripts ? true : false } + context.fontStretch = options.fontStretch || "normal" context.font = [ options.fontStyle, options.fontVariant,