Skip to content

Commit

Permalink
py3 only
Browse files Browse the repository at this point in the history
  • Loading branch information
typemytype committed Sep 2, 2019
1 parent e5259d9 commit 37a5a3a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Lib/ufo2fdk/featureTableWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ def winStr(text):
"""
Convert string to FDK encoding for Windows.
"""
return str("".join([winCharEncode(c) for c in unicode(text)]))
return str("".join([winCharEncode(c) for c in str(text)]))


def macStr(text):
"""
Convert string to FDK encoding for Mac.
"""
return str("".join([macCharEncode(c) for c in unicode(text)]))
return str("".join([macCharEncode(c) for c in str(text)]))
17 changes: 4 additions & 13 deletions Lib/ufo2fdk/fontInfoData.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,7 @@
from fontTools.misc.textTools import binary2num
from fontTools.misc.arrayTools import unionRect
from fontTools.cffLib.width import optimizeWidths
import ufoLib
try:
set
except NameError:
from sets import Set as set

try:
long
except NameError:
long = int
from fontTools import ufoLib


def _ignoreASCII(s):
Expand Down Expand Up @@ -206,7 +197,7 @@ def openTypeOS2WinDescentFallback(info):


def normalizeStringForPostscript(s, allowSpaces=True):
s = unicode(s)
s = str(s)
normalized = []
for c in s:
if c == " " and not allowSpaces:
Expand Down Expand Up @@ -616,9 +607,9 @@ def intListToNum(intList, start, length):
def dateStringToTimeValue(date):
try:
t = time.strptime(date, "%Y/%m/%d %H:%M:%S")
return long(calendar.timegm(t))
return int(calendar.timegm(t))
except ValueError:
return long(0)
return 0


# ----
Expand Down
4 changes: 1 addition & 3 deletions Lib/ufo2fdk/makeotfParts.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def setupFile_menuName(self, path):
lines.append(line)
text = "\n".join(lines) + "\n"
f = open(path, "wb")
f.write(toBytestoBytes(text))
f.write(toBytes(text))
f.close()

def setupFile_glyphOrder(self, path):
Expand Down Expand Up @@ -588,8 +588,6 @@ def normalizeGlyphName(glyphName, uniValue, existing):
>>> normalizeGlyphName("abcdefghijklmnopqrstuvwxyz0123456", None, ["glyph1"])
'glyph2'
"""
# convert to unicode
glyphName = unicode(glyphName)
# remove illegal characters
glyphName = unicodedata.normalize("NFKD", glyphName)
glyphName = "".join([c for c in glyphName if c in _validCharacters])
Expand Down

0 comments on commit 37a5a3a

Please sign in to comment.