Buggy Font Display on MacOS

Working on a side-project which I'll be releasing soon-ish, and one of the issues I encountered was this manky display of a font I was rendering using canvas.

Screenshot of Jost font with rendering defect
Letters with cut-outs

The font is Jost and it displays perfectly fine on Google Fonts and when rendered as a variable font through CSS, but would have this odd cut-out thing going on when rendered with canvas.

I found a few tickets about this on GitHub:

It didn't matter from where you sourced the woff font files, the issue would persist.

One suggestion that seemed to have positive results was to use the variable font, however this isn't supported with the node-canvas package I was using to use canvas server-side. Using a local copy of the standard ttf seemed to do the trick, though. Just register it as you would other fonts before use.

Using client-side canvas:

const font = new FontFace('Font Family', 'url(/assets/fonts/FontName.ttf)');
await font.load();

Using server-side node-canvas:

Canvas.registerFont(path.resolve('public/assets/fonts/FontName.ttf'), {
    family: 'Font Family',

Using server-side pureimage:

const font = PureImage.registerFont(path.resolve('public/assets/fonts/FontName.ttf'), 'Font Family', fontWeight, fontStyle, fontVariant);
Published September 05, 2022