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

[MarkFeatureWriter] Rename anchors with invalid characters #477

Closed
moyogo opened this issue Mar 2, 2021 · 11 comments
Closed

[MarkFeatureWriter] Rename anchors with invalid characters #477

moyogo opened this issue Mar 2, 2021 · 11 comments

Comments

@moyogo
Copy link
Collaborator

moyogo commented Mar 2, 2021

For example in googlefonts/glyphsLib#963 there's an anchor called #topRight.

@JelleBosmaMT
Copy link

A #topright anchor should be ignored for feature code, not renamed.

@anthrotype
Copy link
Member

is that # some unwritten convention which we were not aware of?

@anthrotype
Copy link
Member

I just saw @JelleBosmaMT other comment googlefonts/glyphsLib#963

so that means we should handle this as a new Glyphs-specific feature. Possibly propose this to ufo-spec if useful more generally

@anthrotype
Copy link
Member

anthrotype commented Mar 3, 2021

... or maybe just go on and modify ufo2ft MarkFeatureWriter to take advantage of this, since we're already baking in a lot of Glyphs-app specific assumption that technically are not standard in UFO-world

@khaledhosny
Copy link
Collaborator

Regardless of this particular anchor name, I think this is a general issue and need to be handled here since feature files put restrictions on anchor names that UFO does not have.

From https://unifiedfontobject.org/versions/ufo3/glyphs/glif/#anchor:

An arbitrary name for the anchor. This attribute is optional. Name must not contain control characters.

So, for example, spaces are OK but the generated feature code will be broken (I did actually encounter a font with spaces in anchor names, though it was converted originally from a non-UFO format).

@anthrotype
Copy link
Member

Khaled is right, this needs to be addressed regardless of support for skipping #-prefixed anchors, since FEA syntax has some stricter requirements than UFO about naming things like anchors.

@madig
Copy link
Collaborator

madig commented Feb 17, 2022

https://glyphsapp.com/learn/reusing-shapes-component-tricks#g-__repurposing-cursive-attachment-for-ligatures says you can use anything non-lettery for anchors that should be used only for construction. I suppose this could be another opt-in filter inserted by glyphsLib, to remove anchors starting with non-letters.

@anthrotype
Copy link
Member

anthrotype commented Feb 17, 2022

but isn't _ (underscore, to denote a "mark" anchor) also not a letter? or is that special?

@madig
Copy link
Collaborator

madig commented Feb 17, 2022

I don't know :D @schriftgestalt

@schriftgestalt
Copy link

Underscores means that this anchor should attach to some other anchor. And mostly that means it is a mark. But can be a pice of a letter, too. You don’t need to filter custom anchor names. Just look if the glyph that constants the underscore version is a proper mark glyph. In glyphs, I build the mark classes first and then only use those anchors that has a mark class.

@khaledhosny
Copy link
Collaborator

This is fixed by #869 as it now ignores anchors such as #top. Closing this now until someone comes up with another anchor naming scheme that could result in invalid feature code.

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

6 participants