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

Include empty glyphs when calculating max width, to match fonttools #1099

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

Hoolean
Copy link
Contributor

@Hoolean Hoolean commented Nov 6, 2024

Most fields in hhea are set based only on glyphs with bounds, but advanceWidthMax is an exception to this, as it considers every glyph that has an entry in hmtx.

This commit includes empty glyphs in the calculation of the field, which matches fontmake's behaviour. After this change, Fleur De Leah compiles identically:

$ python resources/scripts/ttx_diff.py https://github.com/googlefonts/fleurdeleah#sources/FleurDeLeah.glyphs
  ...
output is identical

Note: this is a personal contribution independent of my employer, and so I've submitted from a fork under my personal profile and email to make this distinction

Most fields in `hhea` are set based on glyphs with bounds:

https://github.com/fonttools/fonttools/blob/e04dfaab/Lib/fontTools/ttLib/tables/_h_h_e_a.py#L101-L119

but `advanceWidthMax` is an exception to this, as it considers every
glyph that has an entry in the `hmtx` table:

https://github.com/fonttools/fonttools/blob/e04dfaab/Lib/fontTools/ttLib/tables/_h_h_e_a.py#L73
@Hoolean
Copy link
Contributor Author

Hoolean commented Nov 6, 2024

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, this makes sense!

@cmyr cmyr added this pull request to the merge queue Nov 6, 2024
Merged via the queue into googlefonts:main with commit 39b7a88 Nov 6, 2024
9 of 10 checks passed
@Hoolean Hoolean deleted the include-empties-for-max branch November 7, 2024 20:30
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

Successfully merging this pull request may close these issues.

2 participants