canvas-text-wrapper icon indicating copy to clipboard operation
canvas-text-wrapper copied to clipboard

Return object properties

Open dmxride opened this issue 7 years ago • 1 comments

Hello, thank you for the module! It has been useful! Though i find it important to make the method return some properties, like for instance the number of lines, which for what i am going to create a fork

Thank you !

dmxride avatar Sep 03 '17 17:09 dmxride

So I noticed that the library does return back a string array broken up in the same way as is rendered on the canvas. So I used that to estimate the height of the block of text.

I'm using typescript and Angular:

import * as Ctw from 'canvas-text-wrapper';
...
const lines: string[] = Ctw.CanvasTextWrapper(canvas, text, options) as any;

flyer1 avatar Sep 20 '19 03:09 flyer1