Skip to main content
Question

loadFontAsync always get stuck


Ahmed_Genaidy

I want to load some fonts programatically I get the font form the selected text layer and apply it in another text layer and do some changes

const fontLoadingFunction = async (node: TextNode) => {
  await Promise.all(
    node.getRangeAllFontNames(0, node.characters.length)
      .map(figma.loadFontAsync)
  )
  console.log("Awaiting the fonts.")
}

and this is the call function

  // Load fonts
  await fontLoadingFunction(textNode);

after this function I do some changes to node

the code works very well when I try it in the console.
but when I try it in the plugin it doesn’t work and give me this warning
there are still font loads in progress. Please ensure closePlugin is not called until after the font loading has resolved.

This topic has been closed for replies.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings