Open matehegedus opened 1 year ago
Hi,
I have the following problem, when I am using bbox()-es for some calculations, in my node.js environment it returns only zeros (although in web it works well)
this is my minimal reproduction:
config.setFontDir("src/fonts/Roboto"); config.setFontFamilyMappings({ Roboto: "Roboto-Black.ttf", "sans-serif": "Roboto-Black.ttf", "Roboto-Bold": "Roboto-Bold.ttf", }); config.preloadFonts(); const window = createSVGWindow(); const { document } = window; registerWindow(window, document); const draw = SVG(document.documentElement); draw.attr({ width: 200, height: 200, }); const group = draw.group().id(`txtGroup-example`); const textELem = group .text("label") .fill("red") .attr({ x: 50, y: 50, "text-anchor": "middle", "dominant-baseline": "auto", transform: `rotate(${90},${50},${50})`, "font-size": `${16}px`, "font-family": `Roboto`, }); const bbox = textELem.bbox(); console.log("group :>> ", bbox); //every element inside bbox will be zero
Am I doing something wrong ?
Thanks
My bad, I was using 'font-size: 16px', although it should be only '16'. This caused the issue in node.js
Glad you figured it out. That would have taken me ages to realize :D
Hi,
I have the following problem, when I am using bbox()-es for some calculations, in my node.js environment it returns only zeros (although in web it works well)
this is my minimal reproduction:
Am I doing something wrong ?
Thanks