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

undefined formatting of <note> text leads to roundtripping issues #210

Open
anthrotype opened this issue Oct 17, 2022 · 1 comment
Open

Comments

@anthrotype
Copy link
Member

https://unifiedfontobject.org/versions/ufo3/glyphs/glif/#note

This element is a place for the user to define arbitrary text about the glyph. There is no standardized structure for the note apart from that it being the content of the note element.

This "no standardized structure" leads different implementations to do different things with the note, making it hard/impossible to maintain its text unchanged when passing through alternative UFO parser/writers.

see fonttools/fonttools#2745

As for the fontTools.ufoLib (reference) implementation, it currently does the following:

  • upon serializing, a newline is inserted at the beginning and at the end of the text content (presumably so that the element tags are on a separate line);
  • then upon deserializing, newlines are normalized to unix line endings \n and all leading/trailing whitespace is stripped from each line, empty lines are stripped too.

I think the spec should just mandate the above for the sake of interoperability. It's probably too late to change fontTools.ufoLib semantics around <note>.

@benkiel
Copy link
Contributor

benkiel commented Oct 17, 2022

Agree that we should just note that. Will make a PR. Please ping me if I've not by weeks end (many things going on)

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

2 participants