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.

Calling instantiateVariableFont can lead to negative advance widths in hmtx

See original GitHub issue

Hi!

Calling instantiateVariableFont can introduce negative advance widths in the hmtx table:

https://github.com/fonttools/fonttools/blob/796c1f13303f0af515166e95bff1191f8d4e7f16/Lib/fontTools/varLib/mutator.py#L121-L149

We could probably replace line 146 by entry[0] = max(0, entry[0] + width_delta). I can open a PR if you want.

(Carefully crafted fonts shouldn’t trigger this problem, but I’ve got it using a subset font where advance of unused glyphes has been set to 0.)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
anthrotypecommented, Sep 20, 2022

you’re right

We could probably replace line 146 by entry[0] = max(0, entry[0] + width_delta). I can open a PR if you want.

yes please, thank you

1reaction
anthrotypecommented, Sep 18, 2022

We can backport the fix to mutator as well, I can take a look tomorrow

Read more comments on GitHub >

github_iconTop Results From Across the Web

"'hmtx' table can't contain negative advance widths": I' ...
'hmtx' table can't contain negative advance widths @nyshadhr9 got this error when trying to subset a VF font supplied offline by @m4rc1e We ......
Read more >
fonttools [python-library]
| fontTools is a library for manipulating fonts, written in Python. The project includes the TTX tool, that can convert TrueType and OpenType...
Read more >
hmtx - Horizontal metrix table (OpenType 1.9) - Typography
The table uses a longHorMetric record to give the advance width and left side bearing of a glyph. Records are indexed by glyph...
Read more >
PKG-INFO - platform/external/fonttools
project includes the TTX tool, that can convert TrueType and OpenType. fonts to and from an XML text format, which is also called...
Read more >
RF 1.8 Test Install hmtx error
Looking at the output window, the bottom line says: TTLibError: 'hmtx' table can't contain negative advance widths.
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