Custom Fonts in Discord Bot


Hi, I’m using canvas module in code of my Discord bot. How can I get custom fonts, because the Docs of Canvas say that the font must be installed, so how can I install it?


Canvas has registerFont(). If you upload the font locally using wget then you can register the font like Canvas.registerFont('path/to/font/fontName.ttf', {family: 'fontFamily'});

fc-list shows you a list of installed fonts.


And how can we install more fonts?


you can just import these fonts to your Glitch project. Or by adding the fonts via git

git clone https://<user-token><project-name>/git
git checkout -b local

then you can copy the fonts into one fo the directory.

After that you’ll have to upload them to Glitch:

git add .
git commit -m "Added fonts"
git push -u origin local

Then you’ll go into the Glitch Console for your project to merge the local branch with the master branch.

git merge local

The refresh command is to refresh the connection between the editor and your project.