fontbuild: remove use of fontmake, simplifying things.

This commit is contained in:
Rasmus Andersson 2019-10-22 17:00:58 -07:00
parent 9c444deded
commit aa7ad2d7a0
9 changed files with 612 additions and 389 deletions

29
misc/fontbuildlib/util.py Normal file
View file

@ -0,0 +1,29 @@
import sys
import os
import errno
from fontTools.ttLib import TTFont
from os.path import dirname, abspath, join as pjoin
PYVER = sys.version_info[0]
BASEDIR = abspath(pjoin(dirname(__file__), os.pardir, os.pardir))
_enc_kwargs = {}
if PYVER >= 3:
_enc_kwargs = {'encoding': 'utf-8'}
def readTextFile(filename):
with open(filename, 'r', **_enc_kwargs) as f:
return f.read()
def mkdirs(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise # raises the error again
def loadTTFont(file):
return TTFont(file, recalcBBoxes=False, recalcTimestamp=False)