Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't write special "Variable Font Setting" instances to designspace #786

Conversation

jenskutilek
Copy link
Contributor

Glyphs 3 stores export settings for variable fonts in special GSInstance instances.

Those are currently not special-cased by glyphsLib, and are written as a normal instance into designspaces files, which leads to duplicate instances in the exported variable font.

This PR avoids exporting them to a designspace, but more work needs to be done to preserve them in roundtripping. Probably they should be written to the designspace lib and when going from DS to Glyphs, be reconstructed from there.

@anthrotype
Copy link
Member

I don't know what '"Variable Font Setting" instance' mean, could you elaborate? Is there any link to documentation?

@anthrotype
Copy link
Member

oh, I just discovered what used to be named "Instances" tab is now named "Exports" and the plus button has

image

@anthrotype
Copy link
Member

anthrotype commented Apr 28, 2022

designspace v5 has a new <variable-font> elements to specify multiple VF targets, each with different axis definitions, and also its own <lib> for misc stuff associated with it, maybe the custom parameters associated with that given VF export setting should be stored in there. cc @belluzj

@jenskutilek
Copy link
Contributor Author

Exactly, those are what I mean. They can be used as a vehicle for custom parameters, filters, and other properties for a VF export.

Programmatically, they can be differentiated by GSInstance.type:

In the Glyphs tutorial:

@property
def type(self):
if self._type == INSTANCETYPEVARIABLE:
return "variable" # "variable" is stored in plist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's weird this type property returns either a constant string literal "variable" or a False bool value. What does Glyphs.app scripting API do in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returns the constant, 0 or 1, but in the plist the value is stored as str "variable" or not at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the plist the value is stored as str "variable" or not at all

then the conversion from 1 to "variable" should be done inside _serialize_to_plist method before writing the type key

@anthrotype
Copy link
Member

@jenskutilek I see this somehow conflicts/overlaps with @yanone's PR that we merged recently: #812 -- if there's anything from this PR that needs to be included, please rebase and adjust accordingly, otherwise we can close this

@jenskutilek
Copy link
Contributor Author

I've added some leftovers of this to #815.

@jenskutilek jenskutilek closed this Oct 5, 2022
@jenskutilek jenskutilek deleted the dont-export-vf-setting-instances branch October 10, 2022 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants