Font-face in plugin UI

Hi!

I’m designing a Figma Plugin and want to use a custom font in my plugin UI. I don’t intend on modifying nodes with this font at all so I don’t care if it’s available for that purpose. I’ve tried doing this the normal way: adding an otf file to my codebase then creating a font-face in my css linking to that file. However, when I use the newly created font-family, the font isn’t loading in the UI. I’m fairly new to figma plugins so I’m not sure what the issue is.

Tried using a link to Google fonts and I get this error.

Refused to load the stylesheet ‘https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;600&display=swap’ because it violates the following Content Security Policy directive: “style-src ‘unsafe-inline’ ‘unsafe-eval’ data: blob:”. Note that ‘style-src-elem’ was not explicitly set, so ‘style-src’ is used as a fallback.

Any thoughts on how to fix?

Did you add manifest.networkAccess?

I did not, I will try that.

That didn’t work :frowning:

It changed the error a bit though. Now I get the following:

Refused to load the font '<URL>' because it violates the following Content Security Policy directive: "font-src <URL> data: blob: <URL>".

That worked when I added all of the domains. :).

Thanks for the help.

I’ve never encountered this error when connecting Google Fonts, and I find it strange because manifest.networkAccess is optional. Therefore, I suggest you contact the Figma support team.

Yea, I thought it was weird too, but the manifest.networkAccess did work.