yisibl/resvg-js

rendering echarts svgStr leads to electron software crash

RizerKayseri opened this issue · 4 comments

chart.setOption(res.option)
// 输出字符串
let svgStr = chart.renderToSVGString()
const opts = {
  background: 'rgba(238, 235, 230, .9)',
  fitTo: {
    mode: 'width',
    value: 1200
  },
  font: {
    fontFiles: ['resources/huakang.ttf'], // Load custom fonts.
    loadSystemFonts: false, // It will be faster to disable loading system fonts.
    defaultFontFamily: 'myfont'
  },
  // imageRendering: 1,
  // shapeRendering: 2,
  logLevel: 'debug' // Default Value: error
}
const resvg = new Resvg(svgStr, opts)
console.log(resvg.width)
const pngData = resvg.render()
const pngBuffer = pngData.asPng()

thread '<unnamed>' panicked at C:\Users\runneradmin\.cargo\git\checkouts\resvg-4b7e4ee32ad6d954\3495d87\crates\resvg\src\geom.rs:27:61: calledOption::unwrap()on aNonevalue stack backtrace: 0: 0x7ffdeb2bcfc8 - napi_register_module_v1 1: 0x7ffdeb12589b - <unknown> 2: 0x7ffdeb2b0071 - napi_register_module_v1 3: 0x7ffdeb2bf33a - napi_register_module_v1 4: 0x7ffdeb2bef59 - napi_register_module_v1 5: 0x7ffdeb2bff02 - napi_register_module_v1 6: 0x7ffdeb2bf973 - napi_register_module_v1
It can get width successfully

Please paste the SVG string in the issue.

Please paste the SVG string in the issue.
I'm pleasantly surprised and delighted to share that during my assessment today, this particular issue seemed to have vanished, rendering the program crash-free. May I inquire if an update has resolved this issue?

Looks like a similar issue to #287.

Looks like a similar issue to #287.
Prior to the update, i will employ version 2.5. Grateful acknowledgments are extended for your invaluable assistance.