DirectedEdges / specs-plugin

33 stars 0 forks source link

Unloaded font #171

Closed Jvanamstel closed 2 months ago

Jvanamstel commented 2 months ago

Description

When clicking Run in the plugin I get an error as added below

Steps to reproduce

Select an object in Figma, Start the plugin and click Run.

Screenshot

image

Additional context

-

Defect log

in appendChild: unloaded font "Noto Sans, noto-sans Regular". Please call figma.loadFontAsync({ family: "Noto Sans, noto-sans", style: "Regular" }) and await the returned promise first.

nathanacurtis commented 2 months ago

@Jvanamstel Thanks for submitting. Any chance you could share a view-only version of that component/frame so that I can troubleshoot?

Jvanamstel commented 2 months ago

Hi, I copied the component to a separate file so you can view it: https://www.figma.com/design/1pbbd2nw4pmJY0uMgEEPoG/Temp-Jasper?node-id=0-1&t=i0jVsusVvo7miruw-1

Jvanamstel commented 2 months ago

I found the problem: The font type is set by a variable and that variable contains not just the name of the font but also the name in kebab-case for developers. If I remove the second name the plugins works. image Having two values in the variable also does not work in Figma itself. It will not be applied to text styles or components. So I don't think you should bother adding it to your plugin and just follow Figma in this.

nathanacurtis commented 2 months ago

Ah, thanks for troubleshooting. I think that would make sense if you are running the plugin with Modes active, as an impact of recent Figma enhancements for typography variables. Was Modes turned on while running the plugin?

A second alternative could be that you ran it on a component within a context inheriting mode A, whereas once the component/frame was being evaluated in isolation, that inherited mode didn't apply, thus changing the font.

Either of these apply?

Jvanamstel commented 2 months ago

There were no Modes active when I got the error. But it seems the plugin tried to load font "Noto Sans, noto-sans Regular" and that, ofcourse, does not exist. By putting in one value in the variable the plugin will try to load "Noto Sans Regular" and that works fine.