MicrosoftDocs / typography-issues

Creative Commons Attribution 4.0 International
47 stars 21 forks source link

MultipleSubst may have zero replacement glyphs #673

Open simoncozens opened 4 years ago

simoncozens commented 4 years ago

While the GSUB spec says:

A Multiple Substitution (MultipleSubst) subtable replaces a single glyph with more than one glyph

all shapers currently support a substitution rule which deletes a glyph, and Microsoft's own fonts rely on this behaviour.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

tiroj commented 4 years ago

What tools enable creation of such a substitution lookup? I know VOLT has no way to specify a null output, and I presumed AFDKO feature code didn't either.

PeterCon commented 4 years ago

Side note: when opening issues pertaining to a specific part of the OT spec, it's really helpful if you use the link at the bottom of the page in question. Thanks.

PeterCon commented 4 years ago

(Makes me think, One could use a type 2 or even type 4 (ligature) lookup subtable to do a single substitution.)

So, Simon, you've made a observation, but you haven't suggested any change.

GSUB type 2 was designed to support one-to-many substitutions, and the spec states that the Sequence table must specify sequences with length > 0. However, in the current spec, it doesn't require that MultipleSubstFormat1.sequenceCount must be >0. So, a MultipleSubstFormat1 without any Sequence subtables would seem to provide a one-to-none substitution.

Microsoft's own fonts rely on this behaviour

I wouldn't necessarily take the Arial Unicode MS font, which is no longer distributed with any MS products, as a precedent for what the design should be. If ability to delete a glyph from a sequence using a type 2 lookup is useful and desirable, there should be a stronger case for that than "because of Arial Unicode MS".

Is the request that spec explicitly sanction type 2 being used for 1->0 substitution?

simoncozens commented 4 years ago

So, Simon, you've made a observation, but you haven't suggested any change.

I’ve filed a bug in a Microsoft product. Microsoft can decide how busy to fix it.

simoncozens commented 4 years ago

I’ll be adding support for zero-replacement substitutions in AFDKO and fontTools soon.

NorbertLindenberg commented 4 years ago

Here’s one use case for a deletion rule: https://lindenbergsoftware.com/en/notes/constructing-fonts-for-batak/index.html#Reordering

justvanrossum commented 3 years ago

However, in the current spec, it doesn't require that MultipleSubstFormat1.sequenceCount must be >0. So, a MultipleSubstFormat1 without any Sequence subtables would seem to provide a one-to-none substitution.

That makes no sense to me whatsoever.

The spec also says "The Sequence table offsets are ordered by the Coverage index of the input glyphs", which I read as "for each glyph in the coverage, there is one item in the sequenceOffsets array". It isn't spelled out, but doesn't this imply that sequenceCount should be the number of glyphs in the coverage table? What would be a use case of that not being true?

Perhaps some glyphs needs (non-empty) substitutions, and some need empty substitutions.

I see no reason why glyphCount shouldn't be allowed to be zero.

ErwinDenissen commented 3 years ago

What tools enable creation of such a substitution lookup? I know VOLT has no way to specify a null output, and I presumed AFDKO feature code didn't either.

FontCreator supports this since version 12.

ctrlcctrlv commented 3 years ago

I have proposed explicitly supporting this in FontForge's FEA implementation, as we already do so implicitly. (Fonts that have 0-length mult subs are understood.)

See fontforge/fontforge#4619