Open kangax opened 10 years ago
same for i-text elements with textAlign: center.
this is the canvas rendered in chrome:
this one is generated with node-canvas:
Any ideas or workarounds?
Hello, has anything happened on this front? Thanks for letting us know.
+1 We also need a fix for this. @LinusU
2.3.6
We seem to have same problem with text position after saving to PNG. Attached is the design and the final PNG. Here is my environment information:
@asturur Any thoughts about this issue? Thank you so much !
when i have time to update to node-canvas 2, i ll swarm over those old fabricjs bugs.
Now we are on 1.6 and that is unsupported. This means that we can't really invest time in research and fixes.
I'm running into an issue like this. Using canvas in the browser my text is centered. Running the same text rendering code but using node-canvas results in seemingly random text alignment.
browser canvas:
node-canvas:
And here's my function for rendering my lines of text:
function renderLines({ canvasContext, lines, x, y }) {
const lineHeight = canvasContext.measureText('M').width * 1.2;
const startY = y - (lines.length - 1) * lineHeight / 2;
lines.forEach((line, index) => {
const lineY = startY + index * lineHeight;
canvasContext.fillText(line.trim(), x, lineY);
});
}
I'm using node-canvas 2.3.1.
Same issue here. Node.js tex-align is off compared to the browser. Anyone found a solution?
I think we have some text align test in node and they work. What kind of font are you using? If you have a simple index.js that can print the text not correctly aligned, that woulds help. Maybe with a vertical line for reference where the alignemnt should be
I am facing an issue with top alignment, on browser its okay but on node its adding extra space at the top , happening with all fonts
browser
node
Some extra space is coming at the top in node
Using a simple test like this:
... I'm getting incorrect rendering in latest node-canvas:
compare to the same output in Chrome (and FF):
There's a similar problem with trailing spaces.
node-canvas:
Chrome (FF):