summaryrefslogtreecommitdiff
path: root/misc/pylib/extractor/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'misc/pylib/extractor/__init__.py')
-rwxr-xr-xmisc/pylib/extractor/__init__.py45
1 files changed, 0 insertions, 45 deletions
diff --git a/misc/pylib/extractor/__init__.py b/misc/pylib/extractor/__init__.py
deleted file mode 100755
index 121ae275e..000000000
--- a/misc/pylib/extractor/__init__.py
+++ /dev/null
@@ -1,45 +0,0 @@
-from extractor.exceptions import ExtractorError
-from extractor.formats.opentype import isOpenType, extractFontFromOpenType
-from extractor.formats.woff import isWOFF, extractFontFromWOFF
-from extractor.formats.type1 import isType1, extractFontFromType1
-from extractor.formats.ttx import isTTX, extractFontFromTTX
-
-
-__version__ = "0.2.1.dev0"
-
-_extractFunctions = dict(
- OTF=extractFontFromOpenType,
- Type1=extractFontFromType1,
- WOFF=extractFontFromWOFF,
- ttx=extractFontFromTTX,
-)
-
-def extractFormat(pathOrFile):
- if isType1(pathOrFile):
- return "Type1"
- elif isWOFF(pathOrFile):
- return "WOFF"
- elif isOpenType(pathOrFile):
- return "OTF"
- elif isTTX(pathOrFile):
- return "ttx"
- return None
-
-def extractUFO(pathOrFile, destination, doGlyphs=True, doInfo=True, doKerning=True, format=None, customFunctions={}):
- if format is None:
- format = extractFormat(pathOrFile)
- if format not in _extractFunctions:
- raise ExtractorError("Unknown file format.")
- func = _extractFunctions[format]
- # wrap the extraction in a try: except: so that
- # callers don't need to worry about lower level
- # (fontTools, etc.) errors. if an error
- # occurs, print the traceback for debugging and
- # raise an ExtractorError.
- try:
- func(pathOrFile, destination, doGlyphs=doGlyphs, doInfo=doInfo, doKerning=doKerning, customFunctions=customFunctions.get(format, []))
- except:
- import sys
- import traceback
- traceback.print_exc(file=sys.stdout)
- raise ExtractorError("There was an error reading the %s file." % format)