googlefonts / googlefonts/ufo2ft

Anchor errors

Open
#910 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
176
Forks
48
PR merge metrics
No merged PRs in 30d

Description

Getting some weird errors when building UFO with ligatures exported from FontCreator that has only one anchor but a different name than what's exported in features.fea.

[f_f.txt](https://github.com/user-attachments/files/20265651/f_f.txt)

```log
DEBUG own: Glyph name: f_f
DEBUG own: NamedAnchor __init__: aboveLC_ligComponent_0 610 742 None None
ERROR:root:In 'CactusClassicalSerif-Regular.ufo': Compiling UFO failed: ligature component indexes must start from 1
Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\fontmake\font_project.py", line 519, in _iter_compile
yield compile_func(ufo, debugFeatureFile=debugFeatureFile, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\__init__.py", line 117, in compileOTF
return OTFCompiler(**kwargs).compile(ufo)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\_compilers\baseCompiler.py", line 65, in compile
self.compileFeatures(ufo, font, glyphSet=glyphSet)
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\_compilers\baseCompiler.py", line 145, in compileFeatures
otFont = featureCompiler.compile()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\featureCompiler.py", line 148, in compile
self.setupFeatures()
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\featureCompiler.py", line 315, in setupFeatures
writer.write(self.ufo, featureFile, compiler=self)
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\featureWriters\baseFeatureWriter.py", line 150, in write
self.setContext(font, feaFile, compiler=compiler)
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\featureWriters\markFeatureWriter.py", line 349, in setContext
ctx.anchorLists = self._getAnchorLists()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\featureWriters\markFeatureWriter.py", line 388, in _getAnchorLists
a = self.NamedAnchor(name=anchorName, x=x, y=y, libData=libData)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Roaming\Python\Python311\site-packages\ufo2ft\featureWriters\markFeatureWriter.py", line 207, in __init__
raise ValueError("ligature component indexes must start from 1")
ValueError: ligature component indexes must start from 1

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\fontmake\__main__.py", line 746, in main
project.run_from_ufos(
File "C:\Python311\Lib\site-packages\fontmake\font_project.py", line 1374, in run_from_ufos
self.build_otfs(ufos, cff_version=cff_version, inplace=inplace, **kwargs)
File "C:\Python311\Lib\site-packages\fontmake\font_project.py", line 315, in build_otfs
self.save_otfs(ufos, **kwargs)
File "C:\Python311\Lib\site-packages\fontTools\misc\loggingTools.py", line 375, in wrapper
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\fontmake\font_project.py", line 682, in save_otfs
for font, ufo in zip(fonts, ufos):
File "C:\Python311\Lib\site-packages\fontmake\font_project.py", line 521, in _iter_compile
raise FontmakeError("Compiling UFO failed", ufo.path) from e
fontmake.errors.FontmakeError: In 'CactusClassicalSerif-Regular.ufo': Compiling UFO failed: ligature component indexes must start from 1
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the UFO build using the attached f_f.txt and the fontmake traceback. Start in ufo2ft/featureWriters/markFeatureWriter.py, especially NamedAnchor and _getAnchorLists, to trace the anchor name and component index handling. Done means the reported ligature-anchor input no longer fails with the shown ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.