Skip to content

Commit b330ddf

Browse files
authored
Merge pull request #61 from NightFurySL2001/patch-1
Move fontfeature import statement
2 parents 7396076 + 810278b commit b330ddf

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Lib/extractor/formats/opentype.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from extractor.exceptions import ExtractorError
1212
from extractor.stream import InstructionStream
1313
from extractor.tools import RelaxedInfo, copyAttr
14-
from fontFeatures.ttLib import unparse
1514

1615

1716
TRUETYPE_INSTRUCTIONS_KEY = "public.truetype.instructions"
@@ -1067,6 +1066,12 @@ def _extractOpenTypeKerningFromKern(source):
10671066

10681067

10691068
def extractOpenTypeFeatures(source):
1070-
return unparse(source).asFea()
1071-
1072-
1069+
try:
1070+
from fontFeatures.ttLib import unparse
1071+
_haveFontFeatures = True
1072+
except ImportError:
1073+
_haveFontFeatures = False
1074+
1075+
if _haveFontFeatures:
1076+
return unparse(source).asFea()
1077+
return ""

0 commit comments

Comments
 (0)