-
Notifications
You must be signed in to change notification settings - Fork 52
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
Rename backgrounds of layers with the same name #667
base: main
Are you sure you want to change the base?
Conversation
381dc42
to
69a9df6
Compare
80231a1
to
1492cc2
Compare
if master.id == layer.associatedMasterId: | ||
if layer.name not in layers_by_name: | ||
layers_by_name[layer.name] = [] | ||
layers_by_name[layer.name].append(layer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use dict.setdefault
or a defaultdict
layer_name = f"{layer.name} #{n!r}" | ||
n += 1 | ||
ufo_layer = ufo_font.newLayer(layer_name) | ||
if layer.name != "Color 1": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this "Color 1"? A new magic value? Why only 1
?
( | ||
l.name | ||
for l in ufo_font.layers | ||
if l.lib.get(LAYER_ID_KEY) == layer.layerId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you could store a map from layerId to layer name in the builder instance instead of finding them like this each time
I’m not quite sure whether this is due to this specific branch, or due to other code, but in a font I’ve use Is there a way to prevent the additional layers from being created? I don’t really need them. If this would be better as a separate issue, please let me know, and I can move this comment. |
Same as #570 but for background of layers with the same name.
It fixes #573 and #588.