Skip to main content
kwik_kwak
July 13, 2022
Solved

How can I access variable font axes settings

  • July 13, 2022
  • 3 replies
  • 1153 views

How can I access the value of a variable font axis.

I’m writing a plugin and trying to extract the font from a TextNode.
It’s possible in Figma to set the font axes to a custom value for variable fonts(e.g. the weight of the font).

When I do this in Figma the input for the font style changes from e.g. ‘Regular’ to ‘Weight: 357’. My approach to accessing this property was to read the fontName value of the text segment and then read its style property.

But, and that’s the problem I’m currently facing, instead of giving me that value of ‘Weight: 357’ I just get the style ‘Regular’. After further testing I noted that the font weight gets rounded to the nearest style that has a text value.

For example, 120 becomes ‘Thin’ and 170 becomes ‘Extra light’. This is a problem because I am unable to get the exact weight, only a rounded value.

Is there something I missed? Another way of accessing the weight to get the exact value?

PS: I tried the ‘Oswald’ and ‘Syne’ fonts, both give me the same problem.

This topic has been closed for replies.
Best answer by tank666

There are currently no properties or methods in the Plugin API to get/set properties for variable fonts.

3 replies

tank666
tank666Answer
July 13, 2022

There are currently no properties or methods in the Plugin API to get/set properties for variable fonts.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
kwik_kwak
kwik_kwakAuthor
July 13, 2022

Ok, thanks for the quick response.

Bishwajit_Adhikary
New Member
July 3, 2024

Does Figma currently have any properties or methods for variable fonts?