问题描述
我正在尝试通过从我的设计标记中读取的插件创建 figma 文本样式。我遇到的问题是在设置自定义字体时,加载它的承诺没有解决,所以它似乎停止了该功能。
我在这里遗漏了什么吗?
async function createNewTextStyle(token) {
// Style does not yet exist,so create it
const newStyle = figma.createTextStyle();
// the new text style is preloaded with Roboto,so we need to load that
await figma.loadFontAsync(newStyle.fontName);
// This is the font i want to set my text style to.
// it seems that this promise never resolves (or errors).
await figma.loadFontAsync({
family: 'SF Pro Text',style: 'Regular',});
// Set the properties of the text style
newStyle.fontName = {
family: 'SF Pro Text',};
newStyle.name = designToken.name;
newStyle.fontSize = designToken.value;
newStyle.lineHeight = { value: designToken.lineHeight,unit: 'PIXELS' };
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)