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.

[Variable Fonts] Check fonttools.varLib.mutator can generate a static instance from a variable font

See original GitHub issue

This test is needed because the GF Team want to generate font instances from variable fonts.

One of our variable test fonts, MarkaziText-VF.ttf (will email it to you @felipesanches ), failed in mutator with the following cli input

$./fonttools varLib.mutator MarkaziText-VF.ttf wght=500

Which produced the following traceback

Location: {'wght': 500.0}
Loading variable font
Normalized location: {'wght': 0.33331298828125}
Mutating glyf/gvar tables
Mutating GDEF/GPOS/GSUB tables
Building interpolated tables
Removing variable tables
Saving instance font MarkaziText-VF-instance.ttf
ERROR: Glyph 'uni0615' has negative advance width
ERROR: Glyph 'uniFBB4' has negative advance width
ERROR: Glyph 'uni0655' has negative advance width
Traceback (most recent call last):
  File "./fonttools", line 12, in <module>
    sys.exit(main())
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/__main__.py", line 29, in main
    runpy.run_module(mod, run_name='__main__')
  File "/usr/lib/python2.7/runpy.py", line 180, in run_module
    fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/varLib/mutator.py", line 156, in <module>
    sys.exit(main())
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/varLib/mutator.py", line 150, in main
    varfont.save(outfile)
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/ttLib/ttFont.py", line 166, in save
    writer_reordersTables = self._save(tmp)
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/ttLib/ttFont.py", line 205, in _save
    self._writeTable(tag, writer, done, tableCache)
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/ttLib/ttFont.py", line 615, in _writeTable
    self._writeTable(masterTable, writer, done, tableCache)
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/ttLib/ttFont.py", line 619, in _writeTable
    tabledata = self.getTableData(tag)
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/ttLib/ttFont.py", line 637, in getTableData
    return self.tables[tag].compile(self)
  File "/usr/local/google/home/nyshadhr/src/fonttools/Lib/fontTools/ttLib/tables/_h_m_t_x.py", line 96, in compile
    % (self.tableTag, self.advanceName))
fontTools.ttLib.TTLibError: 'hmtx' table can't contain negative advance widths

More info in the following fonttools pr https://github.com/fonttools/fonttools/pull/1198

cc @nyshadhr9

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
felipesanchescommented, Mar 20, 2018

That’s what people call regression testing. To make sure it never creeps up back again unnoticed 😉

1reaction
m4rc1ecommented, Mar 20, 2018

Here you go MarkaziVFs.zip

Since GF may use mutator in the future to gen instances, I’d like to dump a load of VF’s through the new fonttools and see any other unforeseen issues come up. We’re a bit too light on tests for VFs atm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

instancer — fontTools Documentation - Read the Docs
The module exports an instantiateVariableFont function and CLI that allow to create full instances (i.e. static fonts) from variable fonts, ...
Read more >
Generating static instances from variable font file - TypeDrawers
Are there any tools out there that can generate a static version based of an existing variable font (an .otf or .ttf)? Something...
Read more >
Re: [googlefonts-discuss] Converting static families to variable fonts ...
Fonttools varLib mutator doesn't mutate some font attributes, ... Our variable fonts are now almost identical to the static fonts we currently serve....
Read more >
fonttools Changelog - pyup.io
represents an instance of a variable font (supports both user-scale and ... [varLib] Added ``build_many`` to build several variable fonts from a single...
Read more >
NEWS.rst - third_party/fonttools - Git at Google - fuchsia Git ...
[varLib] Added ``build_many`` to build several variable fonts from a single. designspace document (#2436). Added ``fontTools.varLib.stat`` module to build ...
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