robotools / extractor

Tools for extracting data from font binaries into UFO objects.
MIT License
51 stars 15 forks source link

Move fontfeature import statement #61

Closed NightFurySL2001 closed 9 months ago

NightFurySL2001 commented 1 year ago

Fix #56 ?

typemytype commented 1 year ago

this is not a conditional import, test if the package is available and decide

but the import issues with fontFeatures has been resolved upstream (no need for numpy anymore)

typemytype commented 9 months ago

should be something like:

try:
    from fontFeatures.ttLib import unparse
    _haveFontFeatures = True
except ImportError:
    _haveFontFeatures = False

def extractOpenTypeFeatures(source):
    if _haveFontFeatures:
        return unparse(source).asFea()
    return ""
benkiel commented 9 months ago

@typemytype if my change to your sample looks good to you, I'll merge and push an update

typemytype commented 9 months ago

thanks Ben!!