Hi,
I had textwrap built and installed on my node environment, I also generated a canvas by pureimage as there is no native canvas in Node. pureimage is supposed to implement the same specification of browser canvas, so hopefully it would run.
But still, I'm having a problem calling the final function draw_wrapped_text
This is the error:
service1 | WARNING. Can't find font family { family: 'sans-serif', size: 20 }
service1 | panicked at 'called Result::unwrap() on an Err value: JsValue(TypeError: Cannot read properties of undefined (reading 'font')
service1 | TypeError: Cannot read properties of undefined (reading 'font')
service1 | at measureText (/usr/src/app/node_modules/pureimage/dist/pureimage-umd.cjs:6398:18)
service1 | at Context.measureText (/usr/src/app/node_modules/pureimage/dist/pureimage-umd.cjs:7775:20)
service1 | at /usr/src/app/node_modules/textwrap-wasm-demo/textwrap_wasm_demo.js:549:33
service1 | at handleError (/usr/src/app/node_modules/textwrap-wasm-demo/textwrap_wasm_demo.js:224:18)
service1 | at module.exports.__wbg_measureText_734acef1b5e2b3fd (/usr/src/app/node_modules/textwrap-wasm-demo/textwrap_wasm_demo.js:548:73)
service1 | at wasm://wasm/00092a52:wasm-function[113]:0xd4e3
service1 | at wasm://wasm/00092a52:wasm-function[69]:0x9488
service1 | at module.exports.draw_wrapped_text (/usr/src/app/node_modules/textwrap-wasm-demo/textwrap_wasm_demo.js:210:14)
service1 | at file:///usr/src/app/serv1/text.js:33:1
service1 | at ModuleJob.run (node:internal/modules/esm/module_job:193:25))', src/lib.rs:331:63
Hi, I had textwrap built and installed on my node environment, I also generated a canvas by pureimage as there is no native canvas in Node. pureimage is supposed to implement the same specification of browser canvas, so hopefully it would run.
But still, I'm having a problem calling the final function
draw_wrapped_text
This is the error:
While this is Canvas generated by pureimage:
Is it because of my object ? or the way I'm calling it (tried to replicate web demo example). My NodeJS code is simply:
Thanks a lot for your consideration.