summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2018-10-08 04:27:12 +0300
committerRasmus Andersson <rasmus@notion.se>2018-10-11 09:38:31 +0300
commit5194e4f4740949a702981d65d01aaf1965d47242 (patch)
tree226161e42dcaef3c7565dd55c20f676d5b54408d /misc
parent4262086bffef542bc10cee51dd3a5f4e48850506 (diff)
downloadinter-5194e4f4740949a702981d65d01aaf1965d47242.tar.xz
fontbuild: now generating three variable fonts: complete family with two axes, italic version with weight axis and upright version with weight axis. This allows supporting browsers like MS Edge which do not correctly map italic and oblique font style properties to slnt and ital axes.
Diffstat (limited to 'misc')
-rw-r--r--misc/dist/variable.txt9
-rwxr-xr-xmisc/fontbuild59
2 files changed, 68 insertions, 0 deletions
diff --git a/misc/dist/variable.txt b/misc/dist/variable.txt
index 78ac81974..c2a3b5cb2 100644
--- a/misc/dist/variable.txt
+++ b/misc/dist/variable.txt
@@ -1,6 +1,15 @@
Variable fonts is a new technology still undergoing development.
+The directory named "Inter UI (TTF variable)" contains three files:
+
+- Inter-UI.var.ttf -- multi-axis complete family
+- Inter-UI-italic.var.ttf -- italic-only with variable weight axis.
+- Inter-UI-upright.var.ttf-- upright-only with variable weight axis.
+
+The "Inter UI (web)" directory contains WOFF2 versions of these same
+font files.
+
Support for variable fonts is limited as of late 2018, but support
is quickly arriving to web browsers, operating systems and
design application.
diff --git a/misc/fontbuild b/misc/fontbuild
index 998739f35..d272a7aec 100755
--- a/misc/fontbuild
+++ b/misc/fontbuild
@@ -469,6 +469,47 @@ class Main(object):
font.save(ufo_path)
+ def _genSubsetDesignSpace(self, designspace, tag, filename):
+ ds = designspace
+ italic = False
+ if tag == 'italic':
+ italic = True
+ elif tag != 'upright':
+ raise Exception('unexpected tag ' + tag)
+
+ for a in ds.axes:
+ if a.tag == "slnt":
+ ds.axes.remove(a)
+ break
+
+ rmlist = []
+ hasDefault = not italic
+ for source in designspace.sources:
+ isitalic = source.name.find('italic') != -1
+ if italic != isitalic:
+ rmlist.append(source)
+ elif italic and not hasDefault:
+ source.copyLib = True
+ source.copyInfo = True
+ source.copyGroups = True
+ source.copyFeatures = True
+ hasDefault = True
+ for source in rmlist:
+ designspace.sources.remove(source)
+
+ rmlist = []
+ for instance in designspace.instances:
+ isitalic = instance.name.find('italic') != -1
+ if italic != isitalic:
+ rmlist.append(instance)
+ for instance in rmlist:
+ designspace.instances.remove(instance)
+
+ self.log("write %s" % relpath(filename, os.getcwd()))
+ ds.write(filename)
+
+
+
def cmd_glyphsync(self, argv):
argparser = argparse.ArgumentParser(
usage='%(prog)s glyphsync <glyphsfile> [options]',
@@ -557,6 +598,24 @@ class Main(object):
self.log("write %s" % relpath(designspace_file, os.getcwd()))
designspace.write(designspace_file)
+ # upright designspace
+ upright_designspace_file = pjoin(outdir, 'Inter-UI-upright.designspace')
+ p = Process(
+ target=self._genSubsetDesignSpace,
+ args=(designspace, 'upright', upright_designspace_file)
+ )
+ p.start()
+ procs.append(p)
+
+ # italic designspace
+ italic_designspace_file = pjoin(outdir, 'Inter-UI-italic.designspace')
+ p = Process(
+ target=self._genSubsetDesignSpace,
+ args=(designspace, 'italic', italic_designspace_file)
+ )
+ p.start()
+ procs.append(p)
+
for p in procs:
p.join()