Skip to main content
Max_English
Jul 30, 2022 3:59 PM UTC
Question

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.

This topic has been closed for replies.

8 replies

tank666
Jul 30, 2022 4:08 PM UTC
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Corey_O_Brien
Active Member
Nov 6, 2023 8:55 PM UTC

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?

tank666
Nov 6, 2023 9:16 PM UTC
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Corey_O_Brien
Active Member
Nov 6, 2023 9:20 PM UTC

I did not, I will try that.

Corey_O_Brien
Active Member
Nov 6, 2023 9:26 PM UTC

That didn’t work 😦

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>".

Corey_O_Brien
Active Member
Nov 6, 2023 9:36 PM UTC

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

Thanks for the help.

tank666
Nov 6, 2023 9:53 PM UTC

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.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Corey_O_Brien
Active Member
Nov 6, 2023 10:02 PM UTC

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