Embedding Fonts into SVG

I am working on a notebook with a custom font. I link the font externally and use the “addWebFont” function in this notebook. On most devices, the font loads correctly. But sometimes the fonts don’t load when people open it. Does anyone have any idea why this is happening?

I use the “Acumin Pro” font with the following code:

    const svg = d3
        .attr("width", width)
        .attr("height", height)
        .attr("viewBox", [0, 0, width, height])
          'Acumin Pro',

Hi @haoshuai do you have an example when it is not working?
Can you try on these devices without using the cors-proxy? my guess is that this could be the issue


1 Like

Glitch instances have both a startup time and a rate limit. It’s possible that you’ve met either one or the other.

If it’s the rate limit, then I’d recommend to fork the project and use your own CORS proxy instance.

Note that you can also base64-encode webfonts in order to inline them.


Thanks for the help. I replace the start of the GitHub gist URL with “https://gist.githubusercontent.com” and remove the cors-proxy head. Now it works pretty well on different devices. And I also find a very helpful notebook about it.

If you want to fetch content from Github (be it gists or files), there’s also raw.githack.com, the spiritual successor to rawgit.com.