question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add check to ensure a base glyph isn't classified as a mark glyph in GDEF table

See original GitHub issue

We pushed Hebo VF to production yesterday and a user reported that the comma and underscore are not working as intended, https://github.com/google/fonts/issues/2453.

When I inspect the GDEF table, we can see that the “comma” is a class 3 aka a “Mark” glyph, https://docs.microsoft.com/en-us/typography/opentype/spec/gdef#glyph-class-definition-table

(venv) Marcs-Air:heebo marcfoley$ grep "comma" Heebo\[wght\].ttx
      <ClassDef glyph="comma" class="3"/>

When I inspect the source files, we can see a mark anchor exists in the comma.

Screenshot 2020-05-14 at 13 28 53

An _ denotes that this glyph is a mark glyph

To ensure that base glyphs are not classified as a mark glyph, we could raise a fail If a glyph has an advance width greater than 0 and it exists in the gdef.GlyphClassDef as class 3.

More than happy to submit a pr.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
anthrotypecommented, May 14, 2020

we could raise a fail If a glyph has an advance width greater than 0 and it exists in the gdef.GlyphClassDef as class 3

yes, that could be a signal that something is not ok, either the GDEF classifies a base glyph incorrectly as a mark, or a glyph that is supposed to be used as a mark has an incorrect advance width that should have been 0.

Note that in glyphsLib we automatically set the advance width to 0 for glyphs that are classified as nonspacing marks (via GlyphData.xml or custom glyph properties).

Technically one does not need to set width to 0 because OT layout engines would automatically do when if a glyph is classified as mark.

1reaction
anthrotypecommented, May 14, 2020

IMO it would be better to recommend that the sources contain an explicit GDEF table definition in the UFO/features.fea (this is created automatically by fontmake for .glyphs sources using GlyphData.xml database in glyphsLib). When there is an explicit GDEF definition in the features.fea, ufo2ft does not guesses whether a glyph is a mark by the presence of an _-prefixed anchor, but instead it uses the GDEF to classify glyphs as bases, marks and ligatures accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GDEF — Glyph Definition Table (OpenType 1.9) - Typography
The Glyph Class Definition (GlyphClassDef) table identifies four types of glyphs in a font: base glyphs, ligature glyphs, combining mark ...
Read more >
Glyphs 3 Handbook
Glyphs can automatically build the 'mark' (Mark to Base) feature using anchors. ... If this approach does not work, check Test Install in...
Read more >
Tables panel - FontLab VI Help
By default, FontLab will not import the tables listed in the Preferences > Open Fonts > Do not import these tables to Tables...
Read more >
OpenType Feature File Specification | afdko - GitHub Pages
Note: The feature file glyph classes described in this section are not to be ... mark glyphs are specified in the glyph class...
Read more >
Glyphs and special characters - Adobe Support
The character appears at the text insertion point. Insert a recently used glyph. InDesign tracks the previous 35 distinct ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found