googlefonts / googlefonts/fontmake
Variable CFF2 fails due to OTF interpolatable drops duplicate point if starting point is in inner side
- Dominant language
- Python
- Stars
- 888
- Forks
- 97
- Avg merge
- 4d 52m
- Merged PRs (30d)
- 1
Description
Source file with error: [TestDoublePoint.zip](https://github.com/user-attachments/files/20840218/TestDoublePoint.zip)
fontmake 3.10.1, fonttools v4.58.4, ufo2ft 3.5.0
If a starting point is set at this specific corner with another point duplicating in the same location, when building variable-cff2 or otf-interpolatable, the point will be dropped.


`fontmake .\TestDoublePoint.designspace -o variable-cff2` raises:
```
INFO:fontmake.font_project:Loading 2 DesignSpace source UFOs
INFO:fontmake.font_project:Building variable fonts variable_otf\TestDoublePoint-VF.otf
INFO:ufo2ft:Features are compatible across masters; building later
INFO:ufo2ft:Pre-processing glyphs
INFO:ufo2ft.filters:Running interpolatable DecomposeComponentsIFilter
INFO:ufo2ft:Building OpenType tables for TestDoublePoint-Regular
INFO:ufo2ft:Building OpenType tables for Unnamed-Regular
INFO:ufo2ft:Building variable font: TestDoublePoint-VF
INFO:fontTools.varLib:Axes:
[{'axisLabels': [],
'axisOrdering': None,
'default': 1000.0,
'hidden': False,
'labelNames': {'en': 'Weight'},
'map': [(1.0, 1.0), (400.0, 400.0), (1000.0, 1000.0)],
'maximum': 1000.0,
'minimum': 1.0,
'name': 'weight',
'tag': 'wght'}]
INFO:fontTools.varLib:Internal master locations:
[{'weight': 1000.0}, {'weight': 1.0}]
INFO:fontTools.varLib:Internal axis supports:
{'weight': [1.0, 1000.0, 1000.0]}
INFO:fontTools.varLib:Normalized master locations:
[{'weight': 0.0}, {'weight': -1.0}]
INFO:fontTools.varLib:Index of base master: 0
INFO:fontTools.varLib:Building variable font
INFO:fontTools.varLib:Loading master fonts
INFO:fontTools.varLib:Generating fvar
INFO:fontTools.varLib:Building variations tables
INFO:fontTools.varLib:Generating avar
INFO:fontTools.varLib:No need for avar
INFO:fontTools.varLib:Generating MVAR
INFO:fontTools.varLib:Generating HVAR
fontmake: Error: In 'TestDoublePoint.designspace': Generating fonts from Designspace failed: Glyph 'test': 'rlineto' at point index 24 in master index 1 differs from the default font point type 'rmoveto'
```
going through `fontmake .\TestDoublePoint.designspace -o otf-interpolatable` and then run AFDKO `buildcff2vf -d ./master_otf_interpolatable/TestDoublePoint.designspace -c` raise the same error too:
```
Reading source fonts...
Checking outline compatibility in source fonts...
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Python311\Scripts\buildcff2vf.exe\__main__.py", line 7, in
File "C:\Python311\Lib\site-packages\afdko\buildcff2vf.py", line 564, in main
do_compatibility(vf, font_list, ds_data.base_idx)
File "C:\Python311\Lib\site-packages\afdko\buildcff2vf.py", line 332, in do_compatibility
region_charstring.draw(compat_pen)
File "C:\Python311\Lib\site-packages\fontTools\misc\psCharStrings.py", line 1168, in draw
extractor.execute(self)
File "C:\Python311\Lib\site-packages\fontTools\misc\psCharStrings.py", line 636, in execute
super().execute(charString)
File "C:\Python311\Lib\site-packages\fontTools\misc\psCharStrings.py", line 360, in execute
rv = handler(index)
^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\fontTools\misc\psCharStrings.py", line 727, in op_rlineto
self.rLineTo(point)
File "C:\Python311\Lib\site-packages\fontTools\misc\psCharStrings.py", line 654, in rLineTo
self.pen.lineTo(self._nextPoint(point))
File "C:\Python311\Lib\site-packages\fontTools\pens\basePen.py", line 328, in lineTo
self._lineTo(pt)
File "C:\Python311\Lib\site-packages\fontTools\varLib\cff.py", line 538, in _lineTo
self.add_point("rlineto", pt_coords)
File "C:\Python311\Lib\site-packages\afdko\buildcff2vf.py", line 134, in add_point
raise VarLibCFFPointTypeMergeError(
fontTools.varLib.errors.VarLibCFFPointTypeMergeError: Glyph 'test': 'rlineto' at point index 24 in master index 1 differs from the default font point type 'rmoveto'
```
the point is dropped in EL OTF.

Contributor guide
Research direction
Start with TestDoublePoint.zip and TestDoublePoint.designspace, then reproduce both `fontmake ... -o variable-cff2` and `fontmake ... -o otf-interpolatable` followed by AFDKO `buildcff2vf`. Trace how the duplicate starting point is handled in the variable CFF2 and interpolatable paths; done means the point is preserved and both builds pass compatibility checks without the reported point-type error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100