F-strings in Font Info?

I cannot find the topic, but I’m pretty sure that I wrote that It was possible to use f-strings to use variable in some field in Font Info ? I’m wrong ? If not, someone can explain me how to do it ?


What is you use case? Dynamically insert data into some of the Font Info entries? What data and into which entries?

For example in my exports I’m used to add fileName CP.
For now I wrote this script to auto set them based on FamilyName and Style Name.
It add space between family Name and Style Name, and replace spaces by hyphen.

font = Glyphs.font
for instance in font.instances:
	instance.customParameters["fileName"] = f"{instance.familyName} {instance.name}".replace(" ", "-")

I think that isn’t fully implemented, yet.

1 Like

Half of this is implemented. You can use tokens in the info fields like this:


this will check if the instance or the font return something for familyName and name and if so, replace that token with the result. That will produce a very similar result except that spaces inside the family name or instance name will not be replaced with a hyphen.

1 Like