adobe-type-tools / afdko

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

makeInstancesUFO fails to generate Source Sans Pro instances #80

Closed khaledhosny closed 9 years ago

khaledhosny commented 9 years ago

When I run:

makeInstancesUFO -d ItalicMasters/SourceSansPro-Italic.designspace

I get the following error:

Reading design space file: SourceSansPro-Italic.designspace ...
adding SourceSansPro-ExtraLightIt to build list.
adding SourceSansPro-LightIt to build list.
adding SourceSansPro-It to build list.
adding SourceSansPro-SemiboldIt to build list.
adding SourceSansPro-BoldIt to build list.
adding SourceSansPro-BlackIt to build list.
Building 6 instances...
Built 6 instances.
Applying UFO normalization...
Applying post-processing...
    doing overlap removal with checkOutlinesUFO ../Italic/ExtraLightIt/font.ufo ...
Traceback (most recent call last):
  File "/afdko/FDK/Tools/linux/../SharedData/FDKScripts/CheckOutlinesUFO.py", line 967, in <module>
    run(sys.argv[1:])
  File "/afdko/FDK/Tools/linux/../SharedData/FDKScripts/CheckOutlinesUFO.py", line 908, in run
    newGlyph, glyphDigest, changed, msg = test(newGlyph, glyphDigest, changed, msg, options)
  File "/afdko/FDK/Tools/linux/../SharedData/FDKScripts/CheckOutlinesUFO.py", line 711, in doOverlapRemoval
    changed, msg = removeTinySubPaths(newGlyph, options.minArea, changed, msg) # Tiny subpaths are added by overlap removal.
  File "/afdko/FDK/Tools/linux/../SharedData/FDKScripts/CheckOutlinesUFO.py", line 485, in removeTinySubPaths
    cArea = (cBounds[2] - cBounds[0])*(cBounds[3] - cBounds[1])
TypeError: 'NoneType' object has no attribute '__getitem__'

Error in checkOutlinesUFO ../Italic/ExtraLightIt/font.ufo
Quitting after error.
miguelsousa commented 9 years ago

Can't reproduce it on OS X. My partial output is below. Not sure how to proceed. Would it help to find out which glyph is triggering this?

source-sans-pro$ makeInstancesUFO -d ItalicMasters/SourceSansPro-Italic.designspace 
Reading design space file: SourceSansPro-Italic.designspace ...
adding SourceSansPro-ExtraLightIt to build list.
adding SourceSansPro-LightIt to build list.
adding SourceSansPro-It to build list.
adding SourceSansPro-SemiboldIt to build list.
adding SourceSansPro-BoldIt to build list.
adding SourceSansPro-BlackIt to build list.
Building 6 instances...
Built 6 instances.
Applying UFO normalization...
Applying post-processing...
    doing overlap removal with checkOutlinesUFO ../Italic/ExtraLightIt/font.ufo ...
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    autohinting ../Italic/ExtraLightIt/font.ufo ...
Hinting font ../Italic/ExtraLightIt/font.ufo. Start time: Mon Nov  2 22:34:49 2015.
.........................................
.........................................
.........................................
.........................................
khaledhosny commented 9 years ago

Inserting print aGlyph before the offending line, I get <BooleanGlyph .notdef>.

miguelsousa commented 9 years ago

Seems like it chokes right on the first glyph. I just pushed an update to checkOutlinesUFO.py to try helping diagnose the issue. Please sync and then run checkoutlinesufo -test

khaledhosny commented 9 years ago

I get two failures:

**********************************************************************
File "/afdko/FDK/Tools/linux/../SharedData/FDKScripts/CheckOutlinesUFO.py", line 496, in __main__.removeTinySubPaths
Failed example:
    removeTinySubPaths(bg, 25, 0, []) == (0, [])
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__.removeTinySubPaths[11]>", line 1, in <module>
        removeTinySubPaths(bg, 25, 0, []) == (0, [])
      File "/afdko/FDK/Tools/linux/../SharedData/FDKScripts/CheckOutlinesUFO.py", line 521, in removeTinySubPaths
        cArea = (cBounds[2] - cBounds[0])*(cBounds[3] - cBounds[1])
    TypeError: 'NoneType' object has no attribute '__getitem__'
**********************************************************************
File "/afdko/FDK/Tools/linux/../SharedData/FDKScripts/CheckOutlinesUFO.py", line 509, in __main__.removeTinySubPaths
Failed example:
    removeTinySubPaths(bg, 25, 0, []) == (0, ['Contour 0 is too small: bounding box is less than minimum area. Start point: ((1, 1)).'])
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest __main__.removeTinySubPaths[21]>", line 1, in <module>
        removeTinySubPaths(bg, 25, 0, []) == (0, ['Contour 0 is too small: bounding box is less than minimum area. Start point: ((1, 1)).'])
      File "/afdko/FDK/Tools/linux/../SharedData/FDKScripts/CheckOutlinesUFO.py", line 521, in removeTinySubPaths
        cArea = (cBounds[2] - cBounds[0])*(cBounds[3] - cBounds[1])
    TypeError: 'NoneType' object has no attribute '__getitem__'
**********************************************************************
1 items had failures:
   2 of  22 in __main__.removeTinySubPaths
***Test Failed*** 2 failures.
khaledhosny commented 9 years ago

Would it be related to the version of booleanOperations used?

anthrotype commented 9 years ago

maybe..

See these lines from booleanOperations master HEAD: https://github.com/typemytype/booleanOperations/blob/master/Lib/booleanOperations/booleanGlyph.py#L76-L82

def _get_bounds(self):
        if self._bounds is None:
            from robofab.pens.boundsPen import BoundsPen
            pen = BoundsPen(None)
            self.draw(pen)
            self._boundsCache = pen.bounds
        return self._bounds

    bounds = property(_get_bounds)

that self._boundsCache is not used anywhere else. I guess the author's intention was to set self._bounds instead. You should probably open an issue on booleanOperations repo.

miguelsousa commented 9 years ago

Possibly. But my understanding was that the embedded Python that the FDK has also includes the additional modules required. @readroberts would know what the setup is.

khaledhosny commented 9 years ago

Thanks @anthrotype, that was the issue. I should have been clear that I’m running AFDKO master branch and installing all required modules manually.

readroberts commented 9 years ago

There is a bug in the current head branch of boolenOperations in the use of self._boundsCache/self._bounds. I fixed this and a number of other problems in the branch in the AFDKO, and sent a patch file of the differences to Frederik Berlaen on Sep 9, 2015.

anthrotype commented 9 years ago

@readroberts do you mind also sending a pull request to https://github.com/typemytype/booleanOperations? thanks!

miguelsousa commented 9 years ago

@anthrotype I've just submitted https://github.com/typemytype/booleanOperations/pull/11

anthrotype commented 9 years ago

Thanks :+1: