Open jakeg opened 13 years ago
v8 doesn't have anything to do with it :p, it's in lib/context2d.js I have a few TODOs in there, more specifically the parseFont method
Any update on this issue?
Would love some more details on how you want this to work.
pt
in font size, or is there more to it?I just was trying to figure out the same thing. How to get higher DPI when creating PNG images in node.js.
I found out that when rendering image/png
to base64
I could use the pngConfig setting.
myCanvas.toBuffer('image/png', {
resolution: 74 * scale,
});
I am not yet 100% sure how exactly this works, but I found that in my use case it does increase the resolution of the image without changing the size. Something like that.
All the resolution
setting does is set the pHYs chunk in the header. It's an ancillary chunk though and at least Chrome and Firefox ignore it. I imagine some image editing apps use it.
@zbjornson Thanks for the additional info. I am using this in the menu bar of macOS via xbar (the plugin I created shows the current download/upload speed of my internet connection).
There the resolution setting seems to help quit a lot and does the trick to increase the quality of the image displayed on my retina and non retina displays.
I guess V8 thinks we're on a screen with 96dpi. I think wkhtmltopdf provides an option to change this to eg 300dpi instead.
To reproduce:
To (temporarily) fix:
pt = function(screen_pt) { return screen_pt / 96 * 300; // presumably? } ctx.font = pt(9) + 'pt arial';