You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Tomas, I think this error is happening because the code couldn't access the font mentioned. Try checking the font path and verify the permissions if there are any. Make sure that the font is in (.otf or .ttf) format as Figma only supports these two formats. I think this would help you.
The updated code with error handling block 👇🏻
figma.listAvailableFontsAsync().then(fonts => {
for (const font of fonts) {
if (font.fontName.family === 'My Font' && font.fontName.style === 'Regular') {
figma.loadFontAsync(font.fontName)
.then(() => {
console.log('Font loaded successfully');
})
.catch(error => {
console.error('Failed to load font:', error);
});
}
}
}).catch(error => {
console.error('Failed to retrieve available fonts:', error);
});
The following snippet logs a warning
unhandled promise rejection: Throw: The font "My Font Regular" could not be loaded
I purposefully chose not to have an error handler, since this code shouldn't actually fail.
I'm developing a variable font and I seem unable to load it via a plugin. Is this just a consequence of figma/community#2 ?
The text was updated successfully, but these errors were encountered: