SeanSobey / ChartjsNodeCanvas

A node renderer for Chart.js using canvas.
MIT License
228 stars 70 forks source link

Default font does not work on Ubuntu #105

Closed Kyzegs closed 2 years ago

Kyzegs commented 2 years ago

Describe the bug The text does not get displayed on an Ubuntu system.

Windows:

image

Ubuntu:

image

Versions

SeanSobey commented 2 years ago

Hi there!

This lib is a small bit of glue between some other libs and as such the issues related to deployment and os support are dependant and resulting from the underlying libs, in this case it looks like node-canvas.

I am mostly a Windows user but do attempt to provide docs and test/CI support for other OS here, and I spent a bit of time adding docker/CI support for testing on ubuntu. Currently there is some test-related issues preventing the MR (my time is quite limited atm) but the fixes for the tests for custom fonts look fine visually.

There was no required code changes in this lib I suspect you just to install some dependencies on ubuntu, the visuals you provided are consistent with my experience.

Have a look at the docs (and node-canvas docs therein) regarding fonts, environments and my ubuntu dockerfile for clarity on the dependencies etc on getting custom fonts to work.

Hope this helps!

SrS2225a commented 2 years ago

Hi there!

This lib is a small bit of glue between some other libs and as such the issues related to deployment and os support are dependant and resulting from the underlying libs, in this case it looks like node-canvas.

I am mostly a Windows user but do attempt to provide docs and test/CI support for other OS here, and I spent a bit of time adding docker/CI support for testing on ubuntu. Currently there is some test-related issues preventing the MR (my time is quite limited atm) but the fixes for the tests for custom fonts look fine visually.

There was no required code changes in this lib I suspect you just to install some dependencies on ubuntu, the visuals you provided are consistent with my experience.

Have a look at the docs (and node-canvas docs therein) regarding fonts, environments and my ubuntu dockerfile for clarity on the dependencies etc on getting custom fonts to work.

Hope this helps!

Yes, that's kind of whats going on. It's easy enough to fix. All he needs to do is install one to ~/.local/share/fonts/ or simply install a package such as gnu-free-fonts, then make the font of his choice his system default. The arch linux docs has a great guide on how to set them up properly, and should work for Ubuntu as well. https://wiki.archlinux.org/title/Fonts

Kyzegs commented 2 years ago

I got it working. Thanks for the input on how to solve the issue.