Skip to main content
Solved

How can I access variable font axes settings


kwik_kwak

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.

Best answer by tank666

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

View original

3 replies

tank666
  • 4859 replies
  • Answer
  • July 13, 2022

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


kwik_kwak
  • Author
  • 1 reply
  • July 13, 2022

Ok, thanks for the quick response.


Bishwajit_Adhikary

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


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