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

[GDEF / GSUB/GPOS] Glyph Filtering #25

Open
behdad opened this issue Sep 17, 2021 · 4 comments
Open

[GDEF / GSUB/GPOS] Glyph Filtering #25

behdad opened this issue Sep 17, 2021 · 4 comments

Comments

@behdad
Copy link
Member

behdad commented Sep 17, 2021

EDIT: Changed my mind about the details. See updated proposal in comments.

Generalized glyph filtering in GSUB/GPOS based on work Martin Hosken and I proposed in 2016.

Original proposal:
https://github.com/OpenType/opentype-layout/blob/63d169c92160832cf5b2333f28b559c80c9a4389/proposals/glyph_filtering.md

Details are fleshed out in:
OpenType/opentype-layout#21

@behdad behdad added this to the BE 2.0 ~= OT 2.0 milestone Sep 17, 2021
@behdad
Copy link
Member Author

behdad commented Sep 17, 2021

To be done after LookupFlag extension #26.

Allocate two bits from LookupFlag extension (leave the existing OpenType free LookupFlags intact).

The two new bits will be:

  • UseGlyphSkipSet
  • UseGlyphStopSet

For each of those bits, if set, the Lookup structure will be followed by a uint16:

  • uint16 GlyphSkipSet
  • uint16 GlyphStopSet
    which are indices into GDEF's MarkGlyphSets struct (which we might return to just GlyphSets) UPDATE: (See [GDEF / GSUB/GPOS] Glyph Filtering #25) a new GlyphSets array-of-coverages struct.

The glyph filtering algorithm then will be this:

  • If UseGlyphStopSet is used and current glyph is in the referenced set, stop;
  • If UseGlyphSkipSet is used and current glyph is in the referenced set, skip;
  • Otherwise use the OpenType algorithm.

GDEF version major 1 minor 4 will have the following field follow itemVarStoreOffset:

  Offset24To<GlyphSets> glyphSets;

whereas

struct GlyphSetsFormat1 {
  uint8 format; == 1
  Array24Of<Offset24To<Coverage>> coverages;
};

@behdad
Copy link
Member Author

behdad commented Sep 17, 2021

cc @mhosken @jfkthame

@simoncozens
Copy link

Currently in GDEF we have a glyph class definition which takes a ClassDef structure but only assigns meaning to four values (base, lig, mark, component) which are special-cased the lookup flags. Allowing glyph classes >4 in the glyph class definition table would give you the ability to subdivide bases etc. into multiple classes for free.

@behdad
Copy link
Member Author

behdad commented Sep 17, 2021

Allowing glyph classes >4 in the glyph class definition table would give you the ability to subdivide bases etc. into multiple classes for free.

That takes us in the wrong direction though...

Mark glyphs were divided so into classes. But it was found that we need overlapping sets. That's when MarkFilteringSets were added. So, dividing glyphs into more disjoint sets doesn't help, hence extending the MarkFilterintSets to all glyphs is the way to go.

@behdad behdad added the Layout label Sep 19, 2021
@behdad behdad changed the title [Layout] Glyph Filtering [GSUB/GPOS] Glyph Filtering Sep 19, 2021
@behdad behdad changed the title [GSUB/GPOS] Glyph Filtering [GDEF / GSUB/GPOS] Glyph Filtering Sep 20, 2021
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

2 participants