diff options
author | Rasmus Andersson <rasmus@notion.se> | 2019-01-02 07:47:16 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2019-01-02 07:47:16 +0300 |
commit | 2b53ffc2fb76464be70b22640bb9c1860867bde6 (patch) | |
tree | 694a1c43899e3ed1965247646f1d2b0fe6dc8138 /misc/tools | |
parent | d5165bc6711689fdb310fa96fde40356f0c0666e (diff) | |
download | inter-2b53ffc2fb76464be70b22640bb9c1860867bde6.tar.xz |
tooling update
Diffstat (limited to 'misc/tools')
-rwxr-xr-x | misc/tools/fontinfo.py | 6 | ||||
-rwxr-xr-x | misc/tools/gen-glyphinfo.py | 4 | ||||
-rwxr-xr-x | misc/tools/gen-metrics-and-svgs.py | 14 | ||||
-rwxr-xr-x | misc/tools/versionize-css.py | 2 |
4 files changed, 9 insertions, 17 deletions
diff --git a/misc/tools/fontinfo.py b/misc/tools/fontinfo.py index 5accc5498..76088ad3f 100755 --- a/misc/tools/fontinfo.py +++ b/misc/tools/fontinfo.py @@ -3,8 +3,6 @@ # # Generates JSON-encoded information about fonts # -from __future__ import print_function - import os, sys from os.path import dirname, basename, abspath, relpath, join as pjoin sys.path.append(abspath(pjoin(dirname(__file__), 'tools'))) @@ -343,7 +341,7 @@ def genFontInfo(fontpath, outputType, withGlyphs=True): if 'panose' in os2: panose = {} - for k,v in sstructTableToDict(os2['panose'], panoseFormat).iteritems(): + for k,v in sstructTableToDict(os2['panose'], panoseFormat).items(): if k[0:1] == 'b' and k[1].isupper(): k = k[1].lower() + k[2:] # bFooBar => fooBar @@ -369,7 +367,7 @@ def genFontInfo(fontpath, outputType, withGlyphs=True): if 'meta' in tt: meta = {} - for k,v in tt['meta'].data.iteritems(): + for k,v in tt['meta'].data.items(): try: v.decode('utf8') meta[k] = v diff --git a/misc/tools/gen-glyphinfo.py b/misc/tools/gen-glyphinfo.py index be7a4afd3..041fb5300 100755 --- a/misc/tools/gen-glyphinfo.py +++ b/misc/tools/gen-glyphinfo.py @@ -3,8 +3,6 @@ # # Grab http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt # -from __future__ import print_function - import os, sys from os.path import dirname, basename, abspath, relpath, join as pjoin sys.path.append(abspath(pjoin(dirname(__file__), 'tools'))) @@ -14,7 +12,7 @@ import json, re import time from argparse import ArgumentParser from collections import OrderedDict -from ConfigParser import RawConfigParser +from configparser import RawConfigParser # from robofab.objects.objectsRF import OpenFont from unicode_util import parseUnicodeDataFile from defcon import Font diff --git a/misc/tools/gen-metrics-and-svgs.py b/misc/tools/gen-metrics-and-svgs.py index aaea74da6..34d5d3458 100755 --- a/misc/tools/gen-metrics-and-svgs.py +++ b/misc/tools/gen-metrics-and-svgs.py @@ -3,8 +3,6 @@ # # Sync glyph shapes between SVG and UFO, creating a bridge between UFO and Figma. # -from __future__ import print_function - import os, sys from os.path import dirname, basename, abspath, relpath, join as pjoin sys.path.append(abspath(pjoin(dirname(__file__), 'tools'))) @@ -293,8 +291,8 @@ svgtext = '\n'.join(svgLines) glyphsHtmlFilename = os.path.join(BASEDIR, 'docs', 'glyphs', 'index.html') html = u'' -with open(glyphsHtmlFilename, 'r') as f: - html = f.read().decode('utf8') +with open(glyphsHtmlFilename, 'r', encoding="utf-8") as f: + html = f.read() startMarker = u'<div id="svgs">' startPos = html.find(startMarker) @@ -317,17 +315,17 @@ metaJson += '"kerning":' + fmtJsonList(kerning) + '\n' metaJson += '}' # metaHtml = '<script>var fontMetaData = ' + metaJson + ';</script>' -html = html[:startPos + len(startMarker)] + '\n' + svgtext.decode('utf8') + '\n' + html[endPos:] +html = html[:startPos + len(startMarker)] + '\n' + svgtext + '\n' + html[endPos:] print('write', relfilename) -with open(glyphsHtmlFilename, 'w') as f: - f.write(html.encode('utf8')) +with open(glyphsHtmlFilename, 'w', encoding="utf-8") as f: + f.write(html) # JSON jsonFilename = os.path.join(BASEDIR, 'docs', 'glyphs', 'metrics.json') jsonFilenameRel = os.path.relpath(jsonFilename, os.getcwd()) print('write', jsonFilenameRel) -with open(jsonFilename, 'w') as f: +with open(jsonFilename, 'w', encoding="utf-8") as f: f.write(metaJson) metaJson
\ No newline at end of file diff --git a/misc/tools/versionize-css.py b/misc/tools/versionize-css.py index 5c1d9a9b8..4649ad88c 100755 --- a/misc/tools/versionize-css.py +++ b/misc/tools/versionize-css.py @@ -3,8 +3,6 @@ # # Updates the "?v=x" in docs/inter-ui.css # -from __future__ import print_function - import os, sys from os.path import dirname, basename, abspath, relpath, join as pjoin sys.path.append(abspath(pjoin(dirname(__file__), 'tools'))) |