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

Things fea can't do: delete a glyph #1234

Closed
simoncozens opened this issue Oct 5, 2020 · 25 comments
Closed

Things fea can't do: delete a glyph #1234

simoncozens opened this issue Oct 5, 2020 · 25 comments

Comments

@simoncozens
Copy link
Collaborator

In my workshop I've been telling people "You can't delete a glyph using a substitution rule". The OT spec says as much: "A Multiple Substitution (MultipleSubst) subtable replaces a single glyph with more than one glyph". But... you can, Uniscribe, Harfbuzz and CoreText all support it, and Arial Unicode relies on the fact in its Devanagari implementation.

So it would be nice if there were syntax for it.

@khaledhosny
Copy link
Collaborator

A possible syntax might be sub foo by <NULL>;.

@simoncozens
Copy link
Collaborator Author

In the workshop I suggested sub a by;

@khaledhosny
Copy link
Collaborator

In the workshop I suggested sub a by;

That was the first to come on my mind, but it feels like a typo. <NULL> is used in several places already to mean nothing to see here, move on.

@anthrotype
Copy link
Member

yes, that looks like a typo to me, I prefer Khaled's proposal to use <NULL>.

@simoncozens
Copy link
Collaborator Author

Ok, I’ll work on a patch.

@josh-hadley
Copy link
Collaborator

Has anyone proposed a spec change for this yet? It would be nice to have the spec reflect reality and avoid having to explain why AFDKO supports something that is expressly prohibited (even if it is widely supported in implementations).

@mbutterick
Copy link

This proposal will break every tool that parses fea files.

@alerque
Copy link

alerque commented Oct 28, 2020

@mbutterick No. It will mean old tooling that doesn't get updated won't be interoperable with tooling that does on projects that use this as a feature. It won't automatically break old tools across the board or even reduce interoperability with new tools that don't happen to use the new feature.

@simoncozens

This comment has been minimized.

@mbutterick
Copy link

This is my last comment. Your point is true in the sense of concrete instances. But it is not true in the sense of abstract implementations, which is how tools interoperate. As a software author, I read a specification not just to learn what can happen but also what can never happen (and write tests accordingly). This is why, say, Unified Font Object is versioned: so that tool authors can make stable claims about their code.

@simoncozens
Copy link
Collaborator Author

The AFDKO spec is also versioned.

@moyogo
Copy link
Collaborator

moyogo commented Oct 28, 2020

Deleting a glyph sounds like the kind of thing that one would want to happen in a certain context. This case is supported.
If you want a feature that just deletes a glyph, there are ways to do it too but new syntax would be clearer.

@simoncozens
Copy link
Collaborator Author

simoncozens commented Nov 3, 2020

Interestingly, the feature grammar already provided explicitly for "sub X by NULL;", creating a substitution lookup with null replacement. I've just added a little bit of logic to make that pass validation and emit a font. I'm going to leave it there for now to see what we think about NULL versus <NULL>.

@khaledhosny
Copy link
Collaborator

NULL is a valid glyph name, so unless it is already a reserved word it would be a breaking change (keywords can be escaped, but it would still be a breaking change).

@khaledhosny
Copy link
Collaborator

Ignore me, there is no change to the grammar whatsoever so there are no breaking changes here.

@simoncozens
Copy link
Collaborator Author

Yeah, NULL is marked as a keyword and the grammar has actually accepted it in substitution rules since forever.

@josh-hadley
Copy link
Collaborator

Has anyone proposed a spec change for this yet?

Looks like this has been proposed at MicrosoftDocs/typography-issues#673, thanks @simoncozens for continuing this effort!

@simoncozens
Copy link
Collaborator Author

Bump.

We're waiting a decision on this: sub X by NULL; (which is already supported by the grammar and is easy to implement) versus sub X by <NULL>; (which may be less confusable, but kind of looks like a value record).

@punchcutter
Copy link
Contributor

How about something like sub X by NUL; to differentiate? Or NIL. Or if we go with NULL maybe it would be good to clarify it like the other uses so instead of just <NULL> it could be <glyph NULL> to line up with the existing <device NULL> and <anchor NULL>?

@simoncozens
Copy link
Collaborator Author

simoncozens commented Feb 1, 2021

Definitely not NUL or NIL as they could be glyph names; I quite like <glyph NULL>.

But really, “by NULL” already has syntax so we could just assign that syntax the obvious semantics...

@punchcutter
Copy link
Contributor

punchcutter commented Feb 1, 2021

But NULL is also a glyph name and when there's a glyph named NULL like there are in hundreds or thousands of existing fonts we can't automatically know which substitution is meant. Oh...I guess you mean since it's required to escape it as a name already?

@punchcutter
Copy link
Contributor

punchcutter commented Feb 1, 2021

I'm totally fine with NULL so if you have a PR let's just go for it.

@simoncozens
Copy link
Collaborator Author

Yeah, I mean NULL is already a special case in the grammar. Anyhow PR #1251 should do the job.

@khaledhosny
Copy link
Collaborator

The spec need to mention this somewhere as well.

@simoncozens
Copy link
Collaborator Author

Yes, working on spec change and fontTools implementation now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants