adobe-type-tools / afdko

Adobe Font Development Kit for OpenType
https://adobe-type-tools.github.io/afdko/
Other
1.04k stars 168 forks source link

[makeinstancesufo] "index must represent an on curve point" error and no warning/error when interpolation fails #1345

Open tamcy opened 3 years ago

tamcy commented 3 years ago

Essentially there are two issues in the title, so it might be better to open separate issues for each of them. Pardon my laziness.

You can download this test setup, unzip it, and run makeinstancesufo against testfont.designspace to reproduce the issues.

Issue 1

For glyph01, there is a warning and an error (unless the command is run with -r):

INFO:afdko.makeinstancesufo:Applying post-processing...
Checking outlines for glyph01:   0%|                                                                                                                                                                    | 0/2 [00:00<?, ?it/s]Warning: duplicated start point on contour 0 at 376, 499 of glyph glyph01.
Checking outlines for glyph01:  50%|██████████████████████████████████████████████████████████████████████████████                                                                              | 1/2 [00:00<00:00, 62.87it/s]
ERROR:afdko.makeinstancesufo:index must represent an on curve point

Seems the outline triggered an assertion fail in the script, but the result looks fine.

Issue 2

For glyph02, note that there is an extra point in the second master (Z.ufo), so the glyph is not interpolatable. But the command still finishes successfully, no error or warning is seen. Just that the glyph is missing from the generated instance.

frankrolf commented 3 years ago

Issue 1 might be related to #790. There was a recent fix to this problem, I much prefer the error message to a crashing makeinstancesufo ;-)

Issue 2: I would argue that this is expected. makeinstancesufo is not an analysis tool, and expects proper input data (just like makeotf also expects a certain kind of input data). Checking outline compatibility on the fly would create quite a lot of overhead – there are better tools to deal with that beforehand.

tamcy commented 3 years ago

@frankrolf Thank you for the reply. For the first issue, I agree that it's better than a crash. Actually I don't really care about it because it doesn't affect the generated output. Just reporting here so see if this is something to be handled.

For the second issue, while I dont expect makeinstancesufo to tell me exactly what's wrong with the glyph, I would hope it to at least tell me that the glyph is discarded because of an error, at least in verbose mode. This was what the command did in previous version(s).

For instance, here is the output of the command in 2.0.0:

(afdko_env) C:\>makeinstancesufo --version
2.0.0

(afdko_env) C:\>makeinstancesufo -d testfont.designspace -vv
INFO:afdko.makeinstancesufo:Reading design space file 'testfont.designspace' ...
INFO:afdko.makeinstancesufo:Adding TestFont Medium to build list.
INFO:afdko.makeinstancesufo:Building 1 instance...
INFO:mutatorMath:Reading testfont.designspace.temp
INFO:mutatorMath:       Generating instance font.ufo
INFO:mutatorMath:./Instances/M/font.ufo:
Errors calculating 1 glyphs:
        glyph02
INFO:afdko.makeinstancesufo:Built 1 instances.
INFO:afdko.makeinstancesufo:Applying UFO normalization...
DEBUG:ufonormalizer:Normalizing "glyphs\contents.plist".
DEBUG:ufonormalizer:Normalizing "glyphs\_notdef.glif".
DEBUG:ufonormalizer:Normalizing "glyphs\glyph02.glif".
DEBUG:ufonormalizer:Normalizing "metainfo.plist".
DEBUG:ufonormalizer:Normalizing "fontinfo.plist".
DEBUG:ufonormalizer:Normalizing "lib.plist".
INFO:afdko.makeinstancesufo:Applying post-processing...
INFO:afdko.makeinstancesufo:Doing overlap removal with checkoutlinesufo on ./Instances/M/font.ufo ...
C:\\Instances\M\font.ufo
INFO:afdko.makeinstancesufo:Running autohint on ./Instances/M/font.ufo ...
DEBUG:ufonormalizer:Normalizing "glyphs\contents.plist".
DEBUG:ufonormalizer:Normalizing "glyphs\_notdef.glif".
DEBUG:ufonormalizer:Normalizing "glyphs\glyph02.glif".
DEBUG:ufonormalizer:Normalizing "metainfo.plist".
DEBUG:ufonormalizer:Normalizing "fontinfo.plist".
DEBUG:ufonormalizer:Normalizing "layercontents.plist".
DEBUG:ufonormalizer:Normalizing "lib.plist".

The error message is seen when -v or -vv is specified. And here is the output of v2.4.4:


(afdko_env) C:\>makeinstancesufo --version
2.4.4

(afdko_env) C:\>makeinstancesufo -d testfont.designspace -vv
INFO:afdko.makeinstancesufo:Building 1 instance with MutatorMath...
INFO:afdko.makeinstancesufo:Built 1 instances.
INFO:afdko.makeinstancesufo:Applying UFO normalization...
INFO:afdko.makeinstancesufo:Applying post-processing...
Finished checkoutlinesufo: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 200.07it/s]