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

NewFont defaultLayerName argument #632

Open
typemytype opened this issue Mar 14, 2022 · 1 comment
Open

NewFont defaultLayerName argument #632

typemytype opened this issue Mar 14, 2022 · 1 comment

Comments

@typemytype
Copy link
Member

When creating a new font object it would be nice to set the name of the default layer.

When the default layer name is not "public.default", the layer name "public.default" cannot exists, defcon asserts

proposal, similar to the optional arguments familyName, styleName

NewFont(familyName="MyFont", styleName="Regular", defaultLayerName="foreground") 

A tiny script to show the problem:

from fontParts.world import NewFont

font = NewFont(familyName="MyFont", styleName="Regular")
layer = font.newLayer("foreground")

font.defaultLayer = layer
font.save("test.ufo")   # this raises an issue

the patch:

if defaultLayerName is not None:
    # change the name of the newly created default layer
     font.defaultLayer.name = defaultLayerName
@typemytype
Copy link
Member Author

I can make a PR and discus it there...

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

No branches or pull requests

1 participant