tooling: upgrade libs, rename VF fext otf -> ttf, add STAT table patch
- upgrades 3rd party libraries used by the toolchain - upgrades fontbuild code to adjust changes to library APIs - renames VF font filename extensions to .ttf - adds better STAT table patch to improve metadata on Windows
This commit is contained in:
parent
cb3d2853b9
commit
d76268cf8d
10 changed files with 114 additions and 164 deletions
58
Makefile
58
Makefile
|
|
@ -46,25 +46,25 @@ web_display: all_web_display all_web_hinted_display
|
||||||
|
|
||||||
# variable fonts
|
# variable fonts
|
||||||
var: all_var_text all_var_display
|
var: all_var_text all_var_display
|
||||||
var_text: $(FONTDIR)/var/Inter.var.woff2 $(FONTDIR)/var/Inter.var.otf
|
var_text: $(FONTDIR)/var/Inter.var.woff2 $(FONTDIR)/var/Inter.var.ttf $(FONTDIR)/var/Inter-V.var.ttf
|
||||||
var_display: $(FONTDIR)/var/InterDisplay.var.woff2 $(FONTDIR)/var/InterDisplay.var.otf
|
var_display: $(FONTDIR)/var/InterDisplay.var.woff2 $(FONTDIR)/var/InterDisplay.var.ttf $(FONTDIR)/var/InterDisplay-V.var.ttf
|
||||||
all_var_text: \
|
all_var_text: \
|
||||||
$(FONTDIR)/var/Inter.var.otf \
|
$(FONTDIR)/var/Inter.var.ttf \
|
||||||
$(FONTDIR)/var/Inter.var.woff2 \
|
$(FONTDIR)/var/Inter.var.woff2 \
|
||||||
$(FONTDIR)/var/Inter-V.var.otf \
|
$(FONTDIR)/var/Inter-V.var.ttf \
|
||||||
$(FONTDIR)/var/Inter-V.var.woff2 \
|
$(FONTDIR)/var/Inter-V.var.woff2 \
|
||||||
$(FONTDIR)/var/Inter-roman.var.otf \
|
$(FONTDIR)/var/Inter-roman.var.ttf \
|
||||||
$(FONTDIR)/var/Inter-roman.var.woff2 \
|
$(FONTDIR)/var/Inter-roman.var.woff2 \
|
||||||
$(FONTDIR)/var/Inter-italic.var.otf \
|
$(FONTDIR)/var/Inter-italic.var.ttf \
|
||||||
$(FONTDIR)/var/Inter-italic.var.woff2
|
$(FONTDIR)/var/Inter-italic.var.woff2
|
||||||
all_var_display: \
|
all_var_display: \
|
||||||
$(FONTDIR)/var/InterDisplay.var.otf \
|
$(FONTDIR)/var/InterDisplay.var.ttf \
|
||||||
$(FONTDIR)/var/InterDisplay.var.woff2 \
|
$(FONTDIR)/var/InterDisplay.var.woff2 \
|
||||||
$(FONTDIR)/var/InterDisplay-V.var.otf \
|
$(FONTDIR)/var/InterDisplay-V.var.ttf \
|
||||||
$(FONTDIR)/var/InterDisplay-V.var.woff2 \
|
$(FONTDIR)/var/InterDisplay-V.var.woff2 \
|
||||||
$(FONTDIR)/var/InterDisplay-roman.var.otf \
|
$(FONTDIR)/var/InterDisplay-roman.var.ttf \
|
||||||
$(FONTDIR)/var/InterDisplay-roman.var.woff2 \
|
$(FONTDIR)/var/InterDisplay-roman.var.woff2 \
|
||||||
$(FONTDIR)/var/InterDisplay-italic.var.otf \
|
$(FONTDIR)/var/InterDisplay-italic.var.ttf \
|
||||||
$(FONTDIR)/var/InterDisplay-italic.var.woff2
|
$(FONTDIR)/var/InterDisplay-italic.var.woff2
|
||||||
|
|
||||||
.PHONY: all all_otf all_ttf all_text all_display
|
.PHONY: all all_otf all_ttf all_text all_display
|
||||||
|
|
@ -72,7 +72,7 @@ all_var_display: \
|
||||||
.PHONY: var var_text var_display all_var_text all_var_display
|
.PHONY: var var_text var_display all_var_text all_var_display
|
||||||
|
|
||||||
# Hinted variable font disabled. See https://github.com/rsms/inter/issues/75
|
# Hinted variable font disabled. See https://github.com/rsms/inter/issues/75
|
||||||
# all_var_hinted: $(FONTDIR)/var-hinted/Inter.var.otf $(FONTDIR)/var-hinted/Inter.var.woff2
|
# all_var_hinted: $(FONTDIR)/var-hinted/Inter.var.ttf $(FONTDIR)/var-hinted/Inter.var.woff2
|
||||||
|
|
||||||
# list make targets
|
# list make targets
|
||||||
# We copy the Makefile (first in MAKEFILE_LIST) and disable the include to only list
|
# We copy the Makefile (first in MAKEFILE_LIST) and disable the include to only list
|
||||||
|
|
@ -100,10 +100,6 @@ export PATH := $(PWD)/build/venv/bin:$(PATH)
|
||||||
include build/etc/generated.make
|
include build/etc/generated.make
|
||||||
|
|
||||||
|
|
||||||
# WOFF2 from OTF
|
|
||||||
build/%.var.woff2: build/%.var.otf
|
|
||||||
woff2_compress "$<"
|
|
||||||
|
|
||||||
# WOFF2 from TTF
|
# WOFF2 from TTF
|
||||||
build/%.woff2: build/%.ttf
|
build/%.woff2: build/%.ttf
|
||||||
woff2_compress "$<"
|
woff2_compress "$<"
|
||||||
|
|
@ -115,25 +111,23 @@ build/%.woff: build/%.ttf
|
||||||
|
|
||||||
|
|
||||||
# VF OTF from UFO
|
# VF OTF from UFO
|
||||||
$(FONTDIR)/var/Inter.var.otf: $(all_ufo_masters_text) version.txt
|
$(FONTDIR)/var/Inter.var.ttf: $(all_ufo_masters_text) version.txt
|
||||||
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter.designspace
|
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter.designspace
|
||||||
ttx -m $@ -o $@ src/Inter-vf-stat-table-patch.ttx
|
|
||||||
|
|
||||||
$(FONTDIR)/var/Inter-V.var.otf: $(FONTDIR)/var/Inter.var.otf
|
$(FONTDIR)/var/Inter-V.var.ttf: $(FONTDIR)/var/Inter.var.ttf
|
||||||
misc/fontbuild rename --family "Inter V" -o $@ $<
|
misc/fontbuild rename --family "Inter V" -o $@ $<
|
||||||
|
|
||||||
$(FONTDIR)/var/Inter-%.var.otf: build/ufo/Inter-%.designspace $(all_ufo_masters_text) version.txt
|
$(FONTDIR)/var/Inter-%.var.ttf: build/ufo/Inter-%.designspace $(all_ufo_masters_text) version.txt
|
||||||
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
|
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
|
||||||
misc/tools/fix-vf-meta.py $@
|
misc/tools/fix-vf-meta.py $@
|
||||||
|
|
||||||
$(FONTDIR)/var/InterDisplay.var.otf: $(all_ufo_masters_display) version.txt
|
$(FONTDIR)/var/InterDisplay.var.ttf: $(all_ufo_masters_display) version.txt
|
||||||
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/InterDisplay.designspace
|
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/InterDisplay.designspace
|
||||||
ttx -m $@ -o $@ src/Inter-vf-stat-table-patch.ttx
|
|
||||||
|
|
||||||
$(FONTDIR)/var/InterDisplay-V.var.otf: $(FONTDIR)/var/InterDisplay.var.otf
|
$(FONTDIR)/var/InterDisplay-V.var.ttf: $(FONTDIR)/var/InterDisplay.var.ttf
|
||||||
misc/fontbuild rename --family "Inter Display V" -o $@ $<
|
misc/fontbuild rename --family "Inter Display V" -o $@ $<
|
||||||
|
|
||||||
$(FONTDIR)/var/InterDisplay-%.var.otf: build/ufo/InterDisplay-%.designspace $(all_ufo_masters_display) version.txt
|
$(FONTDIR)/var/InterDisplay-%.var.ttf: build/ufo/InterDisplay-%.designspace $(all_ufo_masters_display) version.txt
|
||||||
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
|
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
|
||||||
misc/tools/fix-vf-meta.py $@
|
misc/tools/fix-vf-meta.py $@
|
||||||
|
|
||||||
|
|
@ -203,7 +197,7 @@ $(FONTDIR)/const-hinted/%.ttf: $(FONTDIR)/const/%.ttf
|
||||||
.PRECIOUS: $(FONTDIR)/const/%.ttf
|
.PRECIOUS: $(FONTDIR)/const/%.ttf
|
||||||
.PRECIOUS: $(FONTDIR)/const/%.otf
|
.PRECIOUS: $(FONTDIR)/const/%.otf
|
||||||
.PRECIOUS: $(FONTDIR)/const-hinted/%.ttf
|
.PRECIOUS: $(FONTDIR)/const-hinted/%.ttf
|
||||||
.PRECIOUS: $(FONTDIR)/var/%.var.otf
|
.PRECIOUS: $(FONTDIR)/var/%.var.ttf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -221,9 +215,9 @@ check_text:
|
||||||
$(FONTDIR)/const/Inter-*.ttf \
|
$(FONTDIR)/const/Inter-*.ttf \
|
||||||
$(FONTDIR)/const/Inter-*.otf \
|
$(FONTDIR)/const/Inter-*.otf \
|
||||||
$(FONTDIR)/const/Inter-*.woff2 \
|
$(FONTDIR)/const/Inter-*.woff2 \
|
||||||
$(FONTDIR)/var/Inter.var.otf \
|
$(FONTDIR)/var/Inter.var.ttf \
|
||||||
$(FONTDIR)/var/Inter.var.woff2 \
|
$(FONTDIR)/var/Inter.var.woff2 \
|
||||||
$(FONTDIR)/var/Inter-*.var.otf \
|
$(FONTDIR)/var/Inter-*.var.ttf \
|
||||||
$(FONTDIR)/var/Inter-*.var.woff2
|
$(FONTDIR)/var/Inter-*.var.woff2
|
||||||
@echo "check_text: all ok"
|
@echo "check_text: all ok"
|
||||||
|
|
||||||
|
|
@ -232,9 +226,9 @@ check_display:
|
||||||
$(FONTDIR)/const/InterDisplay-*.ttf \
|
$(FONTDIR)/const/InterDisplay-*.ttf \
|
||||||
$(FONTDIR)/const/InterDisplay-*.otf \
|
$(FONTDIR)/const/InterDisplay-*.otf \
|
||||||
$(FONTDIR)/const/InterDisplay-*.woff2 \
|
$(FONTDIR)/const/InterDisplay-*.woff2 \
|
||||||
$(FONTDIR)/var/InterDisplay.var.otf \
|
$(FONTDIR)/var/InterDisplay.var.ttf \
|
||||||
$(FONTDIR)/var/InterDisplay.var.woff2 \
|
$(FONTDIR)/var/InterDisplay.var.woff2 \
|
||||||
$(FONTDIR)/var/InterDisplay-*.var.otf \
|
$(FONTDIR)/var/InterDisplay-*.var.ttf \
|
||||||
$(FONTDIR)/var/InterDisplay-*.var.woff2
|
$(FONTDIR)/var/InterDisplay-*.var.woff2
|
||||||
@echo "check_display: all ok"
|
@echo "check_display: all ok"
|
||||||
|
|
||||||
|
|
@ -390,13 +384,13 @@ install_display_otf: all_otf_display
|
||||||
mkdir -p ~/'Library/Fonts/InterDisplay'
|
mkdir -p ~/'Library/Fonts/InterDisplay'
|
||||||
cp -a $(FONTDIR)/const/InterDisplay-*.otf ~/'Library/Fonts/InterDisplay'
|
cp -a $(FONTDIR)/const/InterDisplay-*.otf ~/'Library/Fonts/InterDisplay'
|
||||||
|
|
||||||
install_text_var: $(FONTDIR)/var/Inter-V.var.otf
|
install_text_var: $(FONTDIR)/var/Inter-V.var.ttf
|
||||||
mkdir -p ~/'Library/Fonts/Inter'
|
mkdir -p ~/'Library/Fonts/Inter'
|
||||||
cp -a $(FONTDIR)/var/Inter-V.var.otf ~/'Library/Fonts/Inter/Inter-V.otf'
|
cp -a $(FONTDIR)/var/Inter-V.var.ttf ~/'Library/Fonts/Inter/Inter-V.ttf'
|
||||||
|
|
||||||
install_display_var: $(FONTDIR)/var/InterDisplay-V.var.otf
|
install_display_var: $(FONTDIR)/var/InterDisplay-V.var.ttf
|
||||||
mkdir -p ~/'Library/Fonts/InterDisplay'
|
mkdir -p ~/'Library/Fonts/InterDisplay'
|
||||||
cp -a $(FONTDIR)/var/Inter-V.var.otf ~/'Library/Fonts/InterDisplay/InterDisplay-V.otf'
|
cp -a $(FONTDIR)/var/Inter-V.var.ttf ~/'Library/Fonts/InterDisplay/InterDisplay-V.ttf'
|
||||||
|
|
||||||
install: install_text install_display
|
install: install_text install_display
|
||||||
install_otf: install_text_otf install_display_otf
|
install_otf: install_text_otf install_display_otf
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ def collapseFontStyleName(font):
|
||||||
setFontInfo(font, font.info.openTypeOS2WeightClass)
|
setFontInfo(font, font.info.openTypeOS2WeightClass)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Main(object):
|
class Main(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
@ -256,37 +255,25 @@ class Main(object):
|
||||||
if layer != defaultLayer:
|
if layer != defaultLayer:
|
||||||
delLayerNames.add(layer.name)
|
delLayerNames.add(layer.name)
|
||||||
for layerName in delLayerNames:
|
for layerName in delLayerNames:
|
||||||
del layers[layerName]
|
del(layers[layerName])
|
||||||
|
|
||||||
# process glyphs
|
# process glyphs
|
||||||
stripGlyphs = []
|
|
||||||
glyphOrder = OrderedDict([(k,None) for k in font.lib['public.glyphOrder']])
|
glyphOrder = OrderedDict([(k,None) for k in font.lib['public.glyphOrder']])
|
||||||
componentRefs = font.componentReferences
|
|
||||||
for g in font:
|
for g in font:
|
||||||
if not g.lib.get('com.schriftgestaltung.Glyphs.Export', True):
|
if not g.lib.get('com.schriftgestaltung.Glyphs.Export', True):
|
||||||
del glyphOrder[g.name]
|
if g.name in glyphOrder:
|
||||||
|
del(glyphOrder[g.name])
|
||||||
g.unicodes = []
|
g.unicodes = []
|
||||||
if len(componentRefs.get(g.name, [])) == 0:
|
|
||||||
# unused
|
|
||||||
stripGlyphs.append(g.name)
|
|
||||||
g.clearAnchors()
|
g.clearAnchors()
|
||||||
if 'com.schriftgestaltung.Glyphs.lastChange' in g.lib:
|
if 'com.schriftgestaltung.Glyphs.lastChange' in g.lib:
|
||||||
del g.lib['com.schriftgestaltung.Glyphs.lastChange']
|
del(g.lib['com.schriftgestaltung.Glyphs.lastChange'])
|
||||||
|
|
||||||
# update possibly modified glyphorder
|
# update possibly modified glyphorder
|
||||||
font.lib['public.glyphOrder'] = list(glyphOrder)
|
font.lib['public.glyphOrder'] = list(glyphOrder)
|
||||||
|
|
||||||
# strip unused glyphs
|
|
||||||
for gname in stripGlyphs:
|
|
||||||
log.info(
|
|
||||||
'Strip unused and unexported glyph "%s" from %s',
|
|
||||||
gname, ufo_path
|
|
||||||
)
|
|
||||||
del font[gname]
|
|
||||||
|
|
||||||
# write UFO file
|
# write UFO file
|
||||||
self.log("write %s" % relpath(ufo_path, os.getcwd()))
|
self.log("write %s" % relpath(ufo_path, os.getcwd()))
|
||||||
font.save(ufo_path)
|
font.save(ufo_path, overwrite=True, validate=False)
|
||||||
|
|
||||||
|
|
||||||
def _genSubsetDesignSpace(self, designspace, tag, filename):
|
def _genSubsetDesignSpace(self, designspace, tag, filename):
|
||||||
|
|
@ -365,6 +352,27 @@ class Main(object):
|
||||||
))
|
))
|
||||||
font = glyphsLib.GSFont(glyphsfile)
|
font = glyphsLib.GSFont(glyphsfile)
|
||||||
|
|
||||||
|
# remove archive layers and backgrounds
|
||||||
|
masterLayerIDs = set()
|
||||||
|
for master in font.masters:
|
||||||
|
masterLayerIDs.add(master.id)
|
||||||
|
for glyph in font.glyphs:
|
||||||
|
for layer in list(glyph.layers): # list to accumulate iterator since we del()
|
||||||
|
# remove background images from all layers
|
||||||
|
layer.backgroundImage = None
|
||||||
|
lname = layer.name
|
||||||
|
lid = layer.layerId
|
||||||
|
if lname[0] != '_' and (lid in masterLayerIDs or lname.find('{') != -1):
|
||||||
|
# Keep only layers which are masters or bracket layers.
|
||||||
|
# Next, clear background to speed up UFO generation.
|
||||||
|
layer.background.paths = []
|
||||||
|
layer.background.components = []
|
||||||
|
layer.background.anchors = []
|
||||||
|
layer.background.hints = []
|
||||||
|
layer.background.guides = []
|
||||||
|
else:
|
||||||
|
del(glyph.layers[lid])
|
||||||
|
|
||||||
# generate designspace from glyphs project
|
# generate designspace from glyphs project
|
||||||
designspace = glyphsLib.to_designspace(
|
designspace = glyphsLib.to_designspace(
|
||||||
font,
|
font,
|
||||||
|
|
@ -386,7 +394,7 @@ class Main(object):
|
||||||
procs = []
|
procs = []
|
||||||
for source in designspace.sources:
|
for source in designspace.sources:
|
||||||
# source : fontTools.designspaceLib.SourceDescriptor
|
# source : fontTools.designspaceLib.SourceDescriptor
|
||||||
# source.font : defcon.objects.font.Font
|
# source.font : ufoLib2.objects.font.Font
|
||||||
ufo_path = pjoin(master_dir, source.filename)
|
ufo_path = pjoin(master_dir, source.filename)
|
||||||
# no need to also set the relative 'filename' attribute as that
|
# no need to also set the relative 'filename' attribute as that
|
||||||
# will be auto-updated on writing the designspace document
|
# will be auto-updated on writing the designspace document
|
||||||
|
|
@ -415,6 +423,10 @@ class Main(object):
|
||||||
source.path = ufo_path
|
source.path = ufo_path
|
||||||
weight = int(source.location['Weight'])
|
weight = int(source.location['Weight'])
|
||||||
|
|
||||||
|
# serial
|
||||||
|
# self._glyphsyncWriteUFO(source.font, weight, ufo_path)
|
||||||
|
|
||||||
|
# parallel
|
||||||
p = Process(
|
p = Process(
|
||||||
target=self._glyphsyncWriteUFO,
|
target=self._glyphsyncWriteUFO,
|
||||||
args=(source.font, weight, ufo_path)
|
args=(source.font, weight, ufo_path)
|
||||||
|
|
@ -513,7 +525,7 @@ class Main(object):
|
||||||
italicAngle = font.lib.get(italicAngleKey)
|
italicAngle = font.lib.get(italicAngleKey)
|
||||||
if italicAngle != None:
|
if italicAngle != None:
|
||||||
italicAngle = float(italicAngle)
|
italicAngle = float(italicAngle)
|
||||||
del font.lib[italicAngleKey]
|
del(font.lib[italicAngleKey])
|
||||||
font.info.italicAngle = italicAngle
|
font.info.italicAngle = italicAngle
|
||||||
|
|
||||||
# clear anchors
|
# clear anchors
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ from fontTools.designspaceLib import DesignSpaceDocument
|
||||||
from .name import getFamilyName, setFullName
|
from .name import getFamilyName, setFullName
|
||||||
from .info import updateFontVersion
|
from .info import updateFontVersion
|
||||||
from .glyph import findGlyphDirectives, composedGlyphIsTrivial, decomposeGlyphs
|
from .glyph import findGlyphDirectives, composedGlyphIsTrivial, decomposeGlyphs
|
||||||
|
from .stat import rebuildStatTable
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -81,6 +82,9 @@ class FontBuilder:
|
||||||
# record is still computed by fonttools, so we override it here.
|
# record is still computed by fonttools, so we override it here.
|
||||||
setFullName(font, getFamilyName(font))
|
setFullName(font, getFamilyName(font))
|
||||||
|
|
||||||
|
# rebuild STAT table to correct VF instance information
|
||||||
|
rebuildStatTable(font, designspace)
|
||||||
|
|
||||||
log.debug("writing %s", outputFilename)
|
log.debug("writing %s", outputFilename)
|
||||||
font.save(outputFilename)
|
font.save(outputFilename)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,8 @@ def updateFontVersion(font, dummy, isVF):
|
||||||
buildtag = "src"
|
buildtag = "src"
|
||||||
print("warning: getGitHash() failed: %r" % buildtagErrs, file=sys.stderr)
|
print("warning: getGitHash() failed: %r" % buildtagErrs, file=sys.stderr)
|
||||||
versionMajor, versionMinor = [int(num) for num in version.split(".")]
|
versionMajor, versionMinor = [int(num) for num in version.split(".")]
|
||||||
font.info.version = version
|
|
||||||
font.info.versionMajor = versionMajor
|
font.info.versionMajor = versionMajor
|
||||||
font.info.versionMinor = versionMinor
|
font.info.versionMinor = versionMinor
|
||||||
font.info.woffMajorVersion = versionMajor
|
|
||||||
font.info.woffMinorVersion = versionMinor
|
|
||||||
font.info.year = now.year
|
font.info.year = now.year
|
||||||
font.info.openTypeNameVersion = "Version %d.%03d;git-%s" % (versionMajor, versionMinor, buildtag)
|
font.info.openTypeNameVersion = "Version %d.%03d;git-%s" % (versionMajor, versionMinor, buildtag)
|
||||||
psFamily = re.sub(r'\s', '', font.info.familyName)
|
psFamily = re.sub(r'\s', '', font.info.familyName)
|
||||||
|
|
|
||||||
34
misc/fontbuildlib/stat.py
Normal file
34
misc/fontbuildlib/stat.py
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
# from fontTools.designspaceLib import DesignSpaceDocument
|
||||||
|
# from fontTools.ttLib.tables import otTables as ot
|
||||||
|
# from fontTools.ttLib import ttFont
|
||||||
|
from fontTools.otlLib.builder import buildStatTable
|
||||||
|
|
||||||
|
def rebuildStatTable(font, designspace):
|
||||||
|
if not 'fvar' in font:
|
||||||
|
raise Exception('missing fvar table in font')
|
||||||
|
|
||||||
|
axes = [dict(tag=a.axisTag, name=a.axisNameID) for a in font['fvar'].axes]
|
||||||
|
# axes = []
|
||||||
|
# for a in statTable.DesignAxisRecord.Axis:
|
||||||
|
# axes.append({ 'tag': a.AxisTag, 'name': a.AxisNameID, 'ordering': a.AxisOrdering })
|
||||||
|
|
||||||
|
axisNameToTag = dict()
|
||||||
|
for axis in designspace.axes:
|
||||||
|
axisNameToTag[axis.name] = axis.tag
|
||||||
|
|
||||||
|
locations = []
|
||||||
|
for instance in designspace.instances:
|
||||||
|
location = dict()
|
||||||
|
for axisName, value in instance.location.items():
|
||||||
|
tag = axisNameToTag[axisName]
|
||||||
|
location[tag] = value
|
||||||
|
locations.append({ 'name': instance.styleName, 'location': location })
|
||||||
|
|
||||||
|
buildStatTable(font, axes, locations)
|
||||||
|
|
||||||
|
|
||||||
|
# font = ttFont.TTFont("build/fonts/var/Inter.var.ttf")
|
||||||
|
# designspace = DesignSpaceDocument.fromfile('build/ufo/inter.designspace')
|
||||||
|
# rebuildStatTable(font, designspace)
|
||||||
|
# print("write build/tmp/Inter.var-patched.ttf")
|
||||||
|
# font.save("build/tmp/Inter.var-patched.ttf")
|
||||||
|
|
@ -24,11 +24,11 @@ if $CLEAN; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# compile multi-axis variable font
|
# compile multi-axis variable font
|
||||||
make build/fonts/var/Inter.var.otf
|
make build/fonts/var/Inter.var.ttf
|
||||||
|
|
||||||
# change file type to TTF and change style names to Google Fonts standard.
|
# change file type to TTF and change style names to Google Fonts standard.
|
||||||
rm -rf build/googlefonts
|
rm -rf build/googlefonts
|
||||||
mkdir -p build/googlefonts
|
mkdir -p build/googlefonts
|
||||||
misc/fontbuild rename --google-style \
|
misc/fontbuild rename --google-style \
|
||||||
build/fonts/var/Inter.var.otf \
|
build/fonts/var/Inter.var.ttf \
|
||||||
-o build/googlefonts/Inter.var.ttf
|
-o build/googlefonts/Inter.var.ttf
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ mkdir -p \
|
||||||
if $OPT_TEXT; then
|
if $OPT_TEXT; then
|
||||||
# Inter Desktop
|
# Inter Desktop
|
||||||
cp $FONTDIR/const/Inter-*.otf "$ZIPDIR/Inter Desktop/" &
|
cp $FONTDIR/const/Inter-*.otf "$ZIPDIR/Inter Desktop/" &
|
||||||
cp $FONTDIR/var/Inter-V.var.otf "$ZIPDIR/Inter Desktop/Inter-V.otf" &
|
cp $FONTDIR/var/Inter-V.var.ttf "$ZIPDIR/Inter Desktop/Inter-V.ttf" &
|
||||||
|
|
||||||
# Inter Hinted for Windows
|
# Inter Hinted for Windows
|
||||||
cp "misc/dist/about hinted fonts.txt" "$ZIPDIR/Inter Hinted for Windows/" &
|
cp "misc/dist/about hinted fonts.txt" "$ZIPDIR/Inter Hinted for Windows/" &
|
||||||
|
|
@ -98,9 +98,9 @@ if $OPT_TEXT; then
|
||||||
cp misc/dist/inter.css "$ZIPDIR/Inter Hinted for Windows/Web/" &
|
cp misc/dist/inter.css "$ZIPDIR/Inter Hinted for Windows/Web/" &
|
||||||
|
|
||||||
# Inter Variable
|
# Inter Variable
|
||||||
cp $FONTDIR/var/Inter.var.otf "$ZIPDIR/Inter Variable/Inter.otf" &
|
cp $FONTDIR/var/Inter.var.ttf "$ZIPDIR/Inter Variable/Inter.ttf" &
|
||||||
cp $FONTDIR/var/Inter-roman.var.otf "$ZIPDIR/Inter Variable/Single axis/Inter-roman.otf" &
|
cp $FONTDIR/var/Inter-roman.var.ttf "$ZIPDIR/Inter Variable/Single axis/Inter-roman.ttf" &
|
||||||
cp $FONTDIR/var/Inter-italic.var.otf "$ZIPDIR/Inter Variable/Single axis/Inter-italic.otf" &
|
cp $FONTDIR/var/Inter-italic.var.ttf "$ZIPDIR/Inter Variable/Single axis/Inter-italic.ttf" &
|
||||||
|
|
||||||
# Inter Web
|
# Inter Web
|
||||||
cp $FONTDIR/const/Inter-*.woff* "$ZIPDIR/Inter Web/" &
|
cp $FONTDIR/const/Inter-*.woff* "$ZIPDIR/Inter Web/" &
|
||||||
|
|
@ -113,7 +113,7 @@ fi
|
||||||
if $OPT_DISPLAY; then
|
if $OPT_DISPLAY; then
|
||||||
# Inter Desktop
|
# Inter Desktop
|
||||||
cp $FONTDIR/const/InterDisplay-*.otf "$ZIPDIR/Inter Desktop/" &
|
cp $FONTDIR/const/InterDisplay-*.otf "$ZIPDIR/Inter Desktop/" &
|
||||||
cp $FONTDIR/var/InterDisplay-V.var.otf "$ZIPDIR/Inter Desktop/InterDisplay-V.otf" &
|
cp $FONTDIR/var/InterDisplay-V.var.ttf "$ZIPDIR/Inter Desktop/InterDisplay-V.ttf" &
|
||||||
|
|
||||||
# Inter Hinted for Windows
|
# Inter Hinted for Windows
|
||||||
cp "misc/dist/about hinted fonts.txt" "$ZIPDIR/Inter Hinted for Windows/" &
|
cp "misc/dist/about hinted fonts.txt" "$ZIPDIR/Inter Hinted for Windows/" &
|
||||||
|
|
@ -122,9 +122,9 @@ if $OPT_DISPLAY; then
|
||||||
cp misc/dist/inter-display.css "$ZIPDIR/Inter Hinted for Windows/Web/" &
|
cp misc/dist/inter-display.css "$ZIPDIR/Inter Hinted for Windows/Web/" &
|
||||||
|
|
||||||
# Inter Variable
|
# Inter Variable
|
||||||
cp $FONTDIR/var/InterDisplay.var.otf "$ZIPDIR/Inter Variable/InterDisplay.otf" &
|
cp $FONTDIR/var/InterDisplay.var.ttf "$ZIPDIR/Inter Variable/InterDisplay.ttf" &
|
||||||
cp $FONTDIR/var/InterDisplay-roman.var.otf "$ZIPDIR/Inter Variable/Single axis/InterDisplay-roman.otf" &
|
cp $FONTDIR/var/InterDisplay-roman.var.ttf "$ZIPDIR/Inter Variable/Single axis/InterDisplay-roman.ttf" &
|
||||||
cp $FONTDIR/var/InterDisplay-italic.var.otf "$ZIPDIR/Inter Variable/Single axis/InterDisplay-italic.otf" &
|
cp $FONTDIR/var/InterDisplay-italic.var.ttf "$ZIPDIR/Inter Variable/Single axis/InterDisplay-italic.ttf" &
|
||||||
|
|
||||||
# Inter Web
|
# Inter Web
|
||||||
cp $FONTDIR/const/InterDisplay-*.woff* "$ZIPDIR/Inter Web/" &
|
cp $FONTDIR/const/InterDisplay-*.woff* "$ZIPDIR/Inter Web/" &
|
||||||
|
|
|
||||||
|
|
@ -145,4 +145,4 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
# Similar to:
|
# Similar to:
|
||||||
# ttx -i -e -o ./build/tmp/var.ttx ./build/fonts/var/Inter.var.ttf
|
# ttx -i -e -o ./build/tmp/var.ttx ./build/fonts/var/Inter.var.ttf
|
||||||
# ttx -b --no-recalc-timestamp -o ./build/tmp/var.otf ./build/tmp/var.ttx
|
# ttx -b --no-recalc-timestamp -o ./build/tmp/var.ttf ./build/tmp/var.ttx
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
fonttools[lxml,unicode,ufo]==4.0.2
|
fonttools[lxml,unicode,ufo]==4.13.0
|
||||||
cu2qu==1.6.6
|
cu2qu==1.6.7
|
||||||
glyphsLib==5.0.1
|
glyphsLib==5.1.11
|
||||||
ufo2ft[pathops]==2.9.1
|
ufo2ft[pathops]==2.15.0
|
||||||
defcon[lxml]==0.6.0
|
defcon[lxml]==0.7.2
|
||||||
skia-pathops==0.2.0.post2
|
skia-pathops==0.4.1
|
||||||
|
|
||||||
# only used for DesignSpaceDocumentReader in fontbuild
|
# only used for DesignSpaceDocumentReader in fontbuild
|
||||||
MutatorMath==2.1.2
|
MutatorMath==2.1.2
|
||||||
|
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.0">
|
|
||||||
<!-- merged into font at build time -->
|
|
||||||
<STAT>
|
|
||||||
<Version value="0x00010001"/>
|
|
||||||
<!-- <DesignAxisRecordSize value="8"/>
|
|
||||||
<DesignAxisRecord>
|
|
||||||
<Axis index="0">
|
|
||||||
<AxisTag value="wght"/>
|
|
||||||
<AxisNameID value="271"/>
|
|
||||||
<AxisOrdering value="0"/>
|
|
||||||
</Axis>
|
|
||||||
<Axis index="1">
|
|
||||||
<AxisTag value="slnt"/>
|
|
||||||
<AxisNameID value="272"/>
|
|
||||||
<AxisOrdering value="1"/>
|
|
||||||
</Axis>
|
|
||||||
</DesignAxisRecord> -->
|
|
||||||
<!-- AxisValueCount=11 -->
|
|
||||||
<AxisValueArray>
|
|
||||||
<AxisValue index="0" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="273"/> <!-- Thin -->
|
|
||||||
<Value value="100.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="1" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="275"/> <!-- Extra Light -->
|
|
||||||
<Value value="200.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="2" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="277"/> <!-- Light -->
|
|
||||||
<Value value="300.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="3" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="2"/>
|
|
||||||
<ValueNameID value="279"/> <!-- Regular -->
|
|
||||||
<Value value="400.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="4" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="281"/> <!-- Medium -->
|
|
||||||
<Value value="500.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="5" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="283"/> <!-- Semi Bold -->
|
|
||||||
<Value value="600.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="6" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="285"/> <!-- Bold -->
|
|
||||||
<Value value="700.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="7" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="287"/> <!-- Extra Bold -->
|
|
||||||
<Value value="800.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="8" Format="1">
|
|
||||||
<AxisIndex value="0"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="289"/> <!-- Black -->
|
|
||||||
<Value value="900.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="9" Format="1">
|
|
||||||
<AxisIndex value="1"/>
|
|
||||||
<Flags value="2"/>
|
|
||||||
<ValueNameID value="279"/> <!-- Regular -->
|
|
||||||
<Value value="0.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
<AxisValue index="10" Format="1">
|
|
||||||
<AxisIndex value="1"/>
|
|
||||||
<Flags value="0"/>
|
|
||||||
<ValueNameID value="280"/> <!-- Italic -->
|
|
||||||
<Value value="-10.0"/>
|
|
||||||
</AxisValue>
|
|
||||||
</AxisValueArray>
|
|
||||||
<ElidedFallbackNameID value="2"/> <!-- Regular -->
|
|
||||||
</STAT>
|
|
||||||
|
|
||||||
</ttFont>
|
|
||||||
Reference in a new issue