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

Stricter layer renaming handling #254

Merged
merged 3 commits into from
Jan 26, 2022
Merged

Stricter layer renaming handling #254

merged 3 commits into from
Jan 26, 2022

Conversation

madig
Copy link
Collaborator

@madig madig commented Jan 24, 2022

Broken out of #251 to ease reviewing.

  1. Layer renaming should assign new paths as well, ...
  2. ... except the default layer must always have the default layer path.
  3. Protect the default layer name harder, it must only ever be assigned to the default layer.

Closes #253

@github-actions
Copy link

🗜 Bloat check ⚖️

Comparing 784400e against d9888dc

target old size new size difference
target/release/examples/load_save 1.9 MB 1.9 MB -440 Bytes (-0.02%)
target/debug/examples/load_save 8.61 MB 8.61 MB -160 Bytes (-0.00%)

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

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

Looks good, a couple little comments inline. Is get_or_create worth keeping? It was intended as a convenience method but now it's just seeming uglier and uglier :/

/// 1. `name` is empty or if it contains any [control characters].
/// 2. `name` is the default layer name but the default layer has a
/// different name. Use [`Self::default_layer`] or
/// [`Self::default_layer_mut`] instead.
Copy link
Member

Choose a reason for hiding this comment

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

with this getting so complicated I wonder if we should just remove get_or_create?

Copy link
Member

Choose a reason for hiding this comment

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

Alternatively we could just return the default layer if the user passes the default layer name, even if the default layer has another name? idk

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm. I made the method for two particular calls in my custom to-UFO converter thing. I suppose I could make it work without the method. Shall I remove it in this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll do it in a separate PR.

src/layer.rs Outdated Show resolved Hide resolved
Base automatically changed from fontinfo-check-postscript-pairs to master January 25, 2022 15:52
@github-actions
Copy link

🗜 Bloat check ⚖️

Comparing 00fe3d7 against 7a983d0

target old size new size difference
target/release/examples/load_save 1.9 MB 1.9 MB -400 Bytes (-0.02%)
target/debug/examples/load_save 8.59 MB 8.59 MB -152 Bytes (-0.00%)

@linebender linebender deleted a comment from github-actions bot Jan 26, 2022
@madig madig merged commit a309e93 into master Jan 26, 2022
@madig madig deleted the fix-layer-renaming branch January 26, 2022 12:31
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.

LayerSet.rename_layer does not set new path
2 participants