Skip to main content
Question

Trouble with empty text after setting up.


Michael_Hajny

I have trouble filling in the text. I have tried many solutions but none of them worked. When I look at the Figma, I can see that the text is on the left panel but is empty. It has proper font but the height of the text is false and there is nothing inside of the text container.

// Create text
      let text = figma.createText();

      // Set a specific font before loading it
      let font = { family: "Open Sans", style: "Regular" };

      (async () => {
        // Move to positions
        text.x = i * horizontalSpacing;
        text.y = i * verticalSpacing - 50;

        // Load the font in the text node before setting the characters
        await figma.loadFontAsync(font);
      })().then(() => {
        text.fontName = font;
        text.characters = `COLOR NAME = ${colorArray[i][0].toUpperCase()}`;

        // Set font size and color
        text.fontSize = 18;
        text.fills = [{ type: "SOLID", color: { r: 5, g: 0, b: 18 } }];

        // Append the text to the page
        figma.currentPage.appendChild(text);
        nodes.push(text);
      });

0 replies

Be the first to reply!

Reply


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