summaryrefslogtreecommitdiff
path: root/misc/fontbuild
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2020-08-19 21:54:07 +0300
committerRasmus Andersson <rasmus@notion.se>2020-08-19 21:54:07 +0300
commit206f684bfae76f693e4809d4a98832d826bb32e3 (patch)
treed8c47f33fa0f11453d56b15e13d9dae6b0036f72 /misc/fontbuild
parent053cb053e7e0e78c3451e9b16d4746d37db4b1ac (diff)
downloadinter-206f684bfae76f693e4809d4a98832d826bb32e3.tar.xz
tooling: include anchors in final font files. This does not seem to have real-world practial effects beyond increasing the file size, but more testing is needed. Sharing the work first. Easy to revert.
Diffstat (limited to 'misc/fontbuild')
-rwxr-xr-xmisc/fontbuild91
1 files changed, 45 insertions, 46 deletions
diff --git a/misc/fontbuild b/misc/fontbuild
index 761513d7a..2913c5495 100755
--- a/misc/fontbuild
+++ b/misc/fontbuild
@@ -193,42 +193,46 @@ class Main(object):
elif fext != ".otf":
raise Exception('invalid file format %r (expected ".otf" or ".ttf")' % fext)
- # temp file to write to
- tmpfilename = pjoin(self.tmpdir, basename(outfilename))
- mkdirs(self.tmpdir)
-
# build OTF or TTF file from UFO
- FontBuilder().buildStatic(args.srcfile, tmpfilename, cff)
-
- # Run ots-sanitize on produced OTF/TTF file and write sanitized version to outfilename
- self._ots_sanitize(tmpfilename, outfilename)
-
-
- def _ots_sanitize(self, tmpfilename, outfilename):
- # run through ots-sanitize
- # for filename in args.output:
- tmpfile = pjoin(self.tmpdir, tmpfilename)
- mkdirs(dirname(outfilename))
- success = True
- try:
- self.log("write %s" % outfilename)
- otssan_res = subprocess.check_output(
- ['ots-sanitize', tmpfile, outfilename],
- # ['cp', tmpfile, outfilename],
- shell=False
- ).strip()
- # Note: ots-sanitize does not exit with an error in many cases where
- # it fails to sanitize the font.
- success = str(otssan_res).find('Failed') == -1
- except:
- success = False
- if len(otssan_res) == 0:
- otssan_res = 'error'
-
- if success:
- os.unlink(tmpfile)
- else:
- fatal('ots-sanitize failed for %s: %s' % (tmpfile, otssan_res))
+ FontBuilder().buildStatic(args.srcfile, outfilename, cff)
+
+ # code to pipe font through ots-sanitize:
+ # # temp file to write to
+ # tmpfilename = pjoin(self.tmpdir, basename(outfilename))
+ # mkdirs(self.tmpdir)
+ #
+ # # build OTF or TTF file from UFO
+ # FontBuilder().buildStatic(args.srcfile, tmpfilename, cff)
+ #
+ # # Run ots-sanitize on produced OTF/TTF file and write sanitized version to outfilename
+ # self._ots_sanitize(tmpfilename, outfilename)
+
+
+ #def _ots_sanitize(self, tmpfilename, outfilename):
+ # # run through ots-sanitize
+ # # for filename in args.output:
+ # tmpfile = pjoin(self.tmpdir, tmpfilename)
+ # mkdirs(dirname(outfilename))
+ # success = True
+ # try:
+ # self.log("write %s" % outfilename)
+ # otssan_res = subprocess.check_output(
+ # ['ots-sanitize', tmpfile, outfilename],
+ # # ['cp', tmpfile, outfilename],
+ # shell=False
+ # ).strip()
+ # # Note: ots-sanitize does not exit with an error in many cases where
+ # # it fails to sanitize the font.
+ # success = str(otssan_res).find('Failed') == -1
+ # except:
+ # success = False
+ # if len(otssan_res) == 0:
+ # otssan_res = 'error'
+ #
+ # if success:
+ # os.unlink(tmpfile)
+ # else:
+ # fatal('ots-sanitize failed for %s: %s' % (tmpfile, otssan_res))
@@ -264,7 +268,7 @@ class Main(object):
if g.name in glyphOrder:
del(glyphOrder[g.name])
g.unicodes = []
- g.clearAnchors()
+ # g.clearAnchors()
if 'com.schriftgestaltung.Glyphs.lastChange' in g.lib:
del(g.lib['com.schriftgestaltung.Glyphs.lastChange'])
@@ -376,14 +380,9 @@ class Main(object):
# generate designspace from glyphs project
designspace = glyphsLib.to_designspace(
font,
- propagate_anchors=False,
+ # propagate_anchors=False,
instance_dir=relpath(instance_dir, master_dir),
-
- store_editor_state=False,
- # do not store glyphs editor UI state in UFOs
-
- minimize_glyphs_diffs=True,
- # do not store glyphs metadata in UFOs
+ store_editor_state=False, # do not store glyphs editor UI state in UFOs
)
# strip lib data
@@ -528,9 +527,9 @@ class Main(object):
del(font.lib[italicAngleKey])
font.info.italicAngle = italicAngle
- # clear anchors
- for g in font:
- g.clearAnchors()
+ # # clear anchors
+ # for g in font:
+ # g.clearAnchors()
# update font info
weight = instance_weight[basename(font.path)]