Open slalomzacharyd opened 1 year ago
Browsers aren't consistent with each other or even with themselves across OSes. Which browser and OS should we choose to emulate? Even if there were an answer I doubt Cairo can be made to do that.
There are holes you can poke into my request, but to do that I need to make sure what I am requesting is clear so the holes make sense.
Through MacPorts, it looks like you can compile with different backends for Cairo. (You might even be able to compile in multiple backends.) By default Cairo will try to use the native backend (GDI for Window/CoreText for macOS/FC for linux) which may render slightly differently from each other
Notice specifically that Cairo on macOS supports X11 as a backend. Theoretically, if on macOS I was using the X11 backend I would get the same output as my Linux box. It is possible with pango cairo to choose a backend using the env variable PANGOCAIRO_BACKEND
.
It also appears that cairo on brew also compiles in freetype and fontconfig.
So my question is: since node-canvas is not likely to be used in a browser, why can't we use an ENV variable to choose a backend similar to Pango Cairo? You would think that consistent rendering for a library like this might be important for some apps.
I'm just looking at MacPorts today and realizing I could probably just compile it with the backend I want for cairo and solve my own problem by only compiling in X11 support.
Rendering may differ for other reasons anyway. Like versions of the libs.
Use library to compare images by similarity instead of exact pixels. This is actually my current workaround which may arguably be the easiest to maintain solution for this use case.
Please don't try to bring the request off the rails by asking about emulation or browsers. Neither of those are in the scope of this issue.
If you try to use the library for unit testing, it generates slightly different text between OSs. It would be great to be able to use this library to generate images for use in testing where consistency is important.
Steps to Reproduce