Repository: fonttools/fonttools

Issue:
Inconsistent unicodes blocks merging of GPOS tables, without a clear error message
I have sources which I am trying to build into a variable font, with a "MONO" axis, going from proportional to monospace.

Half of the sources have kerning that exactly matches (atypical, but relevant for this project), and the other half have kerning that is just there to be able to interpolate (just `A_A = 0`).

If I eliminate kerning for _all_ the sources (well, flatten it to only be `A_A = 0` for all sources), the font builds. If I leave the kerning as it is, I get the following error:

```
AssertionError: ('Lookup', '[0]', 'list', '.Lookup', 'LookupList', '.LookupList', 'GPOS', '.table', 'table_G_P_O_S_')
```

<details><summary><b>Full error traceback</b> (Click to expand)</summary>

```
INFO:fontTools.varLib:Generating HVAR
INFO:fontTools.varLib:Merging OpenType Layout tables
Traceback (most recent call last):
  File "/Users/stephennixon/type-repos/recursive/venv/bin/fontmake", line 8, in <module>
    sys.exit(main())
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/__main__.py", line 424, in main
    project.run_from_designspace(designspace_path, **args)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 878, in run_from_designspace
    **kwargs,
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 944, in _run_from_designspace_interpolatable
    designspace, output_path=output_path, output_dir=output_dir, **kwargs
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 299, in build_variable_font
    inplace=True,
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/ufo2ft/__init__.py", line 548, in compileVariableTTF
    ttfDesignSpace, exclude=excludeVariationTables, optimize=optimizeGvar
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/__init__.py", line 862, in build
    _merge_OTL(vf, model, master_fonts, axisTags)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/__init__.py", line 589, in _merge_OTL
    merger.mergeTables(font, master_fonts, ['GSUB', 'GDEF', 'GPOS'])
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 109, in mergeTables
    for m in master_ttfs])
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 95, in mergeThings
    self.mergeObjects(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 74, in mergeObjects
    mergerFunc(self, value, values)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 95, in mergeThings
    self.mergeObjects(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 74, in mergeObjects
    mergerFunc(self, value, values)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 95, in mergeThings
    self.mergeObjects(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 74, in mergeObjects
    mergerFunc(self, value, values)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 97, in mergeThings
    self.mergeLists(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 83, in mergeLists
    self.mergeThings(value, values)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 93, in mergeThings
    mergerFunc(self, out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 778, in merge
    subtables = merger.lookup_subtables = [_Lookup_PairPos_subtables_canonicalize(st, merger.font) for st in subtables]
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 778, in <listcomp>
    subtables = merger.lookup_subtables = [_Lookup_PairPos_subtables_canonicalize(st, merger.font) for st in subtables]
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 721, in _Lookup_PairPos_subtables_canonicalize
    lst[:i] = [_Lookup_PairPosFormat1_subtables_flatten(lst[:i], font)]
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 674, in _Lookup_PairPosFormat1_subtables_flatten
    [v.PairSet for v in lst])
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 168, in _merge_GlyphOrders
    assert all(sorted(vs, key=sortKey) == vs for vs in lst)
AssertionError: ('Lookup', '[0]', 'list', '.Lookup', 'LookupList', '.LookupList', 'GPOS', '.table', 'table_G_P_O_S_')
```

</details>

<details><summary><b>Full terminal response</b> (Click to expand)</summary>

```
▶ src/build-scripts/build.sh src/masters/recursive-varfontprep-2019_11_03-22_11_44/recursive-MONO_CASL_wght_slnt_ital.designspace
INFO:fontmake.font_project:Building variable font font_betas/recursive-MONO_CASL_wght_slnt_ital--2019_11_04-12_00.ttf
INFO:ufo2ft:Pre-processing glyphs
INFO:cu2qu.ufo:New spline lengths: 1: 28, 2: 2437, 3: 1697, 4: 886, 5: 246, 6: 101, 7: 20
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoCasualASlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoCasualA
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoCasualBSlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoCasualB
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoCasualCSlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoCasualC
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoLinearASlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoLinearA
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoLinearBSlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoLinearB
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoLinearCSlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-MonoLinearC
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansCasualASlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansCasualA
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansCasualBSlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansCasualB
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansCasualCSlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansCasualC
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansLinearASlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansLinearA
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansLinearBSlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansLinearB
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansLinearCSlanted
INFO:ufo2ft.filters:Running DecomposeComponentsFilter on Recursive-SansLinearC
INFO:ufo2ft:Building OpenType tables for Recursive-MonoCasualASlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoCasualA
INFO:ufo2ft:Building OpenType tables for Recursive-MonoCasualBSlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoCasualB
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoCasualCSlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoCasualC
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoLinearASlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoLinearA
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoLinearBSlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoLinearB
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoLinearCSlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-MonoLinearC
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansCasualASlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansCasualA
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansCasualBSlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansCasualB
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansCasualCSlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansCasualC
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansLinearASlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansLinearA
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansLinearBSlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansLinearB
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansLinearCSlanted
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building OpenType tables for Recursive-SansLinearC
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
WARNING:ufo2ft.fontInfoData:Underline position not set in UFO, defaulting to UPM * -0.075
WARNING:ufo2ft.fontInfoData:Underline thickness not set in UFO, defaulting to UPM * 0.05
INFO:ufo2ft:Building variable TTF font
INFO:fontTools.varLib:Axes:
[{'default': 0.0,
  'hidden': False,
  'labelNames': {'en': 'Monospace'},
  'map': [],
  'maximum': 1.0,
  'minimum': 0.0,
  'name': 'Monospace',
  'tag': 'MONO'},
 {'default': 0.0,
  'hidden': False,
  'labelNames': {'en': 'Casual'},
  'map': [],
  'maximum': 1.0,
  'minimum': 0.0,
  'name': 'Casual',
  'tag': 'CASL'},
 {'default': 300.0,
  'hidden': False,
  'labelNames': {'en': 'Weight'},
  'map': [(300.0, 40.0),
          (400.0, 84.0),
          (500.0, 99.5),
          (600.0, 115.0),
          (700.0, 130.5),
          (800.0, 146.0),
          (900.0, 192.0),
          (1000.0, 215.0)],
  'maximum': 1000.0,
  'minimum': 300.0,
  'name': 'Weight',
  'tag': 'wght'},
 {'default': 0.0,
  'hidden': False,
  'labelNames': {'en': 'Slant'},
  'map': [],
  'maximum': 0.0,
  'minimum': -15.0,
  'name': 'Slant',
  'tag': 'slnt'},
 {'default': 0.5,
  'hidden': False,
  'labelNames': {'en': 'Italic'},
  'map': [],
  'maximum': 1.0,
  'minimum': 0.0,
  'name': 'Italic',
  'tag': 'ital'}]
INFO:fontTools.varLib:Internal master locations:
[{'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': -15.0,
  'Weight': 40.0},
 {'Casual': 1.0, 'Italic': 0.5, 'Monospace': 1.0, 'Slant': 0.0, 'Weight': 40.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': -15.0,
  'Weight': 146.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': 0.0,
  'Weight': 146.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': -15.0,
  'Weight': 215.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': 0.0,
  'Weight': 215.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': -15.0,
  'Weight': 40.0},
 {'Casual': 0.0, 'Italic': 0.5, 'Monospace': 1.0, 'Slant': 0.0, 'Weight': 40.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': -15.0,
  'Weight': 146.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': 0.0,
  'Weight': 146.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': -15.0,
  'Weight': 215.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 1.0,
  'Slant': 0.0,
  'Weight': 215.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': -15.0,
  'Weight': 40.0},
 {'Casual': 1.0, 'Italic': 0.5, 'Monospace': 0.0, 'Slant': 0.0, 'Weight': 40.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': -15.0,
  'Weight': 146.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': 0.0,
  'Weight': 146.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': -15.0,
  'Weight': 215.0},
 {'Casual': 1.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': 0.0,
  'Weight': 215.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': -15.0,
  'Weight': 40.0},
 {'Casual': 0.0, 'Italic': 0.5, 'Monospace': 0.0, 'Slant': 0.0, 'Weight': 40.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': -15.0,
  'Weight': 146.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': 0.0,
  'Weight': 146.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': -15.0,
  'Weight': 215.0},
 {'Casual': 0.0,
  'Italic': 0.5,
  'Monospace': 0.0,
  'Slant': 0.0,
  'Weight': 215.0}]
INFO:fontTools.varLib:Internal axis supports:
{'Casual': [0.0, 0.0, 1.0],
 'Italic': [0.0, 0.5, 1.0],
 'Monospace': [0.0, 0.0, 1.0],
 'Slant': [-15.0, 0.0, 0.0],
 'Weight': [40.0, 40.0, 215.0]}
INFO:fontTools.varLib:Normalized master locations:
[{'Casual': 1.0, 'Italic': 0.0, 'Monospace': 1.0, 'Slant': -1.0, 'Weight': 0.0},
 {'Casual': 1.0, 'Italic': 0.0, 'Monospace': 1.0, 'Slant': 0.0, 'Weight': 0.0},
 {'Casual': 1.0,
  'Italic': 0.0,
  'Monospace': 1.0,
  'Slant': -1.0,
  'Weight': 0.6057142857142858},
 {'Casual': 1.0,
  'Italic': 0.0,
  'Monospace': 1.0,
  'Slant': 0.0,
  'Weight': 0.6057142857142858},
 {'Casual': 1.0, 'Italic': 0.0, 'Monospace': 1.0, 'Slant': -1.0, 'Weight': 1.0},
 {'Casual': 1.0, 'Italic': 0.0, 'Monospace': 1.0, 'Slant': 0.0, 'Weight': 1.0},
 {'Casual': 0.0, 'Italic': 0.0, 'Monospace': 1.0, 'Slant': -1.0, 'Weight': 0.0},
 {'Casual': 0.0, 'Italic': 0.0, 'Monospace': 1.0, 'Slant': 0.0, 'Weight': 0.0},
 {'Casual': 0.0,
  'Italic': 0.0,
  'Monospace': 1.0,
  'Slant': -1.0,
  'Weight': 0.6057142857142858},
 {'Casual': 0.0,
  'Italic': 0.0,
  'Monospace': 1.0,
  'Slant': 0.0,
  'Weight': 0.6057142857142858},
 {'Casual': 0.0, 'Italic': 0.0, 'Monospace': 1.0, 'Slant': -1.0, 'Weight': 1.0},
 {'Casual': 0.0, 'Italic': 0.0, 'Monospace': 1.0, 'Slant': 0.0, 'Weight': 1.0},
 {'Casual': 1.0, 'Italic': 0.0, 'Monospace': 0.0, 'Slant': -1.0, 'Weight': 0.0},
 {'Casual': 1.0, 'Italic': 0.0, 'Monospace': 0.0, 'Slant': 0.0, 'Weight': 0.0},
 {'Casual': 1.0,
  'Italic': 0.0,
  'Monospace': 0.0,
  'Slant': -1.0,
  'Weight': 0.6057142857142858},
 {'Casual': 1.0,
  'Italic': 0.0,
  'Monospace': 0.0,
  'Slant': 0.0,
  'Weight': 0.6057142857142858},
 {'Casual': 1.0, 'Italic': 0.0, 'Monospace': 0.0, 'Slant': -1.0, 'Weight': 1.0},
 {'Casual': 1.0, 'Italic': 0.0, 'Monospace': 0.0, 'Slant': 0.0, 'Weight': 1.0},
 {'Casual': 0.0, 'Italic': 0.0, 'Monospace': 0.0, 'Slant': -1.0, 'Weight': 0.0},
 {'Casual': 0.0, 'Italic': 0.0, 'Monospace': 0.0, 'Slant': 0.0, 'Weight': 0.0},
 {'Casual': 0.0,
  'Italic': 0.0,
  'Monospace': 0.0,
  'Slant': -1.0,
  'Weight': 0.6057142857142858},
 {'Casual': 0.0,
  'Italic': 0.0,
  'Monospace': 0.0,
  'Slant': 0.0,
  'Weight': 0.6057142857142858},
 {'Casual': 0.0, 'Italic': 0.0, 'Monospace': 0.0, 'Slant': -1.0, 'Weight': 1.0},
 {'Casual': 0.0, 'Italic': 0.0, 'Monospace': 0.0, 'Slant': 0.0, 'Weight': 1.0}]
INFO:fontTools.varLib:Index of base master: 19
INFO:fontTools.varLib:Building variable font
INFO:fontTools.varLib:Loading master fonts
INFO:fontTools.varLib:Generating fvar
INFO:fontTools.varLib:Generating avar
INFO:fontTools.varLib:Building variations tables
INFO:fontTools.varLib:Generating MVAR
INFO:fontTools.varLib:  xhgt: OS/2.sxHeight     [526, 526, 540, 540, 550, 550, 526, 526, 540, 540, 550, 550, 526, 526, 540, 540, 550, 550, 526, 526, 540, 540, 550, 550]
INFO:fontTools.varLib:  stro: OS/2.yStrikeoutPosition   [316, 316, 324, 324, 330, 330, 316, 316, 324, 324, 330, 330, 316, 316, 324, 324, 330, 330, 316, 316, 324, 324, 330, 330]
INFO:fontTools.varLib:  sbxo: OS/2.ySubscriptXOffset    [-19, 0, -19, 0, -19, 0, -19, 0, -19, 0, -19, 0, -19, 0, -19, 0, -19, 0, -19, 0, -19, 0, -19, 0]
INFO:fontTools.varLib:  spxo: OS/2.ySuperscriptXOffset  [88, 0, 88, 0, 88, 0, 88, 0, 88, 0, 88, 0, 88, 0, 88, 0, 88, 0, 88, 0, 88, 0, 88, 0]
INFO:fontTools.varLib:  hcrs: hhea.caretSlopeRise       [1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1, 1000, 1]
INFO:fontTools.varLib:  hcrn: hhea.caretSlopeRun        [250, 0, 250, 0, 250, 0, 250, 0, 250, 0, 250, 0, 250, 0, 250, 0, 250, 0, 250, 0, 250, 0, 250, 0]
INFO:fontTools.varLib:  undo: post.underlinePosition    [-75, -200, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, -75]
INFO:fontTools.varLib:Generating HVAR
INFO:fontTools.varLib:Merging OpenType Layout tables
Traceback (most recent call last):
  File "/Users/stephennixon/type-repos/recursive/venv/bin/fontmake", line 8, in <module>
    sys.exit(main())
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/__main__.py", line 424, in main
    project.run_from_designspace(designspace_path, **args)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 878, in run_from_designspace
    **kwargs,
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 944, in _run_from_designspace_interpolatable
    designspace, output_path=output_path, output_dir=output_dir, **kwargs
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontmake/font_project.py", line 299, in build_variable_font
    inplace=True,
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/ufo2ft/__init__.py", line 548, in compileVariableTTF
    ttfDesignSpace, exclude=excludeVariationTables, optimize=optimizeGvar
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/__init__.py", line 862, in build
    _merge_OTL(vf, model, master_fonts, axisTags)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/__init__.py", line 589, in _merge_OTL
    merger.mergeTables(font, master_fonts, ['GSUB', 'GDEF', 'GPOS'])
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 109, in mergeTables
    for m in master_ttfs])
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 95, in mergeThings
    self.mergeObjects(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 74, in mergeObjects
    mergerFunc(self, value, values)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 95, in mergeThings
    self.mergeObjects(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 74, in mergeObjects
    mergerFunc(self, value, values)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 95, in mergeThings
    self.mergeObjects(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 74, in mergeObjects
    mergerFunc(self, value, values)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 97, in mergeThings
    self.mergeLists(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 83, in mergeLists
    self.mergeThings(value, values)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 999, in mergeThings
    super(VariationMerger, self).mergeThings(out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 93, in mergeThings
    mergerFunc(self, out, lst)
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 778, in merge
    subtables = merger.lookup_subtables = [_Lookup_PairPos_subtables_canonicalize(st, merger.font) for st in subtables]
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 778, in <listcomp>
    subtables = merger.lookup_subtables = [_Lookup_PairPos_subtables_canonicalize(st, merger.font) for st in subtables]
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 721, in _Lookup_PairPos_subtables_canonicalize
    lst[:i] = [_Lookup_PairPosFormat1_subtables_flatten(lst[:i], font)]
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 674, in _Lookup_PairPosFormat1_subtables_flatten
    [v.PairSet for v in lst])
  File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontTools/varLib/merger.py", line 168, in _merge_GlyphOrders
    assert all(sorted(vs, key=sortKey) == vs for vs in lst)
AssertionError: ('Lookup', '[0]', 'list', '.Lookup', 'LookupList', '.LookupList', 'GPOS', '.table', 'table_G_P_O_S_')
```


</details>

I've tried quite a few things to get past this issue, but I'm having no success, so far.

https://github.com/arrowtype/recursive/issues/213


Discussion:
Sorry, I sent that first issue slightly before I meant to. 

## Reproducing the issue

Permalinks to sources in question:
- Here are the sources with kerning as desired (these are almost entirely compatible, but do not build): https://github.com/arrowtype/recursive/tree/242a9e7988ff00a7947964cf7e234e8233f70a32/src/masters/recursive-varfontprep-2019_11_04-16_42_04--kerned
- Here are the same sources with flattened kerning (these do build successfully): https://github.com/arrowtype/recursive/tree/242a9e7988ff00a7947964cf7e234e8233f70a32/src/masters/recursive-varfontprep-2019_11_04-16_42_04--flat_kerning

Zips, for convenience:
- [recursive-varfontprep-2019_11_04-16_42_04--kerned.zip](https://github.com/fonttools/fonttools/files/3806388/recursive-varfontprep-2019_11_04-16_42_04--kerned.zip)
- [recursive-varfontprep-2019_11_04-16_42_04--flat_kerning.zip](https://github.com/fonttools/fonttools/files/3806389/recursive-varfontprep-2019_11_04-16_42_04--flat_kerning.zip)



The variable fonts can be built (or almost built) like this:

```
fontmake -m <path>.designspace -o variable
```
This was blocked by mismatching unicodes for the glyph /nhookleft.

I'm not 100% sure why this seemed to surface as an issue in GPOS merging – in the past, I think maybe this same design issue has arisen with other error messages. 

In case it might be feasible to make the error messaging more clear on this issue, I'll leave this issue open. However, FontTools maintainers are welcome to close it if they don't see further action to take, here.
The assert that was failing checks whether all masters have the correct glyph order. A mismatching unicode could cause a different glyph order, depending on how the glyph order is made.

I'll have a look to see how the error message can be improved.

Resolving patch:
diff --git a/Lib/fontTools/varLib/merger.py b/Lib/fontTools/varLib/merger.py
--- a/Lib/fontTools/varLib/merger.py
+++ b/Lib/fontTools/varLib/merger.py
@@ -165,7 +165,7 @@ def _merge_GlyphOrders(font, lst, values_lst=None, default=None):
 	sortKey = font.getReverseGlyphMap().__getitem__
 	order = sorted(combined, key=sortKey)
 	# Make sure all input glyphsets were in proper order
-	assert all(sorted(vs, key=sortKey) == vs for vs in lst)
+	assert all(sorted(vs, key=sortKey) == vs for vs in lst), "glyph orders are not consistent across masters"
 	del combined
 
 	paddedValues = None


Test patch: