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.
This commit is contained in:
parent
4262086bff
commit
5194e4f474
3 changed files with 79 additions and 5 deletions
16
Makefile
16
Makefile
|
|
@ -44,7 +44,13 @@ all: all_const all_const_hinted all_var
|
||||||
|
|
||||||
all_const: all_otf all_ttf all_web
|
all_const: all_otf all_ttf all_web
|
||||||
all_const_hinted: all_ttf_hinted all_web_hinted
|
all_const_hinted: all_ttf_hinted all_web_hinted
|
||||||
all_var: $(FONTDIR)/var/Inter-UI.var.woff2
|
all_var: \
|
||||||
|
$(FONTDIR)/var/Inter-UI.var.woff2 \
|
||||||
|
$(FONTDIR)/var/Inter-UI-upright.var.woff2 \
|
||||||
|
$(FONTDIR)/var/Inter-UI-italic.var.woff2 \
|
||||||
|
$(FONTDIR)/var/Inter-UI.var.ttf \
|
||||||
|
$(FONTDIR)/var/Inter-UI-upright.var.ttf \
|
||||||
|
$(FONTDIR)/var/Inter-UI-italic.var.ttf
|
||||||
|
|
||||||
# Disabled. See https://github.com/rsms/inter/issues/75
|
# Disabled. See https://github.com/rsms/inter/issues/75
|
||||||
# all_var_hinted: $(FONTDIR)/var-hinted/Inter-UI.var.ttf $(FONTDIR)/var-hinted/Inter-UI.var.woff2
|
# all_var_hinted: $(FONTDIR)/var-hinted/Inter-UI.var.ttf $(FONTDIR)/var-hinted/Inter-UI.var.woff2
|
||||||
|
|
@ -79,8 +85,8 @@ build/%.woff: build/%.ttf
|
||||||
|
|
||||||
all_ufo_masters = $(Regular_ufo_d) $(Black_ufo_d) $(Italic_ufo_d) $(BlackItalic_ufo_d)
|
all_ufo_masters = $(Regular_ufo_d) $(Black_ufo_d) $(Italic_ufo_d) $(BlackItalic_ufo_d)
|
||||||
|
|
||||||
$(FONTDIR)/var/Inter-UI.var.ttf: src/Inter-UI.designspace $(all_ufo_masters)
|
$(FONTDIR)/var/%.var.ttf: src/%.designspace $(all_ufo_masters)
|
||||||
misc/fontbuild compile-var -o $@ src/Inter-UI.designspace
|
misc/fontbuild compile-var -o $@ $<
|
||||||
|
|
||||||
$(FONTDIR)/const/Inter-UI-Regular.%: src/Inter-UI.designspace $(Regular_ufo_d)
|
$(FONTDIR)/const/Inter-UI-Regular.%: src/Inter-UI.designspace $(Regular_ufo_d)
|
||||||
misc/fontbuild compile -o $@ src/Inter-UI-Regular.ufo
|
misc/fontbuild compile -o $@ src/Inter-UI-Regular.ufo
|
||||||
|
|
@ -135,7 +141,7 @@ $(FONTDIR)/const-hinted/%.ttf: $(FONTDIR)/const/%.ttf
|
||||||
# ttfautohint --fallback-stem-width=256 --no-info --composites "$<" "$@"
|
# ttfautohint --fallback-stem-width=256 --no-info --composites "$<" "$@"
|
||||||
|
|
||||||
# make sure intermediate TTFs are not gc'd by make
|
# make sure intermediate TTFs are not gc'd by make
|
||||||
.PRECIOUS: $(FONTDIR)/const/%.ttf $(FONTDIR)/var/%.ttf
|
.PRECIOUS: $(FONTDIR)/const/%.ttf $(FONTDIR)/const-hinted/%.ttf $(FONTDIR)/var/%.var.ttf
|
||||||
|
|
||||||
# check var
|
# check var
|
||||||
all_check_var: $(FONTDIR)/var/Inter-UI.var.ttf
|
all_check_var: $(FONTDIR)/var/Inter-UI.var.ttf
|
||||||
|
|
@ -235,7 +241,7 @@ docs_fonts:
|
||||||
cp -a $(FONTDIR)/const/*.woff \
|
cp -a $(FONTDIR)/const/*.woff \
|
||||||
$(FONTDIR)/const/*.woff2 \
|
$(FONTDIR)/const/*.woff2 \
|
||||||
$(FONTDIR)/const/*.otf \
|
$(FONTDIR)/const/*.otf \
|
||||||
$(FONTDIR)/var/*.woff2 \
|
$(FONTDIR)/var/*.* \
|
||||||
docs/font-files/
|
docs/font-files/
|
||||||
|
|
||||||
.PHONY: docs docs_info docs_fonts
|
.PHONY: docs docs_info docs_fonts
|
||||||
|
|
|
||||||
9
misc/dist/variable.txt
vendored
9
misc/dist/variable.txt
vendored
|
|
@ -1,6 +1,15 @@
|
||||||
|
|
||||||
Variable fonts is a new technology still undergoing development.
|
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
|
Support for variable fonts is limited as of late 2018, but support
|
||||||
is quickly arriving to web browsers, operating systems and
|
is quickly arriving to web browsers, operating systems and
|
||||||
design application.
|
design application.
|
||||||
|
|
|
||||||
|
|
@ -469,6 +469,47 @@ class Main(object):
|
||||||
font.save(ufo_path)
|
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):
|
def cmd_glyphsync(self, argv):
|
||||||
argparser = argparse.ArgumentParser(
|
argparser = argparse.ArgumentParser(
|
||||||
usage='%(prog)s glyphsync <glyphsfile> [options]',
|
usage='%(prog)s glyphsync <glyphsfile> [options]',
|
||||||
|
|
@ -557,6 +598,24 @@ class Main(object):
|
||||||
self.log("write %s" % relpath(designspace_file, os.getcwd()))
|
self.log("write %s" % relpath(designspace_file, os.getcwd()))
|
||||||
designspace.write(designspace_file)
|
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:
|
for p in procs:
|
||||||
p.join()
|
p.join()
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue