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

[makeotf] substitution without target item does not fail #1737

Open
frankrolf opened this issue Mar 7, 2024 · 8 comments
Open

[makeotf] substitution without target item does not fail #1737

frankrolf opened this issue Mar 7, 2024 · 8 comments
Assignees

Comments

@frankrolf
Copy link
Member

Unexpectedly, a features.fea looking like this seems to be completely acceptable to makeotf:

languagesystem DFLT dflt;

@letters_lowercase = [ a b c d e f g h i j k l m n o p q r s t u v w x y z ];

feature ccmp {
	sub @letters_lowercase;
} ccmp;

(note no target item in the substitution).
This could be a feature – just making sure it’s not accidental.

Example project attached: subs_no_target.zip

@skef
Copy link
Collaborator

skef commented Mar 7, 2024

I think that syntax just amounts to an implicit "by NULL".

@skef
Copy link
Collaborator

skef commented Mar 8, 2024

Yes, I looked at the code and this is treated the same as if there was an explicit "by NULL", so I think it's OK.

@frankrolf
Copy link
Member Author

This whole scenario was encountered by a student in a FDK workshop – they reminded me of what the effect was. Basically, this substitution kills the a in the target font (nothing else):

image

Still expected?

@skef
Copy link
Collaborator

skef commented Mar 13, 2024

I guess the first question is whether putting in an explicit "by NULL" changes the outcome. If it doesn't, then it's more or less expected. If it does change the outcome then there's a discrepancy.

The other question is whether "by NULL" is implemented correctly for this case.

@frankrolf
Copy link
Member Author

frankrolf commented Mar 14, 2024

more verbose, as suggested:

sub @letters_lowercase by NULL;

same result, only a is affected


try to affect more glyphs than the a

sub @letters_lowercase by NULL NULL;

fails


different feature tag

feature smcp {
	sub @letters_lowercase;
} smcp;

no difference


different logic

@letters_lowercase = [ a b c d e f g h i j k l m n o p q r s t u v w x y z ];
@null_group = [ NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL ];

feature ccmp {
	sub @letters_lowercase by @null_group;
} ccmp;

fails


deliberate

feature ccmp {
	sub a by NULL;
	sub b by NULL;
	sub c by NULL;
	sub d by NULL;
	sub e by NULL;
	sub f by NULL;
	sub g by NULL;
	sub h by NULL;
	sub i by NULL;
	sub j by NULL;
	sub k by NULL;
	sub l by NULL;
	sub m by NULL;
	sub n by NULL;
	sub o by NULL;
	sub p by NULL;
	sub q by NULL;
	sub r by NULL;
	sub s by NULL;
	sub t by NULL;
	sub u by NULL;
	sub v by NULL;
	sub w by NULL;
	sub x by NULL;
	sub y by NULL;
	sub z by NULL;
} ccmp;

works


sneaky NULL

@letters_lowercase = [ a b c d e f g h i j k l m n o p q r s t u v w x y z ];
@null_group = [ a b c d NULL f g h i j k l m n o p q r s t u v w x y z ];

feature ccmp {
	sub @letters_lowercase by @null_group;
} ccmp;

fails

@anthrotype
Copy link
Member

anthrotype commented Mar 14, 2024

this is documented here: https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html#5a-gsub-lookuptype-1-single-substitution

If the replacement glyph is the reserved word NULL, then the substitution has no replacement, removing the input glyph from the glyph sequence:
substitute a by NULL;
Omitting the by clause is equivalent to adding by NULL.

@frankrolf
Copy link
Member Author

Thank you Cosimo. I guess my original question is answered there, however some of the results (only the first item of a group is replaced) are surprising.

@skef
Copy link
Collaborator

skef commented Mar 14, 2024

however some of the results (only the first item of a group is replaced) are surprising.

Yes, this seems like it's a bug (assuming it's something we can fix, which seems likely)

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

3 participants