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

Upconvert UFO v1 and v2 kerning data #32

Merged
merged 3 commits into from
Apr 5, 2020
Merged

Conversation

madig
Copy link
Collaborator

@madig madig commented Mar 4, 2020

Part of #31.

TODO:

  • Make it work, then make it not copy everything
  • Run kerning group validation after conversion
  • Implement all reference implementation tests (Tests/ufoLib/UFOConversion_test.py!)
  • Move into own utility/conversion module?
  • What if the target kerning group exists already? Making the names unique won't save you from then potentially having glyphs in more than one kerning group. The reference implementation already fails here. Error out
  • What if either groups.plist or kerning.plist exist but not both? The algorithm needs groups.plist at minimum, kerning.plist can be empty. Pass in empty container if kerning is None.

@madig
Copy link
Collaborator Author

madig commented Mar 8, 2020

ufoLib fails itself when you up/downconvert UFOs from v2 -> v3 -> v2 and load the last UFO again. Since it leaves all groups intact, upconversion will hit duplicate group names and make new ones with the same glyph list. Validation will subsequently fail.

In [3]: u = defcon.Font("sourcesanspro_v2.ufo")
In [4]: u.save("/tmp/sourcesanspro_v3.ufo", formatVersion=3)
In [5]: u2 = defcon.Font("sourcesanspro_v3.ufo")
In [6]: u2.save("/tmp/sourcesanspro_v2_2.ufo", formatVersion=2)
In [7]: u3 = defcon.Font("/tmp/sourcesanspro_v2_2.ufo")
[...]
UFOLibError: The glyph "nu" occurs in too many kerning groups.

@madig madig marked this pull request as ready for review April 1, 2020 23:13
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.

Okay a couple little nitty things but overall this looks good!

src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Outdated Show resolved Hide resolved
src/upconversion.rs Show resolved Hide resolved
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.

okay a couple little things you can try if you like, otherwise I'm happy!

src/ufo.rs Outdated Show resolved Hide resolved
src/ufo.rs Outdated Show resolved Hide resolved
src/upconversion.rs Outdated Show resolved Hide resolved
Also, make Groups a mapping of Strings to Vecs of GlyphNames (Arc<str>).
- Upgrade loaded UFO's meta version to v3
- Add GroupsUpconversionError, shares inner error with GroupsError
@madig madig merged commit 9688e0b into master Apr 5, 2020
@madig madig deleted the add-kerning-upconversion branch April 5, 2020 13:41
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