Complete the code to apply a text style named 'Heading' to a text node.
textNode.textStyleId = [1]loadFontAsync which is for fonts, not styles.To apply a text style, you get the style by name and assign its id to the text node's textStyleId.
Complete the code to load the font 'Roboto' before applying text styles.
await figma.loadFontAsync({ family: 'Roboto', style: [1] })Loading the 'Regular' style of 'Roboto' font is common before applying text styles.
Fix the error in the code to correctly create a new text style named 'Subtitle'.
const style = figma.[1](); style.name = 'Subtitle'; style.fontName = { family: 'Arial', style: 'Regular' };
getTextStyle which retrieves existing styles.loadFontAsync which loads fonts, not styles.The correct method to create a new text style is createTextStyle().
Fill both blanks to set the font size and line height of a text style.
style.fontSize = [1]; style.lineHeight = { value: [2], unit: 'PIXELS' };
Setting font size to 20 and line height to 24 pixels is a common style for readability.
Fill all three blanks to create and apply a new text style named 'Caption' with font 'Roboto', size 12, and line height 16.
await figma.loadFontAsync({ family: [1], style: [2] });
const captionStyle = figma.createTextStyle();
captionStyle.name = [3];
captionStyle.fontName = { family: 'Roboto', style: 'Regular' };
captionStyle.fontSize = 12;
captionStyle.lineHeight = { value: 16, unit: 'PIXELS' };You must load the 'Roboto' font with 'Regular' style, then create a text style named 'Caption'.