Merge f29c9dd52a
into 996150820b
commit
3795b09ccc
|
@ -7,7 +7,22 @@ from __future__ import unicode_literals
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import sys
|
||||||
|
|
||||||
|
PY3 = sys.version_info[0] == 3
|
||||||
|
if PY3:
|
||||||
|
binary_type = bytes
|
||||||
|
text_type = str
|
||||||
|
else:
|
||||||
|
binary_type = str
|
||||||
|
text_type = unicode
|
||||||
|
|
||||||
|
def ensure_binary(s, encoding='utf-8', errors='strict'):
|
||||||
|
if isinstance(s, binary_type):
|
||||||
|
return s
|
||||||
|
if isinstance(s, text_type):
|
||||||
|
return s.encode(encoding, errors)
|
||||||
|
raise TypeError("not expecting type '%s'" % type(s))
|
||||||
|
|
||||||
def update_features(font):
|
def update_features(font):
|
||||||
"""Find ligatures in the font and generate features for them."""
|
"""Find ligatures in the font and generate features for them."""
|
||||||
|
@ -29,6 +44,7 @@ def update_features(font):
|
||||||
{}
|
{}
|
||||||
}} calt;
|
}} calt;
|
||||||
''').format(indent(rules, ' '))
|
''').format(indent(rules, ' '))
|
||||||
|
fea_code = ensure_binary(fea_code)
|
||||||
|
|
||||||
# print(fea_code) # DEBUG
|
# print(fea_code) # DEBUG
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,11 @@ import os
|
||||||
from os.path import basename, splitext, join
|
from os.path import basename, splitext, join
|
||||||
import subprocess
|
import subprocess
|
||||||
from features import update_features
|
from features import update_features
|
||||||
|
import sys
|
||||||
|
|
||||||
|
PY3 = sys.version_info[0] == 3
|
||||||
|
if PY3:
|
||||||
|
xrange = range
|
||||||
|
|
||||||
SCRIPTS = os.path.dirname(os.path.realpath(__file__))
|
SCRIPTS = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue