1
1
mirror of https://github.com/rsms/inter.git synced 2024-09-11 10:55:24 +03:00

UPM 2048 and opsz axis (#462)

- UPM is adjusted to 2048
- Additional opsz VF axis (multi master) added which will eventually replace the separate Display family
- New tooling that uses fontmake instead of Inter's own fontbuild toolchain. (The old toolchain is still supported, i.e. `make -f Makefile_v1.make ...`)
This commit is contained in:
Rasmus 2022-05-26 11:20:06 -07:00 committed by GitHub
parent 633839ad55
commit 0796076659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 368192 additions and 287323 deletions

829
Makefile
View File

@ -1,239 +1,274 @@
# To list all targets: # List all targets with 'make list'
# make list SRCDIR := $(abspath $(lastword $(MAKEFILE_LIST))/..)
# FONTDIR := build/fonts
# High-level make targets: UFODIR := build/ufo
# text Build all Inter Text fonts (default target) BIN := $(SRCDIR)/build/venv/bin
# display Build all Inter Display fonts VERSION := $(shell cat version.txt)
# all Build everything MAKEFILE := $(lastword $(MAKEFILE_LIST))
# web Build all web fonts
# var Build all variable fonts
# test Run all test (builds fonts if needed)
# zip Build a complete ZIP archive of all fonts
# zip_text Build a complete ZIP archive of all Inter Text fonts
# zip_display Build a complete ZIP archive of all Inter Display fonts
# install Build and install all OTF files (macOS only)
#
# Style-specific targets:
# STYLE_otf Build OTF file for STYLE into FONTDIR/const
# STYLE_ttf Build TTF file for STYLE into FONTDIR/const
# STYLE_ttf_hinted Build TTF file for STYLE with hints into
# FONTDIR/const-hinted
# STYLE_web Build WOFF files for STYLE into FONTDIR/const
# STYLE_web_hinted Build WOFF files for STYLE with hints into
# FONTDIR/const-hinted
# STYLE_check Build & check OTF and TTF files for STYLE
#
# "build" directory output structure:
# fonts
# const
# const-hinted
# var
#
FONTDIR = build/fonts
default: text
all: text display
# all fonts of given variant
text: all_otf_text all_ttf_text all_ttf_text_hinted all_var_text web_text
display: all_otf_display all_ttf_display all_ttf_display_hinted all_var_display web_display
# all fonts of a certain type
all_otf: all_otf_text all_otf_display
all_ttf: all_ttf_text all_ttf_display all_ttf_text_hinted all_ttf_display_hinted
web: web_text web_display
web_text: all_web_text all_web_hinted_text
web_display: all_web_display all_web_hinted_display
var: all_var_text all_var_display
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.ttf $(FONTDIR)/var/InterDisplay-V.var.ttf
all_var_text: \
$(FONTDIR)/var/Inter.var.ttf \
$(FONTDIR)/var/Inter.var.woff2 \
$(FONTDIR)/var/Inter-V.var.ttf \
$(FONTDIR)/var/Inter-V.var.woff2 \
$(FONTDIR)/var/Inter-roman.var.ttf \
$(FONTDIR)/var/Inter-roman.var.woff2 \
$(FONTDIR)/var/Inter-italic.var.ttf \
$(FONTDIR)/var/Inter-italic.var.woff2
all_var_display: \
$(FONTDIR)/var/InterDisplay.var.ttf \
$(FONTDIR)/var/InterDisplay.var.woff2 \
$(FONTDIR)/var/InterDisplay-V.var.ttf \
$(FONTDIR)/var/InterDisplay-V.var.woff2 \
$(FONTDIR)/var/InterDisplay-roman.var.ttf \
$(FONTDIR)/var/InterDisplay-roman.var.woff2 \
$(FONTDIR)/var/InterDisplay-italic.var.ttf \
$(FONTDIR)/var/InterDisplay-italic.var.woff2
.PHONY: all all_otf all_ttf text display
.PHONY: web web_text web_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
# all_var_hinted: $(FONTDIR)/var-hinted/Inter.var.ttf $(FONTDIR)/var-hinted/Inter.var.woff2
BIN := $(PWD)/build/venv/bin
export PATH := $(BIN):$(PATH) export PATH := $(BIN):$(PATH)
# list make targets default: all
# We copy the Makefile (first in MAKEFILE_LIST) and disable the include to only list
# primary targets, avoiding the generated targets.
.PHONY: list list_all
list:
@mkdir -p build/etc \
&& cat $(firstword $(MAKEFILE_LIST)) \
| sed 's/include /#include /g' > build/etc/Makefile-list \
&& $(MAKE) -pRrq -f build/etc/Makefile-list : 2>/dev/null \
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
| sort \
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
# list_all is like list, but includes generated targets
list_all:
@$(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null \
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
| sort \
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
# generated.make is automatically generated by init.sh and defines depenencies for
# all styles and alias targets
include build/etc/generated.make
# WOFF2 from TTF
build/%.woff2: build/%.ttf
$(BIN)/woff2_compress "$<"
# WOFF from TTF
build/%.woff: build/%.ttf
$(BIN)/ttf2woff -O -t woff "$<" "$@"
# VF OTF from UFO
$(FONTDIR)/var/Inter.var.ttf: $(all_ufo_masters_text) version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter.designspace
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(BIN)/gftools fix-dsig --autofix $@
$(FONTDIR)/var/Inter-V.var.ttf: $(FONTDIR)/var/Inter.var.ttf
misc/fontbuild rename --family "Inter V" -o $@ $<
$(FONTDIR)/var/Inter-%.var.ttf: build/ufo/Inter-%.designspace $(all_ufo_masters_text) version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
misc/tools/fix-vf-meta.py $@
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(BIN)/gftools fix-dsig --autofix $@
$(FONTDIR)/var/InterDisplay.var.ttf: $(all_ufo_masters_display) version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/InterDisplay.designspace
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(BIN)/gftools fix-dsig --autofix $@
$(FONTDIR)/var/InterDisplay-V.var.ttf: $(FONTDIR)/var/InterDisplay.var.ttf
misc/fontbuild rename --family "Inter Display V" -o $@ $<
$(FONTDIR)/var/InterDisplay-%.var.ttf: build/ufo/InterDisplay-%.designspace $(all_ufo_masters_display) version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
misc/tools/fix-vf-meta.py $@
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(BIN)/gftools fix-dsig --autofix $@
# OTF/TTF from UFO
$(FONTDIR)/const/Inter%.otf: build/ufo/Inter%.ufo version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter$*.ufo
$(FONTDIR)/const/Inter%.ttf: build/ufo/Inter%.ufo version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter$*.ufo
# DESIGNSPACE from GLYPHS
build/ufo/Inter-roman.designspace: build/ufo/Inter.designspace
build/ufo/Inter-italic.designspace: build/ufo/Inter.designspace
build/ufo/Inter.designspace: src/Inter.glyphs
@mkdir -p build/ufo
misc/fontbuild glyphsync -o build/ufo src/Inter.glyphs
build/ufo/InterDisplay-roman.designspace: build/ufo/InterDisplay.designspace
build/ufo/InterDisplay-italic.designspace: build/ufo/InterDisplay.designspace
build/ufo/InterDisplay.designspace: src/InterDisplay.glyphs
@mkdir -p build/ufo
misc/fontbuild glyphsync -o build/ufo src/InterDisplay.glyphs
# ---------------------------------------------------------------------------------
# intermediate sources
# short-circuit Make for performance # short-circuit Make for performance
src/Inter.glyphs: src/Inter.glyphs:
@true @true
src/InterDisplay.glyphs:
@true
# make sure intermediate files are not gc'd by make
.PRECIOUS: build/ufo/Inter-*.designspace build/ufo/InterDisplay-*.designspace
designspace: build/ufo/Inter.designspace build/ufo/InterDisplay.designspace
.PHONY: designspace
# features # features
src/features: $(wildcard src/features/*) src/features: $(wildcard src/features/*)
@touch "$@" @touch "$@"
@true @true
build/ufo/features: src/features $(UFODIR)/features: src/features
@mkdir -p build/ufo @mkdir -p $(UFODIR)
@rm -f build/ufo/features @ln -sf ../../src/features $(UFODIR)/features
@ln -s ../../src/features build/ufo/features
# make sure intermediate UFOs are not gc'd by make # designspace
.PRECIOUS: build/ufo/Inter-%.ufo $(UFODIR)/Inter-roman.designspace: $(UFODIR)/Inter.designspace
$(BIN)/python3 misc/tools/subset-designspace.py $^ $@
$(UFODIR)/Inter-italic.designspace: $(UFODIR)/Inter.designspace
$(BIN)/python3 misc/tools/subset-designspace.py $^ $@
$(UFODIR)/%.designspace: src/%.glyphs $(UFODIR)/features
$(BIN)/fontmake -o ufo -g $< --designspace-path $@ \
--master-dir $(UFODIR) --instance-dir $(UFODIR)
$(BIN)/python3 misc/tools/postprocess-designspace.py $@
# Note: The seemingly convoluted dependency graph above is required to # master UFOs are byproducts of building Inter.designspace
# make sure that glyphsync and instancegen are not run in parallel. $(UFODIR)/Inter-Black.ufo: $(UFODIR)/Inter.designspace
touch $@
$(UFODIR)/Inter-BlackItalic.ufo: $(UFODIR)/Inter.designspace
touch $@
$(UFODIR)/Inter-Regular.ufo: $(UFODIR)/Inter.designspace
touch $@
$(UFODIR)/Inter-Italic.ufo: $(UFODIR)/Inter.designspace
touch $@
$(UFODIR)/Inter-Thin.ufo: $(UFODIR)/Inter.designspace
touch $@
$(UFODIR)/Inter-ThinItalic.ufo: $(UFODIR)/Inter.designspace
touch $@
# instance UFOs are generated on demand
$(UFODIR)/Inter-Light.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Light"
$(UFODIR)/Inter-LightItalic.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Light Italic"
$(UFODIR)/Inter-ExtraLight.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Extra Light"
$(UFODIR)/Inter-ExtraLightItalic.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Extra Light Italic"
$(UFODIR)/Inter-Medium.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Medium"
$(UFODIR)/Inter-MediumItalic.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Medium Italic"
$(UFODIR)/Inter-SemiBold.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Semi Bold"
$(UFODIR)/Inter-SemiBoldItalic.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Semi Bold Italic"
$(UFODIR)/Inter-Bold.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Bold"
$(UFODIR)/Inter-BoldItalic.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Bold Italic"
$(UFODIR)/Inter-ExtraBold.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Extra Bold"
$(UFODIR)/Inter-ExtraBoldItalic.ufo: $(UFODIR)/Inter.designspace
$(BIN)/fontmake -o ufo -m $< --output-path $@ -i "Inter Extra Bold Italic"
# hinted TTF files via autohint # make sure intermediate files are not gc'd by make
$(FONTDIR)/const-hinted/%.ttf: $(FONTDIR)/const/%.ttf .PRECIOUS: \
mkdir -p "$(dir $@)" $(UFODIR)/Inter-Black.ufo \
$(BIN)/ttfautohint --windows-compatibility --adjust-subglyphs --no-info "$<" "$@" $(UFODIR)/Inter-BlackItalic.ufo \
$(UFODIR)/Inter-Regular.ufo \
$(UFODIR)/Inter-Italic.ufo \
$(UFODIR)/Inter-Thin.ufo \
$(UFODIR)/Inter-ThinItalic.ufo \
$(UFODIR)/Inter-Light.ufo \
$(UFODIR)/Inter-LightItalic.ufo \
$(UFODIR)/Inter-ExtraLight.ufo \
$(UFODIR)/Inter-ExtraLightItalic.ufo \
$(UFODIR)/Inter-Medium.ufo \
$(UFODIR)/Inter-MediumItalic.ufo \
$(UFODIR)/Inter-SemiBold.ufo \
$(UFODIR)/Inter-SemiBoldItalic.ufo \
$(UFODIR)/Inter-Bold.ufo \
$(UFODIR)/Inter-BoldItalic.ufo \
$(UFODIR)/Inter-ExtraBold.ufo \
$(UFODIR)/Inter-ExtraBoldItalic.ufo \
$(UFODIR)/Inter.designspace \
$(UFODIR)/Inter-roman.designspace \
$(UFODIR)/Inter-italic.designspace
# python -m ttfautohint --fallback-stem-width=256 --no-info "$<" "$@" # ---------------------------------------------------------------------------------
# products
$(FONTDIR)/static/%.otf: $(UFODIR)/%.ufo | $(FONTDIR)/static
$(BIN)/fontmake -u $< -o otf --output-path $@ \
--overlaps-backend pathops --production-names
$(FONTDIR)/static/%.ttf: $(UFODIR)/%.ufo | $(FONTDIR)/static
$(BIN)/fontmake -u $< -o ttf --output-path $@ \
--overlaps-backend pathops --production-names
$(FONTDIR)/static-hinted/%.ttf: $(FONTDIR)/static/%.ttf | $(FONTDIR)/static-hinted
$(BIN)/python3 $(PWD)/build/venv/lib/python/site-packages/ttfautohint \
--no-info "$<" "$@"
$(FONTDIR)/var/Inter-V.var.ttf: $(FONTDIR)/var/Inter.var.ttf
$(BIN)/python3 misc/tools/rename.py --family "Inter V" -o $@ $<
$(FONTDIR)/var/%.var.ttf: $(UFODIR)/%.designspace | $(FONTDIR)/var
$(BIN)/fontmake -o variable -m $< --output-path $@ \
--overlaps-backend pathops --production-names
$(BIN)/python3 misc/tools/postprocess-vf.py $@
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(FONTDIR)/var/%.var.otf: $(UFODIR)/%.designspace | $(FONTDIR)/var
$(BIN)/fontmake -o variable-cff2 -m $< --output-path $@ \
--overlaps-backend pathops --production-names
# $(FONTDIR)/var-hinted/%.ttf: $(FONTDIR)/var/%.ttf # $(FONTDIR)/var-hinted/%.ttf: $(FONTDIR)/var/%.ttf
# mkdir -p "$(dir $@)" # mkdir -p "$(dir $@)"
# ttfautohint --fallback-stem-width=256 --no-info "$<" "$@" # $(BIN)/python3 $(PWD)/build/venv/lib/python/site-packages/ttfautohint \
# --no-info "$<" "$@"
# make sure intermediate TTFs are not gc'd by make
.PRECIOUS: $(FONTDIR)/const/%.ttf
.PRECIOUS: $(FONTDIR)/const/%.otf
.PRECIOUS: $(FONTDIR)/const-hinted/%.ttf
.PRECIOUS: $(FONTDIR)/var/%.var.ttf
%.woff2: %.ttf
$(BIN)/woff2_compress "$<"
# test runs all tests $(FONTDIR)/static:
# Note: all_check_const is generated by init.sh and runs "fontbuild checkfont" mkdir -p $@
# on all otf and ttf files. $(FONTDIR)/static-hinted:
test: test_text test_display mkdir -p $@
$(FONTDIR)/var:
mkdir -p $@
test_text: check_text \ static_otf: \
build/fbreport-text-const.txt \ $(FONTDIR)/static/Inter-Black.otf \
build/fbreport-text-var1.txt \ $(FONTDIR)/static/Inter-BlackItalic.otf \
build/fbreport-text-var2.txt $(FONTDIR)/static/Inter-Regular.otf \
@echo "$(@): OK" $(FONTDIR)/static/Inter-Italic.otf \
$(FONTDIR)/static/Inter-Thin.otf \
$(FONTDIR)/static/Inter-ThinItalic.otf \
$(FONTDIR)/static/Inter-Light.otf \
$(FONTDIR)/static/Inter-LightItalic.otf \
$(FONTDIR)/static/Inter-ExtraLight.otf \
$(FONTDIR)/static/Inter-ExtraLightItalic.otf \
$(FONTDIR)/static/Inter-Medium.otf \
$(FONTDIR)/static/Inter-MediumItalic.otf \
$(FONTDIR)/static/Inter-SemiBold.otf \
$(FONTDIR)/static/Inter-SemiBoldItalic.otf \
$(FONTDIR)/static/Inter-Bold.otf \
$(FONTDIR)/static/Inter-BoldItalic.otf \
$(FONTDIR)/static/Inter-ExtraBold.otf \
$(FONTDIR)/static/Inter-ExtraBoldItalic.otf
test_display: check_display \ static_ttf: \
build/fbreport-display-const.txt \ $(FONTDIR)/static/Inter-Black.ttf \
build/fbreport-display-var1.txt \ $(FONTDIR)/static/Inter-BlackItalic.ttf \
build/fbreport-display-var2.txt $(FONTDIR)/static/Inter-Regular.ttf \
@echo "$(@): OK" $(FONTDIR)/static/Inter-Italic.ttf \
$(FONTDIR)/static/Inter-Thin.ttf \
$(FONTDIR)/static/Inter-ThinItalic.ttf \
$(FONTDIR)/static/Inter-Light.ttf \
$(FONTDIR)/static/Inter-LightItalic.ttf \
$(FONTDIR)/static/Inter-ExtraLight.ttf \
$(FONTDIR)/static/Inter-ExtraLightItalic.ttf \
$(FONTDIR)/static/Inter-Medium.ttf \
$(FONTDIR)/static/Inter-MediumItalic.ttf \
$(FONTDIR)/static/Inter-SemiBold.ttf \
$(FONTDIR)/static/Inter-SemiBoldItalic.ttf \
$(FONTDIR)/static/Inter-Bold.ttf \
$(FONTDIR)/static/Inter-BoldItalic.ttf \
$(FONTDIR)/static/Inter-ExtraBold.ttf \
$(FONTDIR)/static/Inter-ExtraBoldItalic.ttf
static_ttf_hinted: \
$(FONTDIR)/static-hinted/Inter-Black.ttf \
$(FONTDIR)/static-hinted/Inter-BlackItalic.ttf \
$(FONTDIR)/static-hinted/Inter-Regular.ttf \
$(FONTDIR)/static-hinted/Inter-Italic.ttf \
$(FONTDIR)/static-hinted/Inter-Thin.ttf \
$(FONTDIR)/static-hinted/Inter-ThinItalic.ttf \
$(FONTDIR)/static-hinted/Inter-Light.ttf \
$(FONTDIR)/static-hinted/Inter-LightItalic.ttf \
$(FONTDIR)/static-hinted/Inter-ExtraLight.ttf \
$(FONTDIR)/static-hinted/Inter-ExtraLightItalic.ttf \
$(FONTDIR)/static-hinted/Inter-Medium.ttf \
$(FONTDIR)/static-hinted/Inter-MediumItalic.ttf \
$(FONTDIR)/static-hinted/Inter-SemiBold.ttf \
$(FONTDIR)/static-hinted/Inter-SemiBoldItalic.ttf \
$(FONTDIR)/static-hinted/Inter-Bold.ttf \
$(FONTDIR)/static-hinted/Inter-BoldItalic.ttf \
$(FONTDIR)/static-hinted/Inter-ExtraBold.ttf \
$(FONTDIR)/static-hinted/Inter-ExtraBoldItalic.ttf
static_web: \
$(FONTDIR)/static/Inter-Black.woff2 \
$(FONTDIR)/static/Inter-BlackItalic.woff2 \
$(FONTDIR)/static/Inter-Regular.woff2 \
$(FONTDIR)/static/Inter-Italic.woff2 \
$(FONTDIR)/static/Inter-Thin.woff2 \
$(FONTDIR)/static/Inter-ThinItalic.woff2 \
$(FONTDIR)/static/Inter-Light.woff2 \
$(FONTDIR)/static/Inter-LightItalic.woff2 \
$(FONTDIR)/static/Inter-ExtraLight.woff2 \
$(FONTDIR)/static/Inter-ExtraLightItalic.woff2 \
$(FONTDIR)/static/Inter-Medium.woff2 \
$(FONTDIR)/static/Inter-MediumItalic.woff2 \
$(FONTDIR)/static/Inter-SemiBold.woff2 \
$(FONTDIR)/static/Inter-SemiBoldItalic.woff2 \
$(FONTDIR)/static/Inter-Bold.woff2 \
$(FONTDIR)/static/Inter-BoldItalic.woff2 \
$(FONTDIR)/static/Inter-ExtraBold.woff2 \
$(FONTDIR)/static/Inter-ExtraBoldItalic.woff2
static_web_hinted: \
$(FONTDIR)/static-hinted/Inter-Black.woff2 \
$(FONTDIR)/static-hinted/Inter-BlackItalic.woff2 \
$(FONTDIR)/static-hinted/Inter-Regular.woff2 \
$(FONTDIR)/static-hinted/Inter-Italic.woff2 \
$(FONTDIR)/static-hinted/Inter-Thin.woff2 \
$(FONTDIR)/static-hinted/Inter-ThinItalic.woff2 \
$(FONTDIR)/static-hinted/Inter-Light.woff2 \
$(FONTDIR)/static-hinted/Inter-LightItalic.woff2 \
$(FONTDIR)/static-hinted/Inter-ExtraLight.woff2 \
$(FONTDIR)/static-hinted/Inter-ExtraLightItalic.woff2 \
$(FONTDIR)/static-hinted/Inter-Medium.woff2 \
$(FONTDIR)/static-hinted/Inter-MediumItalic.woff2 \
$(FONTDIR)/static-hinted/Inter-SemiBold.woff2 \
$(FONTDIR)/static-hinted/Inter-SemiBoldItalic.woff2 \
$(FONTDIR)/static-hinted/Inter-Bold.woff2 \
$(FONTDIR)/static-hinted/Inter-BoldItalic.woff2 \
$(FONTDIR)/static-hinted/Inter-ExtraBold.woff2 \
$(FONTDIR)/static-hinted/Inter-ExtraBoldItalic.woff2
var: \
$(FONTDIR)/var/Inter.var.ttf \
$(FONTDIR)/var/Inter-V.var.ttf
var_no_slnt_axis: \
$(FONTDIR)/var/Inter-roman.var.ttf \
$(FONTDIR)/var/Inter-italic.var.ttf
$(BIN)/python3 misc/tools/postprocess-single-axis-vfs.py $^
var_web: \
$(FONTDIR)/var/Inter.var.woff2 \
$(FONTDIR)/var/Inter-V.var.woff2 \
$(FONTDIR)/var/Inter-roman.var.woff2 \
$(FONTDIR)/var/Inter-italic.var.woff2
all: static_otf static_ttf static_ttf_hinted static_web static_web_hinted \
var var_web var_no_slnt_axis
.PHONY: all static_otf static_ttf static_ttf_hinted static_web static_web_hinted \
var var_web var_no_slnt_axis
# ---------------------------------------------------------------------------------
# testing
test: build/fontbakery-report-var.txt \
build/fontbakery-report-static.txt
# FBAKE_ARGS are common args for all fontbakery targets # FBAKE_ARGS are common args for all fontbakery targets
FBAKE_ARGS := check-universal \ FBAKE_ARGS := check-universal \
@ -241,299 +276,165 @@ FBAKE_ARGS := check-universal \
--no-progress \ --no-progress \
--loglevel WARN \ --loglevel WARN \
--succinct \ --succinct \
--full-lists \
-j \ -j \
-x com.google.fonts/check/dsig \ -x com.google.fonts/check/family/win_ascent_and_descent
-x com.google.fonts/check/unitsperem \
-x com.google.fonts/check/family/win_ascent_and_descent \
-x com.google.fonts/check/fontbakery_version
FBAKE_STATIC_ARGS := $(FBAKE_ARGS) -x com.google.fonts/check/family/underline_thickness build/fontbakery-report-var.txt: $(FONTDIR)/var/Inter.var.ttf
FBAKE_VAR_ARGS := $(FBAKE_ARGS) -x com.google.fonts/check/STAT_strings @echo "fontbakery Inter.var.ttf > $(@) ..."
@$(BIN)/fontbakery \
$(FBAKE_ARGS) -x com.google.fonts/check/STAT_strings \
$^ > $@ \
|| (cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
# static text family build/fontbakery-report-static.txt: $(wildcard $(FONTDIR)/static/Inter-*.otf)
build/fbreport-text-const.txt: $(wildcard $(FONTDIR)/const/Inter-*.otf) @echo "fontbakery static/Inter-*.otf > $(@) ..."
@echo "fontbakery check-universal Inter-*.otf > $(@) ..." @$(BIN)/fontbakery \
@$(BIN)/fontbakery $(FBAKE_STATIC_ARGS) $^ > $@ || \ $(FBAKE_ARGS) -x com.google.fonts/check/family/underline_thickness \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1) $^ > $@ \
@echo "fontbakery check-universal Inter-*.otf OK" || (cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
# multi-axis VF text family .PHONY: test
build/fbreport-text-var2.txt: $(FONTDIR)/var/Inter.var.ttf
@echo "fontbakery check-universal Inter.var.ttf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_VAR_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal Inter.var.ttf"
# single-axis VF text family # ---------------------------------------------------------------------------------
build/fbreport-text-var1.txt: $(wildcard $(FONTDIR)/var/Inter-*.var.ttf) # zip
@echo "fontbakery check-universal Inter-*.var.ttf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_VAR_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal Inter-*.var.ttf"
# static display family
build/fbreport-display-const.txt: $(wildcard $(FONTDIR)/const/InterDisplay-*.otf)
@echo "fontbakery check-universal InterDisplay-*.otf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_STATIC_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal InterDisplay-*.otf"
# multi-axis VF display family
build/fbreport-display-var2.txt: $(FONTDIR)/var/InterDisplay.var.ttf
@echo "fontbakery check-universal InterDisplay.var.ttf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_VAR_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal InterDisplay.var.ttf"
# single-axis VF display family
build/fbreport-display-var1.txt: $(wildcard $(FONTDIR)/var/InterDisplay-*.var.ttf)
@echo "fontbakery check-universal InterDisplay-*.var.ttf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_VAR_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal InterDisplay-*.var.ttf"
# check does the same thing as test, but without any dependency checks, meaning
# it will check whatever font files are already built.
check_text: $(wildcard $(FONTDIR)/const/Inter-*.ttf) \
$(wildcard $(FONTDIR)/const/Inter-*.otf) \
$(wildcard $(FONTDIR)/const/Inter-*.woff2) \
$(wildcard $(FONTDIR)/var/Inter-*.var.ttf) \
$(wildcard $(FONTDIR)/var/Inter-*.var.woff2) \
$(FONTDIR)/var/Inter.var.ttf \
$(FONTDIR)/var/Inter.var.woff2
misc/fontbuild checkfont $^
@echo "$(@): OK"
check_display: $(wildcard $(FONTDIR)/const/InterDisplay-*.ttf) \
$(wildcard $(FONTDIR)/const/InterDisplay-*.otf) \
$(wildcard $(FONTDIR)/const/InterDisplay-*.woff2) \
$(wildcard $(FONTDIR)/var/InterDisplay-*.var.ttf) \
$(wildcard $(FONTDIR)/var/InterDisplay-*.var.woff2) \
$(FONTDIR)/var/InterDisplay.var.ttf \
$(FONTDIR)/var/InterDisplay.var.woff2
misc/fontbuild checkfont $^
@echo "$(@): OK"
check_pedantic: $(FONTDIR)/var/Inter.var.ttf
$(BIN)/fontbakery check-universal --dark-theme --loglevel WARN -j \
-x com.google.fonts/check/unitsperem \
$^
.PHONY: test test_text test_display check_text check_display check_pedantic
# samples renders PDF and PNG samples
samples: $(FONTDIR)/samples all_samples_pdf all_samples_png
$(FONTDIR)/samples/%.pdf: $(FONTDIR)/const/%.otf $(FONTDIR)/samples
misc/tools/fontsample/fontsample -o "$@" "$<"
$(FONTDIR)/samples/%.png: $(FONTDIR)/const/%.otf $(FONTDIR)/samples
misc/tools/fontsample/fontsample -o "$@" "$<"
$(FONTDIR)/samples:
mkdir -p $@
.PHONY: samples
# load version, used by zip and dist
VERSION := $(shell cat version.txt)
# distribution zip files
ZIP_FILE_DIST := build/release/Inter-${VERSION}.zip
zip: all zip: all
$(MAKE) -j8 test bash misc/makezip2.sh -reveal-in-finder \
bash misc/makezip.sh -all -reveal-in-finder \ "build/release/Inter-$(VERSION)-$(shell git rev-parse --short=10 HEAD).zip"
"build/release/Inter-${VERSION}-$(shell git rev-parse --short=10 HEAD).zip"
zip_text: text .PHONY: zip
$(MAKE) -j4 test_text
bash misc/makezip.sh -text -reveal-in-finder \
"build/release/Inter-${VERSION}-text-$(shell git rev-parse --short=10 HEAD).zip"
zip_display: display # ---------------------------------------------------------------------------------
$(MAKE) -j4 test_display # distribution
bash misc/makezip.sh -display -reveal-in-finder \ # - preflight checks for existing version archive and dirty git state.
"build/release/Inter-${VERSION}-display-$(shell git rev-parse --short=10 HEAD).zip" # - step1 rebuilds from scratch, since font version & ID is based on git hash.
# - step2 runs tests, then makes a zip archive and updates the website (docs/ dir.)
DIST_ZIP = build/release/Inter-${VERSION}.zip
dist_zip: dist_check dist_build dist: dist_preflight
$(MAKE) -j4 test_text @# rebuild since font version & ID is based on git hash
bash misc/makezip.sh -text -reveal-in-finder "$(ZIP_FILE_DIST)" $(MAKE) -f $(MAKEFILE) -j$(nproc) dist_step1
$(MAKE) -f $(MAKEFILE) -j$(nproc) dist_step2
$(MAKE) -f $(MAKEFILE) dist_postflight
dist_build: text dist_preflight:
misc/tools/versionize.py @echo "——————————————————————————————————————————————————————————————————"
dist_check:
@echo "Creating distribution for version ${VERSION}" @echo "Creating distribution for version ${VERSION}"
@if [ -f "${ZIP_FILE_DIST}" ]; then \ @echo "——————————————————————————————————————————————————————————————————"
echo "${ZIP_FILE_DIST} already exists. Bump version or remove the zip file to continue." >&2; \ @# check for existing version archive
@if [ -f "${DIST_ZIP}" ]; then \
echo "${DIST_ZIP} already exists. Bump version or rm zip file to continue." >&2; \
exit 1; \ exit 1; \
fi fi
@echo "——————————————————————————————————————————————————————————————————" @# check for uncommitted changes
@echo "" @git status --short | grep -qv '??' && (\
@echo " REMEMBER TO 'make clean' FIRST IF FONT FILES CHANGED" echo "Warning: uncommitted changes:" >&2; git status --short | grep -v '??' ;\
@echo "" [ -t 1 ] || exit 1 ; \
@echo "——————————————————————————————————————————————————————————————————" printf "Press ENTER to continue or ^C to cancel " ; read X) || true
@#
dist: dist_zip dist_step1: clean
# Note: "display" dep is here since the "docs" target loosely depends on it $(MAKE) -f $(MAKEFILE) -j$(nproc) all
$(MAKE) -j8 display
$(MAKE) -j docs dist_step2: test
$(MAKE) -f $(MAKEFILE) -j$(nproc) dist_zip dist_docs
dist_zip:
$(BIN)/python3 misc/tools/patch-version.py misc/dist/inter.css
bash misc/makezip2.sh -reveal-in-finder "$(DIST_ZIP)"
dist_docs:
$(MAKE) -C docs -j$(nproc) dist
dist_postflight:
@echo "——————————————————————————————————————————————————————————————————" @echo "——————————————————————————————————————————————————————————————————"
@echo "" @echo ""
@echo "Next steps:" @echo "Next steps:"
@echo "" @echo ""
@echo "1) Commit & push changes" @echo "1) Commit & push changes"
@echo "" @echo ""
@echo "2) Create new release with ${ZIP_FILE_DIST} at" @echo "2) Create new release with ${DIST_ZIP} at"
@echo " https://github.com/rsms/inter/releases/new?tag=v${VERSION}" @echo " https://github.com/rsms/inter/releases/new?tag=v${VERSION}"
@echo "" @echo ""
@echo "3) Bump version in version.txt (to the next future version)" @echo "3) Bump version in version.txt (to the next future version)"
@echo " and commit & push changes"
@echo "" @echo ""
@echo "——————————————————————————————————————————————————————————————————" @echo "——————————————————————————————————————————————————————————————————"
.PHONY: zip zip_dist pre_dist dist .PHONY: dist dist_preflight dist_step1 dist_step2 dist_zip dist_docs dist_postflight
# ---------------------------------------------------------------------------------
# install
docs: docs_fonts INSTALLDIR := $(HOME)/Library/Fonts/Inter
$(MAKE) -j docs_info
docs_info: docs/_data/fontinfo.json \ install: install_var \
docs/lab/glyphinfo.json \ $(INSTALLDIR)/Inter-Black.otf \
docs/glyphs/metrics.json $(INSTALLDIR)/Inter-BlackItalic.otf \
$(INSTALLDIR)/Inter-Regular.otf \
$(INSTALLDIR)/Inter-Italic.otf \
$(INSTALLDIR)/Inter-Thin.otf \
$(INSTALLDIR)/Inter-ThinItalic.otf \
$(INSTALLDIR)/Inter-Light.otf \
$(INSTALLDIR)/Inter-LightItalic.otf \
$(INSTALLDIR)/Inter-ExtraLight.otf \
$(INSTALLDIR)/Inter-ExtraLightItalic.otf \
$(INSTALLDIR)/Inter-Medium.otf \
$(INSTALLDIR)/Inter-MediumItalic.otf \
$(INSTALLDIR)/Inter-SemiBold.otf \
$(INSTALLDIR)/Inter-SemiBoldItalic.otf \
$(INSTALLDIR)/Inter-Bold.otf \
$(INSTALLDIR)/Inter-BoldItalic.otf \
$(INSTALLDIR)/Inter-ExtraBold.otf \
$(INSTALLDIR)/Inter-ExtraBoldItalic.otf
docs_fonts: docs_fonts_text docs_fonts_display install_var: $(INSTALLDIR)/Inter-V.var.ttf
$(INSTALLDIR)/%.otf: $(FONTDIR)/static/%.otf | $(INSTALLDIR)
cp -a $^ $@
# TODO: re-enable this when we have figured out how to make subset VFs work $(INSTALLDIR)/%.var.ttf: $(FONTDIR)/var/%.var.ttf | $(INSTALLDIR)
# with substitution features like ccmp. cp -a $^ $@
# docs_fonts_pre:
# rm -rf docs/font-files
# mkdir docs/font-files $(FONTDIR)/subset
# python misc/tools/subset.py
# docs_fonts_text: docs_fonts_pre
# cp -a $(FONTDIR)/const/*.woff \
# $(FONTDIR)/const/*.woff2 \
# $(FONTDIR)/const/*.otf \
# $(FONTDIR)/var/Inter.var.* \
# $(FONTDIR)/var/InterDisplay.var.* \
# $(FONTDIR)/var/Inter*-roman.var.* \
# $(FONTDIR)/var/Inter*-italic.var.* \
# $(FONTDIR)/subset/Inter-*.woff2 \
# $(FONTDIR)/subset/Inter.*.woff2 \
# docs/font-files/
# docs_fonts_display: docs_fonts_pre
# cp -a $(FONTDIR)/const/*.woff \
# $(FONTDIR)/const/*.woff2 \
# $(FONTDIR)/const/*.otf \
# $(FONTDIR)/var/Inter.var.* \
# $(FONTDIR)/var/InterDisplay.var.* \
# $(FONTDIR)/var/Inter*-roman.var.* \
# $(FONTDIR)/var/Inter*-italic.var.* \
# $(FONTDIR)/subset/InterDisplay*.woff2 \
# docs/font-files/
docs_fonts_pre: $(INSTALLDIR):
rm -rf docs/font-files mkdir -p $@
mkdir docs/font-files
docs_fonts_text: docs_fonts_pre .PHONY: install install_var
cp -a $(FONTDIR)/const/*.woff \
$(FONTDIR)/const/*.woff2 \
$(FONTDIR)/const/*.otf \
$(FONTDIR)/var/Inter.var.* \
$(FONTDIR)/var/InterDisplay.var.* \
$(FONTDIR)/var/Inter*-roman.var.* \
$(FONTDIR)/var/Inter*-italic.var.* \
docs/font-files/
docs_fonts_display: docs_fonts_pre # ---------------------------------------------------------------------------------
cp -a $(FONTDIR)/const/*.woff \ # misc
$(FONTDIR)/const/*.woff2 \
$(FONTDIR)/const/*.otf \
$(FONTDIR)/var/Inter.var.* \
$(FONTDIR)/var/InterDisplay.var.* \
$(FONTDIR)/var/Inter*-roman.var.* \
$(FONTDIR)/var/Inter*-italic.var.* \
docs/font-files/
.PHONY: docs docs_info docs_fonts docs_fonts_pre docs_fonts_text docs_fonts_display
docs/_data/fontinfo.json: docs/font-files/Inter-Regular.otf misc/tools/fontinfo.py
misc/tools/fontinfo.py -pretty $< > docs/_data/fontinfo.json
docs/lab/glyphinfo.json: misc/tools/gen-glyphinfo.py build/ufo/Inter-Regular.ufo
misc/tools/gen-glyphinfo.py -ucd misc/UnicodeData.txt build/ufo/Inter-Regular.ufo > $@
docs/glyphs/metrics.json: misc/tools/gen-metrics-and-svgs.py build/ufo/Inter-Regular.ufo
misc/tools/gen-metrics-and-svgs.py build/ufo/Inter-Regular.ufo
# Helper target to download latest Unicode data. Nothing depends on this.
ucd_version := 12.1.0
update_UnicodeData:
@echo "# Unicode $(ucd_version)" > misc/UnicodeData.txt
curl '-#' "https://www.unicode.org/Public/$(ucd_version)/ucd/UnicodeData.txt" >> misc/UnicodeData.txt
# install targets
install_ttf: all_ttf_const
@echo "Installing TTF files locally at ~/Library/Fonts/Inter"
rm -rf ~/'Library/Fonts/Inter'
mkdir -p ~/'Library/Fonts/Inter'
cp -a $(FONTDIR)/const/*.ttf ~/'Library/Fonts/Inter'
install_ttf_hinted: all_ttf_hinted
@echo "Installing autohinted TTF files locally at ~/Library/Fonts/Inter"
rm -rf ~/'Library/Fonts/Inter'
mkdir -p ~/'Library/Fonts/Inter'
cp -a $(FONTDIR)/const-hinted/*.ttf ~/'Library/Fonts/Inter'
install_text_otf: all_otf_text
@echo "Installing OTF files locally at ~/Library/Fonts/Inter"
rm -rf ~/'Library/Fonts/Inter'
mkdir -p ~/'Library/Fonts/Inter'
cp -a $(FONTDIR)/const/Inter-*.otf ~/'Library/Fonts/Inter'
install_display_otf: all_otf_display
@echo "Installing OTF files locally at ~/Library/Fonts/InterDisplay"
rm -rf ~/'Library/Fonts/InterDisplay'
mkdir -p ~/'Library/Fonts/InterDisplay'
cp -a $(FONTDIR)/const/InterDisplay-*.otf ~/'Library/Fonts/InterDisplay'
install_text_var: $(FONTDIR)/var/Inter-V.var.ttf
mkdir -p ~/'Library/Fonts/Inter'
cp -a $@ ~/'Library/Fonts/Inter/Inter-V.ttf'
install_display_var: $(FONTDIR)/var/InterDisplay-V.var.ttf
mkdir -p ~/'Library/Fonts/InterDisplay'
cp -a $@ ~/'Library/Fonts/InterDisplay/InterDisplay-V.ttf'
install: install_text install_display
install_otf: install_text_otf install_display_otf
install_text: install_text_otf install_text_var
install_display: install_display_otf install_display_var
# deprecated aliases
install_var_v:
@echo 'Please use `make install_text_var` or `make install_display_var` instead.' >&2
@exit 1
.PHONY: install_ttf install_ttf_hinted install_text_otf install_display_otf install_otf
.PHONY: install_text_var install_display_var install_var_v
.PHONY: install install_text install_display
# clean removes generated and built fonts in the build directory
clean: clean:
rm -rf build/tmp build/fonts build/ufo build/googlefonts rm -rf build/tmp build/fonts build/ufo build/googlefonts
.PHONY: clean docs:
$(MAKE) -C docs serve
# update_ucd downloads the latest Unicode data (Nothing depends on this target)
ucd_version := 12.1.0
update_ucd:
@echo "# Unicode $(ucd_version)" > misc/UnicodeData.txt
curl '-#' "https://www.unicode.org/Public/$(ucd_version)/ucd/UnicodeData.txt" \
>> misc/UnicodeData.txt
.PHONY: clean docs update_ucd
# ---------------------------------------------------------------------------------
# list make targets
#
# We copy the Makefile (first in MAKEFILE_LIST) and disable the include to only list
# primary targets, avoiding the generated targets.
list:
@mkdir -p build/etc \
&& cat $(MAKEFILE) \
| sed 's/include /#include /g' > build/etc/Makefile-list \
&& $(MAKE) -pRrq -f build/etc/Makefile-list : 2>/dev/null \
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
| sort \
| egrep -v -e '^_|/' \
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
.PHONY: list

547
Makefile_v1.make Normal file
View File

@ -0,0 +1,547 @@
# To list all targets:
# make list
#
# High-level make targets:
# text Build all Inter Text fonts (default target)
# display Build all Inter Display fonts
# all Build everything
# web Build all web fonts
# var Build all variable fonts
# test Run all test (builds fonts if needed)
# zip Build a complete ZIP archive of all fonts
# zip_text Build a complete ZIP archive of all Inter Text fonts
# zip_display Build a complete ZIP archive of all Inter Display fonts
# install Build and install all OTF files (macOS only)
#
# Style-specific targets:
# STYLE_otf Build OTF file for STYLE into FONTDIR/const
# STYLE_ttf Build TTF file for STYLE into FONTDIR/const
# STYLE_ttf_hinted Build TTF file for STYLE with hints into
# FONTDIR/const-hinted
# STYLE_web Build WOFF files for STYLE into FONTDIR/const
# STYLE_web_hinted Build WOFF files for STYLE with hints into
# FONTDIR/const-hinted
# STYLE_check Build & check OTF and TTF files for STYLE
#
# "build" directory output structure:
# fonts
# const
# const-hinted
# var
#
FONTDIR = build/fonts
default: text
all: text display
# all fonts of given variant
text: all_otf_text all_ttf_text all_ttf_text_hinted all_var_text web_text
display: all_otf_display all_ttf_display all_ttf_display_hinted all_var_display web_display
# all fonts of a certain type
all_otf: all_otf_text all_otf_display
all_ttf: all_ttf_text all_ttf_display all_ttf_text_hinted all_ttf_display_hinted
web: web_text web_display
web_text: all_web_text all_web_hinted_text
web_display: all_web_display all_web_hinted_display
var: all_var_text all_var_display
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.ttf $(FONTDIR)/var/InterDisplay-V.var.ttf
all_var_text: \
$(FONTDIR)/var/Inter.var.ttf \
$(FONTDIR)/var/Inter.var.woff2 \
$(FONTDIR)/var/Inter-V.var.ttf \
$(FONTDIR)/var/Inter-V.var.woff2 \
$(FONTDIR)/var/Inter-roman.var.ttf \
$(FONTDIR)/var/Inter-roman.var.woff2 \
$(FONTDIR)/var/Inter-italic.var.ttf \
$(FONTDIR)/var/Inter-italic.var.woff2
all_var_display: \
$(FONTDIR)/var/InterDisplay.var.ttf \
$(FONTDIR)/var/InterDisplay.var.woff2 \
$(FONTDIR)/var/InterDisplay-V.var.ttf \
$(FONTDIR)/var/InterDisplay-V.var.woff2 \
$(FONTDIR)/var/InterDisplay-roman.var.ttf \
$(FONTDIR)/var/InterDisplay-roman.var.woff2 \
$(FONTDIR)/var/InterDisplay-italic.var.ttf \
$(FONTDIR)/var/InterDisplay-italic.var.woff2
.PHONY: all all_otf all_ttf text display
.PHONY: web web_text web_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
# all_var_hinted: $(FONTDIR)/var-hinted/Inter.var.ttf $(FONTDIR)/var-hinted/Inter.var.woff2
BIN := $(PWD)/build/venv/bin
export PATH := $(BIN):$(PATH)
# list make targets
# We copy the Makefile (first in MAKEFILE_LIST) and disable the include to only list
# primary targets, avoiding the generated targets.
.PHONY: list list_all
list:
@mkdir -p build/etc \
&& cat $(firstword $(MAKEFILE_LIST)) \
| sed 's/include /#include /g' > build/etc/Makefile-list \
&& $(MAKE) -pRrq -f build/etc/Makefile-list : 2>/dev/null \
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
| sort \
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
# list_all is like list, but includes generated targets
list_all:
@$(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null \
| awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
| sort \
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
# generated.make is automatically generated by init.sh and defines depenencies for
# all styles and alias targets
include build/etc/generated.make
# WOFF2 from TTF
build/%.woff2: build/%.ttf
$(BIN)/woff2_compress "$<"
# WOFF from TTF
build/%.woff: build/%.ttf
$(BIN)/ttf2woff -O -t woff "$<" "$@"
# VF OTF from UFO
$(FONTDIR)/var/Inter.var.ttf: $(all_ufo_masters_text) version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter.designspace
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(BIN)/gftools fix-dsig --autofix $@
$(FONTDIR)/var/Inter-V.var.ttf: $(FONTDIR)/var/Inter.var.ttf
misc/fontbuild rename --family "Inter V" -o $@ $<
dev-2048: $(FONTDIR)/var/Inter-V-2048.var.ttf
@echo "Installing Inter-V-2048.var.ttf locally in ~/Library/Fonts/Inter/"
mkdir -p ~/'Library/Fonts/Inter'
cp $(FONTDIR)/var/Inter-V-2048.var.ttf ~/'Library/Fonts/Inter'
$(FONTDIR)/var/Inter-V-2048.var.ttf: $(FONTDIR)/var/Inter.var.ttf
misc/fontbuild rename --family "Inter V 2048" -o $@ $<
$(FONTDIR)/var/Inter-%.var.ttf: build/ufo/Inter-%.designspace $(all_ufo_masters_text) version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
misc/tools/fix-vf-meta.py $@
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(BIN)/gftools fix-dsig --autofix $@
$(FONTDIR)/var/InterDisplay.var.ttf: $(all_ufo_masters_display) version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/InterDisplay.designspace
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(BIN)/gftools fix-dsig --autofix $@
$(FONTDIR)/var/InterDisplay-V.var.ttf: $(FONTDIR)/var/InterDisplay.var.ttf
misc/fontbuild rename --family "Inter Display V" -o $@ $<
$(FONTDIR)/var/InterDisplay-%.var.ttf: build/ufo/InterDisplay-%.designspace $(all_ufo_masters_display) version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
misc/tools/fix-vf-meta.py $@
$(BIN)/gftools fix-unwanted-tables -t MVAR $@
$(BIN)/gftools fix-dsig --autofix $@
# OTF/TTF from UFO
$(FONTDIR)/const/Inter%.otf: build/ufo/Inter%.ufo version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter$*.ufo
$(FONTDIR)/const/Inter%.ttf: build/ufo/Inter%.ufo version.txt
@mkdir -p "$(dir $@)"
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter$*.ufo
# DESIGNSPACE from GLYPHS
build/ufo/Inter-roman.designspace: build/ufo/Inter.designspace
build/ufo/Inter-italic.designspace: build/ufo/Inter.designspace
build/ufo/Inter.designspace: src/Inter.glyphs
@mkdir -p build/ufo
misc/fontbuild glyphsync -o build/ufo src/Inter.glyphs
build/ufo/InterDisplay-roman.designspace: build/ufo/InterDisplay.designspace
build/ufo/InterDisplay-italic.designspace: build/ufo/InterDisplay.designspace
build/ufo/InterDisplay.designspace: src/InterDisplay.glyphs
@mkdir -p build/ufo
misc/fontbuild glyphsync -o build/ufo src/InterDisplay.glyphs
# short-circuit Make for performance
src/Inter.glyphs:
@true
src/InterDisplay.glyphs:
@true
# make sure intermediate files are not gc'd by make
.PRECIOUS: build/ufo/Inter-*.designspace build/ufo/InterDisplay-*.designspace
designspace: build/ufo/Inter.designspace build/ufo/InterDisplay.designspace
.PHONY: designspace
# features
src/features: $(wildcard src/features/*)
@touch "$@"
@true
build/ufo/features: src/features
@mkdir -p build/ufo
@rm -f build/ufo/features
@ln -s ../../src/features build/ufo/features
# make sure intermediate UFOs are not gc'd by make
.PRECIOUS: build/ufo/Inter-%.ufo
# Note: The seemingly convoluted dependency graph above is required to
# make sure that glyphsync and instancegen are not run in parallel.
# hinted TTF files via autohint
$(FONTDIR)/const-hinted/%.ttf: $(FONTDIR)/const/%.ttf
mkdir -p "$(dir $@)"
$(BIN)/ttfautohint --windows-compatibility --adjust-subglyphs --no-info "$<" "$@"
# python -m ttfautohint --fallback-stem-width=256 --no-info "$<" "$@"
# $(FONTDIR)/var-hinted/%.ttf: $(FONTDIR)/var/%.ttf
# mkdir -p "$(dir $@)"
# ttfautohint --fallback-stem-width=256 --no-info "$<" "$@"
# make sure intermediate TTFs are not gc'd by make
.PRECIOUS: $(FONTDIR)/const/%.ttf
.PRECIOUS: $(FONTDIR)/const/%.otf
.PRECIOUS: $(FONTDIR)/const-hinted/%.ttf
.PRECIOUS: $(FONTDIR)/var/%.var.ttf
# test runs all tests
# Note: all_check_const is generated by init.sh and runs "fontbuild checkfont"
# on all otf and ttf files.
test: test_text test_display
test_text: check_text \
build/fbreport-text-const.txt \
build/fbreport-text-var1.txt \
build/fbreport-text-var2.txt
@echo "$(@): OK"
test_display: check_display \
build/fbreport-display-const.txt \
build/fbreport-display-var1.txt \
build/fbreport-display-var2.txt
@echo "$(@): OK"
# FBAKE_ARGS are common args for all fontbakery targets
FBAKE_ARGS := check-universal \
--no-colors \
--no-progress \
--loglevel WARN \
--succinct \
-j \
-x com.google.fonts/check/dsig \
-x com.google.fonts/check/unitsperem \
-x com.google.fonts/check/family/win_ascent_and_descent \
-x com.google.fonts/check/fontbakery_version
FBAKE_STATIC_ARGS := $(FBAKE_ARGS) -x com.google.fonts/check/family/underline_thickness
FBAKE_VAR_ARGS := $(FBAKE_ARGS) -x com.google.fonts/check/STAT_strings
# static text family
build/fbreport-text-const.txt: $(wildcard $(FONTDIR)/const/Inter-*.otf)
@echo "fontbakery check-universal Inter-*.otf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_STATIC_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal Inter-*.otf OK"
# multi-axis VF text family
build/fbreport-text-var2.txt: $(FONTDIR)/var/Inter.var.ttf
@echo "fontbakery check-universal Inter.var.ttf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_VAR_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal Inter.var.ttf"
# single-axis VF text family
build/fbreport-text-var1.txt: $(wildcard $(FONTDIR)/var/Inter-*.var.ttf)
@echo "fontbakery check-universal Inter-*.var.ttf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_VAR_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal Inter-*.var.ttf"
# static display family
build/fbreport-display-const.txt: $(wildcard $(FONTDIR)/const/InterDisplay-*.otf)
@echo "fontbakery check-universal InterDisplay-*.otf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_STATIC_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal InterDisplay-*.otf"
# multi-axis VF display family
build/fbreport-display-var2.txt: $(FONTDIR)/var/InterDisplay.var.ttf
@echo "fontbakery check-universal InterDisplay.var.ttf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_VAR_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal InterDisplay.var.ttf"
# single-axis VF display family
build/fbreport-display-var1.txt: $(wildcard $(FONTDIR)/var/InterDisplay-*.var.ttf)
@echo "fontbakery check-universal InterDisplay-*.var.ttf > $(@) ..."
@$(BIN)/fontbakery $(FBAKE_VAR_ARGS) $^ > $@ || \
(cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
@echo "fontbakery check-universal InterDisplay-*.var.ttf"
# check does the same thing as test, but without any dependency checks, meaning
# it will check whatever font files are already built.
check_text: $(wildcard $(FONTDIR)/const/Inter-*.ttf) \
$(wildcard $(FONTDIR)/const/Inter-*.otf) \
$(wildcard $(FONTDIR)/const/Inter-*.woff2) \
$(wildcard $(FONTDIR)/var/Inter-*.var.ttf) \
$(wildcard $(FONTDIR)/var/Inter-*.var.woff2) \
$(FONTDIR)/var/Inter.var.ttf \
$(FONTDIR)/var/Inter.var.woff2
misc/fontbuild checkfont $^
@echo "$(@): OK"
check_display: $(wildcard $(FONTDIR)/const/InterDisplay-*.ttf) \
$(wildcard $(FONTDIR)/const/InterDisplay-*.otf) \
$(wildcard $(FONTDIR)/const/InterDisplay-*.woff2) \
$(wildcard $(FONTDIR)/var/InterDisplay-*.var.ttf) \
$(wildcard $(FONTDIR)/var/InterDisplay-*.var.woff2) \
$(FONTDIR)/var/InterDisplay.var.ttf \
$(FONTDIR)/var/InterDisplay.var.woff2
misc/fontbuild checkfont $^
@echo "$(@): OK"
check_pedantic: $(FONTDIR)/var/Inter.var.ttf
$(BIN)/fontbakery check-universal --dark-theme --loglevel WARN -j \
-x com.google.fonts/check/unitsperem \
$^
.PHONY: test test_text test_display check_text check_display check_pedantic
# samples renders PDF and PNG samples
samples: $(FONTDIR)/samples all_samples_pdf all_samples_png
$(FONTDIR)/samples/%.pdf: $(FONTDIR)/const/%.otf $(FONTDIR)/samples
misc/tools/fontsample/fontsample -o "$@" "$<"
$(FONTDIR)/samples/%.png: $(FONTDIR)/const/%.otf $(FONTDIR)/samples
misc/tools/fontsample/fontsample -o "$@" "$<"
$(FONTDIR)/samples:
mkdir -p $@
.PHONY: samples
# load version, used by zip and dist
VERSION := $(shell cat version.txt)
# distribution zip files
ZIP_FILE_DIST := build/release/Inter-${VERSION}.zip
zip: all
$(MAKE) -j8 test
bash misc/makezip.sh -all -reveal-in-finder \
"build/release/Inter-${VERSION}-$(shell git rev-parse --short=10 HEAD).zip"
zip_text: text
$(MAKE) -j4 test_text
bash misc/makezip.sh -text -reveal-in-finder \
"build/release/Inter-${VERSION}-text-$(shell git rev-parse --short=10 HEAD).zip"
zip_display: display
$(MAKE) -j4 test_display
bash misc/makezip.sh -display -reveal-in-finder \
"build/release/Inter-${VERSION}-display-$(shell git rev-parse --short=10 HEAD).zip"
dist_zip: dist_check dist_build
$(MAKE) -j4 test_text
bash misc/makezip.sh -text -reveal-in-finder "$(ZIP_FILE_DIST)"
dist_build: text
misc/tools/versionize.py
dist_check:
@echo "Creating distribution for version ${VERSION}"
@if [ -f "${ZIP_FILE_DIST}" ]; then \
echo "${ZIP_FILE_DIST} already exists. Bump version or remove the zip file to continue." >&2; \
exit 1; \
fi
@echo "——————————————————————————————————————————————————————————————————"
@echo ""
@echo " REMEMBER TO 'make clean' FIRST IF FONT FILES CHANGED"
@echo ""
@echo "——————————————————————————————————————————————————————————————————"
dist: dist_zip
# Note: "display" dep is here since the "docs" target loosely depends on it
$(MAKE) -j8 display
$(MAKE) -j docs
@echo "——————————————————————————————————————————————————————————————————"
@echo ""
@echo "Next steps:"
@echo ""
@echo "1) Commit & push changes"
@echo ""
@echo "2) Create new release with ${ZIP_FILE_DIST} at"
@echo " https://github.com/rsms/inter/releases/new?tag=v${VERSION}"
@echo ""
@echo "3) Bump version in version.txt (to the next future version)"
@echo ""
@echo "——————————————————————————————————————————————————————————————————"
.PHONY: zip zip_dist pre_dist dist
docs: docs_fonts
$(MAKE) -j docs_info
docs_info: docs/_data/fontinfo.json \
docs/lab/glyphinfo.json \
docs/glyphs/metrics.json
docs_fonts: docs_fonts_text docs_fonts_display
# TODO: re-enable this when we have figured out how to make subset VFs work
# with substitution features like ccmp.
# docs_fonts_pre:
# rm -rf docs/font-files
# mkdir docs/font-files $(FONTDIR)/subset
# python misc/tools/subset.py
# docs_fonts_text: docs_fonts_pre
# cp -a $(FONTDIR)/const/*.woff \
# $(FONTDIR)/const/*.woff2 \
# $(FONTDIR)/const/*.otf \
# $(FONTDIR)/var/Inter.var.* \
# $(FONTDIR)/var/InterDisplay.var.* \
# $(FONTDIR)/var/Inter*-roman.var.* \
# $(FONTDIR)/var/Inter*-italic.var.* \
# $(FONTDIR)/subset/Inter-*.woff2 \
# $(FONTDIR)/subset/Inter.*.woff2 \
# docs/font-files/
# docs_fonts_display: docs_fonts_pre
# cp -a $(FONTDIR)/const/*.woff \
# $(FONTDIR)/const/*.woff2 \
# $(FONTDIR)/const/*.otf \
# $(FONTDIR)/var/Inter.var.* \
# $(FONTDIR)/var/InterDisplay.var.* \
# $(FONTDIR)/var/Inter*-roman.var.* \
# $(FONTDIR)/var/Inter*-italic.var.* \
# $(FONTDIR)/subset/InterDisplay*.woff2 \
# docs/font-files/
docs_fonts_pre:
rm -rf docs/font-files
mkdir docs/font-files
docs_fonts_text: docs_fonts_pre
cp -a $(FONTDIR)/const/*.woff \
$(FONTDIR)/const/*.woff2 \
$(FONTDIR)/const/*.otf \
$(FONTDIR)/var/Inter.var.* \
$(FONTDIR)/var/InterDisplay.var.* \
$(FONTDIR)/var/Inter*-roman.var.* \
$(FONTDIR)/var/Inter*-italic.var.* \
docs/font-files/
docs_fonts_display: docs_fonts_pre
cp -a $(FONTDIR)/const/*.woff \
$(FONTDIR)/const/*.woff2 \
$(FONTDIR)/const/*.otf \
$(FONTDIR)/var/Inter.var.* \
$(FONTDIR)/var/InterDisplay.var.* \
$(FONTDIR)/var/Inter*-roman.var.* \
$(FONTDIR)/var/Inter*-italic.var.* \
docs/font-files/
.PHONY: docs docs_info docs_fonts docs_fonts_pre docs_fonts_text docs_fonts_display
docs/_data/fontinfo.json: docs/font-files/Inter-Regular.otf misc/tools/fontinfo.py
misc/tools/fontinfo.py -pretty $< > docs/_data/fontinfo.json
docs/lab/glyphinfo.json: misc/tools/gen-glyphinfo.py build/ufo/Inter-Regular.ufo
misc/tools/gen-glyphinfo.py -ucd misc/UnicodeData.txt build/ufo/Inter-Regular.ufo > $@
docs/glyphs/metrics.json: misc/tools/gen-metrics-and-svgs.py build/ufo/Inter-Regular.ufo
misc/tools/gen-metrics-and-svgs.py build/ufo/Inter-Regular.ufo
# Helper target to download latest Unicode data. Nothing depends on this.
ucd_version := 12.1.0
update_UnicodeData:
@echo "# Unicode $(ucd_version)" > misc/UnicodeData.txt
curl '-#' "https://www.unicode.org/Public/$(ucd_version)/ucd/UnicodeData.txt" >> misc/UnicodeData.txt
# install targets
install_ttf: all_ttf_const
@echo "Installing TTF files locally at ~/Library/Fonts/Inter"
rm -rf ~/'Library/Fonts/Inter'
mkdir -p ~/'Library/Fonts/Inter'
cp -a $(FONTDIR)/const/*.ttf ~/'Library/Fonts/Inter'
install_ttf_hinted: all_ttf_hinted
@echo "Installing autohinted TTF files locally at ~/Library/Fonts/Inter"
rm -rf ~/'Library/Fonts/Inter'
mkdir -p ~/'Library/Fonts/Inter'
cp -a $(FONTDIR)/const-hinted/*.ttf ~/'Library/Fonts/Inter'
install_text_otf: all_otf_text
@echo "Installing OTF files locally at ~/Library/Fonts/Inter"
rm -rf ~/'Library/Fonts/Inter'
mkdir -p ~/'Library/Fonts/Inter'
cp -a $(FONTDIR)/const/Inter-*.otf ~/'Library/Fonts/Inter'
install_display_otf: all_otf_display
@echo "Installing OTF files locally at ~/Library/Fonts/InterDisplay"
rm -rf ~/'Library/Fonts/InterDisplay'
mkdir -p ~/'Library/Fonts/InterDisplay'
cp -a $(FONTDIR)/const/InterDisplay-*.otf ~/'Library/Fonts/InterDisplay'
install_text_var: $(FONTDIR)/var/Inter-V.var.ttf
mkdir -p ~/'Library/Fonts/Inter'
cp -a $@ ~/'Library/Fonts/Inter/Inter-V.ttf'
install_display_var: $(FONTDIR)/var/InterDisplay-V.var.ttf
mkdir -p ~/'Library/Fonts/InterDisplay'
cp -a $@ ~/'Library/Fonts/InterDisplay/InterDisplay-V.ttf'
install: install_text install_display
install_otf: install_text_otf install_display_otf
install_text: install_text_otf install_text_var
install_display: install_display_otf install_display_var
# deprecated aliases
install_var_v:
@echo 'Please use `make install_text_var` or `make install_display_var` instead.' >&2
@exit 1
.PHONY: install_ttf install_ttf_hinted install_text_otf install_display_otf install_otf
.PHONY: install_text_var install_display_var install_var_v
.PHONY: install install_text install_display
# clean removes generated and built fonts in the build directory
clean:
rm -rf build/tmp build/fonts build/ufo build/googlefonts
.PHONY: clean

35
docs/Gemfile Normal file
View File

@ -0,0 +1,35 @@
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 4.2.2"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
end
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", "~> 1.2"
gem "tzinfo-data"
end
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]
# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
# do not have a Java counterpart.
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
gem "webrick", "~> 1.7"

83
docs/Gemfile.lock Normal file
View File

@ -0,0 +1,83 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.10)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.15.5)
forwardable-extended (2.6.0)
http_parser.rb (0.8.0)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
jekyll (4.2.2)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 2.0)
jekyll-feed (0.16.0)
jekyll (>= 3.7, < 5.0)
jekyll-sass-converter (2.2.0)
sassc (> 2.0.1, < 3.0)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.7)
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (3.28.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.8.0)
webrick (1.7.0)
PLATFORMS
arm64-darwin-21
DEPENDENCIES
http_parser.rb (~> 0.6.0)
jekyll (~> 4.2.2)
jekyll-feed (~> 0.12)
minima (~> 2.5)
tzinfo (~> 1.2)
tzinfo-data
wdm (~> 0.1.1)
webrick (~> 1.7)
BUNDLED WITH
2.3.14

51
docs/Makefile Normal file
View File

@ -0,0 +1,51 @@
SRCDIR := $(abspath $(lastword $(MAKEFILE_LIST))/../..)
BIN := $(SRCDIR)/build/venv/bin
FONTDIR := ../build/fonts
export PATH := $(BIN):$(PATH)
default:
@echo "Please specify a target: build, serve or dist" >&2
build:
rm -rf _site
bundle exec jekyll build
serve:
./_scripts/serve.sh
# -----------------------------------------------------------------------
dist: fonts info
$(BIN)/python3 ../misc/tools/patch-version.py lab/index.html
info: _data/fontinfo.json \
lab/glyphinfo.json \
glyphs/metrics.json
fonts:
rm -rf font-files/Inter-* font-files/Inter.var*
mkdir -p font-files
cp -a $(FONTDIR)/static/Inter-*.woff2 \
$(FONTDIR)/static/Inter-*.otf \
$(FONTDIR)/var/Inter.var.* \
$(FONTDIR)/var/Inter-roman.var.* \
$(FONTDIR)/var/Inter-italic.var.* \
font-files/
_data/fontinfo.json: ../misc/tools/fontinfo.py font-files/Inter-Regular.otf
$(BIN)/python3 ../misc/tools/fontinfo.py -pretty $< > _data/fontinfo.json
lab/glyphinfo.json: ../misc/tools/gen-glyphinfo.py \
../build/ufo/Inter-Regular.ufo \
../misc/UnicodeData.txt
$(BIN)/python3 ../misc/tools/gen-glyphinfo.py \
-ucd ../misc/UnicodeData.txt ../build/ufo/Inter-Regular.ufo > $@
glyphs/metrics.json: ../misc/tools/gen-metrics-and-svgs.py \
../build/ufo/Inter-Regular.ufo
$(BIN)/python3 ../misc/tools/gen-metrics-and-svgs.py ../build/ufo/Inter-Regular.ufo
@# Note: this also patches glyphs/index.html
font-files/Inter-Regular.otf: fonts
.PHONY: default build serve dist info fonts

View File

@ -1 +1,2 @@
This directory is published as a website by Github at [https://rsms.me/inter](https://rsms.me/inter/) This directory is published as a website by Github at
[https://rsms.me/inter](https://rsms.me/inter/)

View File

@ -10,3 +10,6 @@ kramdown:
hard_wrap: false hard_wrap: false
exclude: exclude:
- README.md - README.md
- Makefile
- Gemfile
- Gemfile.lock

View File

@ -3,16 +3,14 @@
font-style: normal; font-style: normal;
font-weight: 100; font-weight: 100;
font-display: swap; font-display: swap;
src: url("font-files/Inter-Thin.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Thin.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Thin.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 100; font-weight: 100;
font-display: swap; font-display: swap;
src: url("font-files/Inter-ThinItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ThinItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ThinItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -20,16 +18,14 @@
font-style: normal; font-style: normal;
font-weight: 200; font-weight: 200;
font-display: swap; font-display: swap;
src: url("font-files/Inter-ExtraLight.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ExtraLight.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ExtraLight.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 200; font-weight: 200;
font-display: swap; font-display: swap;
src: url("font-files/Inter-ExtraLightItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ExtraLightItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ExtraLightItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -37,16 +33,14 @@
font-style: normal; font-style: normal;
font-weight: 300; font-weight: 300;
font-display: swap; font-display: swap;
src: url("font-files/Inter-Light.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Light.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Light.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 300; font-weight: 300;
font-display: swap; font-display: swap;
src: url("font-files/Inter-LightItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-LightItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-LightItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -54,16 +48,14 @@
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
src: url("font-files/Inter-Regular.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Regular.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Regular.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
src: url("font-files/Inter-Italic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Italic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Italic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -71,16 +63,14 @@
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
font-display: swap; font-display: swap;
src: url("font-files/Inter-Medium.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Medium.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Medium.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 500; font-weight: 500;
font-display: swap; font-display: swap;
src: url("font-files/Inter-MediumItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-MediumItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-MediumItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -88,16 +78,14 @@
font-style: normal; font-style: normal;
font-weight: 600; font-weight: 600;
font-display: swap; font-display: swap;
src: url("font-files/Inter-SemiBold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-SemiBold.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-SemiBold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 600; font-weight: 600;
font-display: swap; font-display: swap;
src: url("font-files/Inter-SemiBoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-SemiBoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-SemiBoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -105,16 +93,14 @@
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
font-display: swap; font-display: swap;
src: url("font-files/Inter-Bold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Bold.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Bold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 700; font-weight: 700;
font-display: swap; font-display: swap;
src: url("font-files/Inter-BoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-BoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-BoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -122,16 +108,14 @@
font-style: normal; font-style: normal;
font-weight: 800; font-weight: 800;
font-display: swap; font-display: swap;
src: url("font-files/Inter-ExtraBold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ExtraBold.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ExtraBold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 800; font-weight: 800;
font-display: swap; font-display: swap;
src: url("font-files/Inter-ExtraBoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ExtraBoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ExtraBoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -139,14 +123,12 @@
font-style: normal; font-style: normal;
font-weight: 900; font-weight: 900;
font-display: swap; font-display: swap;
src: url("font-files/Inter-Black.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Black.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Black.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter'; font-family: 'Inter';
font-style: italic; font-style: italic;
font-weight: 900; font-weight: 900;
font-display: swap; font-display: swap;
src: url("font-files/Inter-BlackItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-BlackItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-BlackItalic.woff?v={{font_v}}") format("woff");
} }

View File

@ -3,16 +3,14 @@
font-style: normal; font-style: normal;
font-weight: 100; font-weight: 100;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-Thin.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-Thin.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-Thin.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 100; font-weight: 100;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-ThinItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-ThinItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-ThinItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -20,16 +18,14 @@
font-style: normal; font-style: normal;
font-weight: 200; font-weight: 200;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-ExtraLight.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-ExtraLight.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-ExtraLight.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 200; font-weight: 200;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-ExtraLightItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-ExtraLightItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-ExtraLightItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -37,16 +33,14 @@
font-style: normal; font-style: normal;
font-weight: 300; font-weight: 300;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-Light.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-Light.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-Light.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 300; font-weight: 300;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-LightItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-LightItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-LightItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -54,16 +48,14 @@
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-Regular.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-Regular.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-Regular.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-Italic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-Italic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-Italic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -71,16 +63,14 @@
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-Medium.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-Medium.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-Medium.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 500; font-weight: 500;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-MediumItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-MediumItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-MediumItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -88,16 +78,14 @@
font-style: normal; font-style: normal;
font-weight: 600; font-weight: 600;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-SemiBold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-SemiBold.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-SemiBold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 600; font-weight: 600;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-SemiBoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-SemiBoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-SemiBoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -105,16 +93,14 @@
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-Bold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-Bold.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-Bold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 700; font-weight: 700;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-BoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-BoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-BoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -122,16 +108,14 @@
font-style: normal; font-style: normal;
font-weight: 800; font-weight: 800;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-ExtraBold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-ExtraBold.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-ExtraBold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 800; font-weight: 800;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-ExtraBoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-ExtraBoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-ExtraBoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
@ -139,14 +123,12 @@
font-style: normal; font-style: normal;
font-weight: 900; font-weight: 900;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-Black.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-Black.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-Black.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'InterDisplay'; font-family: 'InterDisplay';
font-style: italic; font-style: italic;
font-weight: 900; font-weight: 900;
font-display: swap; font-display: swap;
src: url("font-files/InterDisplay-BlackItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/InterDisplay-BlackItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/InterDisplay-BlackItalic.woff?v={{font_v}}") format("woff");
} }

View File

@ -2,11 +2,13 @@
set -e set -e
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
if [ "$1" == "-h" ]; then if [ "$1" = "-h" ]; then
echo "usage: $0 [<bindaddr>]" >&2 echo "usage: $0 [<bindaddr>]" >&2
exit 1 exit 1
fi fi
BINDADDR=${1:-127.0.0.1}
if [ ! -s lab/fonts ]; then if [ ! -s lab/fonts ]; then
rm -f lab/fonts rm -f lab/fonts
ln -fs ../../build/fonts lab/fonts ln -fs ../../build/fonts lab/fonts
@ -20,14 +22,7 @@ fi
# For live testing with fonts, you'll instead want to use docs/lab/serve.py # For live testing with fonts, you'll instead want to use docs/lab/serve.py
rm -rf _site rm -rf _site
BINDADDR=127.0.0.1 bundle exec jekyll serve \
if [ "$1" != "" ]; then
BINDADDR=$1
fi
# --incremental
jekyll serve \
--watch \ --watch \
--host "$BINDADDR" \ --host "$BINDADDR" \
--port 3002 \ --port 3002 \

View File

@ -15,135 +15,117 @@ Please use "inter.css" instead for new applications.
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 100; font-weight: 100;
src: url("font-files/Inter-Thin.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Thin.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Thin.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 100; font-weight: 100;
src: url("font-files/Inter-ThinItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ThinItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ThinItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 200; font-weight: 200;
src: url("font-files/Inter-ExtraLight.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ExtraLight.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ExtraLight.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 200; font-weight: 200;
src: url("font-files/Inter-ExtraLightItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ExtraLightItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ExtraLightItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 300; font-weight: 300;
src: url("font-files/Inter-Light.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Light.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Light.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 300; font-weight: 300;
src: url("font-files/Inter-LightItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-LightItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-LightItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url("font-files/Inter-Regular.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Regular.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Regular.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 400; font-weight: 400;
src: url("font-files/Inter-Italic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Italic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Italic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 500; font-weight: 500;
src: url("font-files/Inter-Medium.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Medium.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Medium.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 500; font-weight: 500;
src: url("font-files/Inter-MediumItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-MediumItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-MediumItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 600; font-weight: 600;
src: url("font-files/Inter-SemiBold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-SemiBold.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-SemiBold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 600; font-weight: 600;
src: url("font-files/Inter-SemiBoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-SemiBoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-SemiBoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 700; font-weight: 700;
src: url("font-files/Inter-Bold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Bold.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Bold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 700; font-weight: 700;
src: url("font-files/Inter-BoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-BoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-BoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 800; font-weight: 800;
src: url("font-files/Inter-ExtraBold.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ExtraBold.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ExtraBold.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 800; font-weight: 800;
src: url("font-files/Inter-ExtraBoldItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-ExtraBoldItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-ExtraBoldItalic.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: normal; font-style: normal;
font-weight: 900; font-weight: 900;
src: url("font-files/Inter-Black.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-Black.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-Black.woff?v={{font_v}}") format("woff");
} }
@font-face { @font-face {
font-family: 'Inter UI'; font-family: 'Inter UI';
font-style: italic; font-style: italic;
font-weight: 900; font-weight: 900;
src: url("font-files/Inter-BlackItalic.woff2?v={{font_v}}") format("woff2"), src: url("font-files/Inter-BlackItalic.woff2?v={{font_v}}") format("woff2");
url("font-files/Inter-BlackItalic.woff?v={{font_v}}") format("woff");
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@ Font families defined by this CSS:
- "Inter" static "traditional" fonts for older web browsers - "Inter" static "traditional" fonts for older web browsers
- "Inter var" single-axis variable fonts for all modern browsers - "Inter var" single-axis variable fonts for all modern browsers
- "Inter var experimental" multi-axis variable fonts for modern web browsers - "Inter var experimental" multi-axis variable fonts for some modern web browsers
Use like this in your CSS: Use like this in your CSS:
@ -21,11 +21,6 @@ Use like this in your CSS:
/* ----------------------- variable ----------------------- */ /* ----------------------- variable ----------------------- */
{%- comment -%}
{% include Inter-italic.var.css %}
{% include Inter-roman.var.css %}
{%- endcomment %}
@font-face { @font-face {
font-family: 'Inter var'; font-family: 'Inter var';
font-style: normal; font-style: normal;

View File

@ -68,10 +68,10 @@ var fontFamilyName,
} }
let families = [ let families = [
["Inter", "const", fontFamilyName], ["Inter", "static", fontFamilyName],
["Inter", "const-hinted", fontFamilyNameHinted], ["Inter", "static-hinted", fontFamilyNameHinted],
["InterDisplay", "const", fontFamilyNameDisplay], ["InterDisplay", "static", fontFamilyNameDisplay],
["InterDisplay", "const-hinted", fontFamilyNameDisplayHinted], ["InterDisplay", "static-hinted", fontFamilyNameDisplayHinted],
] ]
for (let [family, filepath, cssname] of families) { for (let [family, filepath, cssname] of families) {

View File

@ -37,7 +37,7 @@ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
<div class="options"> <div class="options">
<div class="flex-x"> <div class="flex-x">
<label title="Use variable font instead of constant font files"> <label title="Use variable font instead of static font files">
<span>VF</span> <span>VF</span>
<input type="checkbox" name="varfont"> <input type="checkbox" name="varfont">
</label> </label>
@ -64,18 +64,24 @@ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
<!-- Variable font controls (hidden when not using variable fonts) --> <!-- Variable font controls (hidden when not using variable fonts) -->
<label class="label-and-value varfontControl"> <label class="label-and-value varfontControl">
<span>Weight:</span> <span title="Weight">wght:</span>
<input type="range" value="400" step="1" min="100" max="900" name="varWeight"> <input type="range" value="400" step="1" min="100" max="900" name="varWeight">
<input type="number" value="400" step="1" min="100" max="900" name="varWeightNum"> <input type="number" value="400" step="1" min="100" max="900" name="varWeightNum">
</label> </label>
<label class="label-and-value varfontControl"> <label class="label-and-value varfontControl">
<span>Slant:</span> <span title="Slant">slnt:</span>
<input type="range" value="0" step="0.01" min="0" max="10" name="varSlant"> <input type="range" value="0" step="0.01" min="0" max="10" name="varSlant">
<input type="number" value="0" step="0.01" min="0" max="10" name="varSlantNum"> <input type="number" value="0" step="0.01" min="0" max="10" name="varSlantNum">
</label> </label>
<label class="label-and-value constfontControl"> <label class="label-and-value varfontControl">
<span title="Optical size">opsz:</span>
<input type="range" value="0" step="0.01" min="16" max="72" name="varOpsz">
<input type="number" value="0" step="0.01" min="16" max="72" name="varOpszNum">
</label>
<label class="label-and-value staticfontControl">
<span>Weight:</span> <span>Weight:</span>
<select name="weight" style="max-width:100px"> <select name="weight" style="max-width:100px">
<option value="100">Thin (100)</option> <option value="100">Thin (100)</option>
@ -828,9 +834,10 @@ function main() {
let usingVarFont = false let usingVarFont = false
let usingFontFamily = "text" let usingFontFamily = "text"
var varWeightRange, varSlantRange var varWeightRange, varSlantRange, varOpszRange
var varWeightSettingValueImpl = false var varWeightSettingValueImpl = false
var varSlantSettingValueImpl = false var varSlantSettingValueImpl = false
var varOpszSettingValueImpl = false
function getFontFamily(overrideFamily) { function getFontFamily(overrideFamily) {
return ( return (
@ -866,6 +873,7 @@ function main() {
let varState = { let varState = {
weight: 400, // 400..900 weight: 400, // 400..900
slant: 0, // 0..-10 slant: 0, // 0..-10
opsz: 16, // 16..72
} }
function updateVarFont() { function updateVarFont() {
@ -880,7 +888,7 @@ function main() {
varSlantSettingValueImpl = false varSlantSettingValueImpl = false
setCSSProp( setCSSProp(
"font-variation-settings", "font-variation-settings",
`"wght" ${varState.weight}, "slnt" ${-varState.slant}` `"wght" ${varState.weight}, "slnt" ${-varState.slant}, "opsz" ${varState.opsz}`
) )
} else { } else {
setCSSProp("font-variation-settings", null) setCSSProp("font-variation-settings", null)
@ -892,7 +900,7 @@ function main() {
document.body.classList.toggle('varfont', on) document.body.classList.toggle('varfont', on)
if (on) { if (on) {
if (!isInitial) { if (!isInitial) {
// copy value of const weight to var weight // copy value of static weight to var weight
let w = parseInt(varWeight.getValue()) let w = parseInt(varWeight.getValue())
if (!isNaN(w) && varWeightRange && !varWeightSettingValueImpl) { if (!isNaN(w) && varWeightRange && !varWeightSettingValueImpl) {
varWeightRange.setValue(w) varWeightRange.setValue(w)
@ -904,7 +912,7 @@ function main() {
// ) // )
} else { } else {
if (!isInitial && varWeightRange) { if (!isInitial && varWeightRange) {
// copy value of var weight to const weight // copy value of var weight to static weight
let w = varWeightRange.getValue() let w = varWeightRange.getValue()
if (!isNaN(w)) { if (!isNaN(w)) {
vars.setValue("weight", Math.round(w / 100) * 100) vars.setValue("weight", Math.round(w / 100) * 100)
@ -920,15 +928,18 @@ function main() {
}) })
let varWeightNum = vars.bind('varWeightNum', (e, v) => { let varWeightNum = vars.bind('varWeightNum', (e, v) => {
if (varWeightRange && !varWeightSettingValueImpl) { if (varWeightRange && !varWeightSettingValueImpl)
varWeightRange.setValue(v) varWeightRange.setValue(v)
}
}) })
let varSlantNum = vars.bind('varSlantNum', (e, v) => { let varSlantNum = vars.bind('varSlantNum', (e, v) => {
if (varSlantRange && !varSlantSettingValueImpl) { if (varSlantRange && !varSlantSettingValueImpl)
varSlantRange.setValue(v) varSlantRange.setValue(v)
} })
let varOpszNum = vars.bind('varOpszNum', (e, v) => {
if (varOpszRange && !varOpszSettingValueImpl)
varOpszRange.setValue(v)
}) })
varWeightRange = vars.bind('varWeight', (e, v) => { varWeightRange = vars.bind('varWeight', (e, v) => {
@ -961,6 +972,19 @@ function main() {
return e.valueAsNumber !== undefined ? e.valueAsNumber : e.value return e.valueAsNumber !== undefined ? e.valueAsNumber : e.value
}) })
varOpszRange = vars.bind('varOpsz', (e, v) => {
varState.opsz = v
varOpszSettingValueImpl = true
varOpszNum.setValue(v)
varOpszSettingValueImpl = false
updateVarFont()
}, (e, prevValue, ev) => {
if (prevValue === undefined) {
return 0
}
return e.valueAsNumber !== undefined ? e.valueAsNumber : e.value
})
// compare // compare
let secondarySampleClassNameAddition = null let secondarySampleClassNameAddition = null

View File

@ -543,12 +543,12 @@ body.sidebar-minimized .options {
user-select: none; -moz-user-select: none; -webkit-user-select:none; user-select: none; -moz-user-select: none; -webkit-user-select:none;
} }
.options .varfontControl, .options .varfontControl,
.options .constfontControl { .options .staticfontControl {
transition: all 168ms cubic-bezier(0.17, 0.65, 0.48, 1); transition: all 168ms cubic-bezier(0.17, 0.65, 0.48, 1);
transition-property: opacity, height, margin; transition-property: opacity, height, margin;
} }
.options .varfontControl, .options .varfontControl,
body.varfont .options .constfontControl { body.varfont .options .staticfontControl {
pointer-events:none; pointer-events:none;
overflow: hidden; overflow: hidden;
opacity:0; opacity:0;
@ -562,7 +562,7 @@ body.sidebar-minimized .options {
height: var(--fieldHeight); height: var(--fieldHeight);
margin-bottom: var(--rowBottomMargin); margin-bottom: var(--rowBottomMargin);
} }
/*body.varfont .options .constfontControl { /*body.varfont .options .staticfontControl {
display: none; display: none;
}*/ }*/
.options .varfontControl .label-and-value { .options .varfontControl .label-and-value {

View File

@ -316,6 +316,7 @@ else
fi fi
# note: ttfautohint is no longer used by the new Makefile
AUTOHINT_VERSION=1.8.2 AUTOHINT_VERSION=1.8.2
AUTOHINT_SRC_VERSION=1.8.2.8 AUTOHINT_SRC_VERSION=1.8.2.8
LINK=false LINK=false

View File

@ -13,6 +13,7 @@ import logging
import re import re
import signal import signal
import subprocess import subprocess
import defcon
from fontTools.designspaceLib import DesignSpaceDocument from fontTools.designspaceLib import DesignSpaceDocument
from mutatorMath.ufo.document import DesignSpaceDocumentReader from mutatorMath.ufo.document import DesignSpaceDocumentReader
@ -445,7 +446,7 @@ class Main(object):
source.styleName = "Thin Italic" source.styleName = "Thin Italic"
source.name = "thinitalic" source.name = "thinitalic"
source.font.info.styleName = source.styleName source.font.info.styleName = source.styleName
else: elif source.styleName:
# name "Black" => "black" # name "Black" => "black"
source.name = source.styleName.lower().replace(' ', '') source.name = source.styleName.lower().replace(' ', '')
@ -521,8 +522,9 @@ class Main(object):
verbose=True verbose=True
) )
designspace = DesignSpaceDocument() designspace = DesignSpaceDocument.fromfile(designspace_file)
designspace.read(designspace_file)
master0_ufo = defcon.Font(designspace.sources[0].path)
# Generate UFOs for instances # Generate UFOs for instances
instance_weight = dict() instance_weight = dict()
@ -544,29 +546,35 @@ class Main(object):
if len(instances) > 0: if len(instances) > 0:
fatal('unknown style(s): %s' % ', '.join(list(instances))) fatal('unknown style(s): %s' % ', '.join(list(instances)))
ufos = apply_instance_data(designspace_file, instance_files) ufos = apply_instance_data(designspace, instance_files)
# patch ufos (list of defcon.Font instances) # patch ufos (list of defcon.Font instances)
italicAngleKey = 'com.schriftgestaltung.customParameter.' +\ italicAngleKey = 'com.schriftgestaltung.customParameter.' +\
'InstanceDescriptorAsGSInstance.italicAngle' 'InstanceDescriptorAsGSInstance.italicAngle'
for font in ufos: for ufo in ufos:
# set metrics
ufo.info.ascender = master0_ufo.info.ascender
ufo.info.capHeight = master0_ufo.info.capHeight
ufo.info.descender = master0_ufo.info.descender
ufo.info.xHeight = master0_ufo.info.xHeight
# move italicAngle from lib to info # move italicAngle from lib to info
italicAngle = font.lib.get(italicAngleKey) italicAngle = ufo.lib.get(italicAngleKey)
if italicAngle != None: if italicAngle != None:
italicAngle = float(italicAngle) italicAngle = float(italicAngle)
del(font.lib[italicAngleKey]) del(ufo.lib[italicAngleKey])
font.info.italicAngle = italicAngle ufo.info.italicAngle = italicAngle
# clear anchors # clear anchors
if EXCLUDE_ANCHORS: if EXCLUDE_ANCHORS:
for g in font: for g in ufo:
g.clearAnchors() g.clearAnchors()
# update font info # update font info
weight = instance_weight[basename(font.path)] weight = instance_weight[basename(ufo.path)]
setFontInfo(font, weight) setFontInfo(ufo, weight)
font.save() ufo.save()
def checkfont(self, fontfile, q): def checkfont(self, fontfile, q):

View File

@ -0,0 +1,71 @@
#MenuTitle: Generate opsz brace layers
# -*- coding: utf-8 -*-
import GlyphsApp
import copy
Font = Glyphs.font
selectedLayers = Font.selectedLayers
# Glyphs.font.selection - selected glyphs in "Font" tab
# Glyphs.font.selectedFontMaster
def build_axis_coordinates(g, master):
coordinates = {}
for i in range(len(g.parent.axes)):
axis = g.parent.axes[i]
if axis.axisTag == "opsz":
coordinates[axis.axisId] = 72
else:
coordinates[axis.axisId] = master.axes[i]
return coordinates
def process_glyph(g, axes):
print("processing glyph %r" % g.name)
existing_opsz_layers = {}
for layer in g.layers:
# print("- %s (%r) %r" % (
# layer.name, layer.associatedMasterId, layer.attributes['coordinates']))
if layer.attributes['coordinates']:
existing_opsz_layers[layer.associatedMasterId] = layer
# print("existing_opsz_layers %r" % existing_opsz_layers)
for master in g.parent.masters:
if master.name.startswith("Regular"):
# Regular uses dedicated master for opsz
continue
layer = g.layers[master.id]
# print("%s" % layer.name)
if master.id in existing_opsz_layers:
print("skip layer %s with existing opsz brace layer" % layer.name)
continue
newLayer = layer.copy()
# Note: "same name" matters for designspace generation!
newLayer.name = "opsz"
newLayer.associatedMasterId = master.id
newLayer.attributes['coordinates'] = build_axis_coordinates(g, master)
g.layers.append(newLayer)
print("layer.guides %r" % layer.guides)
print("created layer %s (copy of %r)" % (newLayer.name, layer.name))
if Glyphs.font and Glyphs.font.selectedLayers:
try:
Glyphs.font.disableUpdateInterface()
glyphs = set([l.parent for l in Glyphs.font.selectedLayers])
print(glyphs)
axes = {}
for i in range(len(Glyphs.font.axes)):
axis = Glyphs.font.axes[i]
axes[axis.axisTag] = {"index":i, "axis":axis}
# print("%r => %r" % (axis.axisTag, axis.axisId))
for g in glyphs:
try:
g.beginUndo()
process_glyph(g, axes)
finally:
g.endUndo()
finally:
Glyphs.font.enableUpdateInterface()

View File

@ -138,6 +138,7 @@ fi
# copy misc stuff # copy misc stuff
cp misc/dist/install*.txt "$ZIPDIR/" cp misc/dist/install*.txt "$ZIPDIR/"
cp LICENSE.txt "$ZIPDIR/" cp LICENSE.txt "$ZIPDIR/"
mkdir -p "$(dirname "$OUTFILE_ABS")"
# wait for processes to finish # wait for processes to finish
wait wait

111
misc/makezip2.sh Normal file
View File

@ -0,0 +1,111 @@
#!/bin/bash -e
cd "$(dirname "$0")/.."
OPT_HELP=false
OPT_REVEAL_IN_FINDER=false
OUTFILE=
# parse args
while [[ $# -gt 0 ]]; do
case "$1" in
-h*|--h*)
OPT_HELP=true
shift
;;
-reveal-in-finder)
OPT_REVEAL_IN_FINDER=true
shift
;;
-*)
echo "$0: Unknown option $1" >&2
OPT_HELP=true
shift
;;
*)
if [[ "$OUTFILE" != "" ]] && ! $OPT_HELP; then
echo "$0: Extra unexpected argument(s) after <outfile>" >&2
OPT_HELP=true
fi
OUTFILE=$1
shift
;;
esac
done
if $OPT_HELP; then
echo "Usage: $0 [options] <outfile>"
echo "Options:"
echo " -h, -help Show help."
echo " -reveal-in-finder After creating the zip file, show it in Finder"
exit 1
fi
# tmp dir
ZIPDIR=build/tmp/zip
FONTDIR=build/fonts
# convert relative path to absolute if needed
OUTFILE_ABS=$OUTFILE
if [[ "$OUTFILE_ABS" != /* ]]; then
OUTFILE_ABS=$PWD/$OUTFILE_ABS
fi
# cleanup any previous build
rm -rf "$ZIPDIR"
rm -f build/tmp/a.zip
# create directories
mkdir -p \
"$ZIPDIR/Inter Desktop" \
"$ZIPDIR/Inter Hinted for Windows/Desktop" \
"$ZIPDIR/Inter Hinted for Windows/Web" \
"$ZIPDIR/Inter Variable" \
"$ZIPDIR/Inter Variable/Single axis" \
"$ZIPDIR/Inter Web"
# copy font files
# ----------------------------------------------------------------------------
# Inter Desktop
cp $FONTDIR/static/Inter-*.otf "$ZIPDIR/Inter Desktop/" &
cp $FONTDIR/var/Inter-V.var.ttf "$ZIPDIR/Inter Desktop/Inter-V.ttf" &
# Inter Hinted for Windows
cp "misc/dist/about hinted fonts.txt" "$ZIPDIR/Inter Hinted for Windows/" &
cp $FONTDIR/static-hinted/Inter-*.ttf "$ZIPDIR/Inter Hinted for Windows/Desktop/" &
cp $FONTDIR/static-hinted/Inter-*.woff* "$ZIPDIR/Inter Hinted for Windows/Web/" &
cp misc/dist/inter.css "$ZIPDIR/Inter Hinted for Windows/Web/" &
# Inter Variable
cp $FONTDIR/var/Inter.var.ttf \
"$ZIPDIR/Inter Variable/Inter.ttf" &
cp $FONTDIR/var/Inter-roman.var.ttf \
"$ZIPDIR/Inter Variable/Single axis/Inter-roman.ttf" &
cp $FONTDIR/var/Inter-italic.var.ttf \
"$ZIPDIR/Inter Variable/Single axis/Inter-italic.ttf" &
# Inter Web
cp $FONTDIR/static/Inter-*.woff* "$ZIPDIR/Inter Web/" &
cp $FONTDIR/var/Inter.var.woff2 "$ZIPDIR/Inter Web/" &
cp $FONTDIR/var/Inter-roman.var.woff2 "$ZIPDIR/Inter Web/" &
cp $FONTDIR/var/Inter-italic.var.woff2 "$ZIPDIR/Inter Web/" &
cp misc/dist/inter.css "$ZIPDIR/Inter Web/" &
# ----------------------------------------------------------------------------
# copy misc stuff
cp misc/dist/install*.txt "$ZIPDIR/"
cp LICENSE.txt "$ZIPDIR/"
mkdir -p "$(dirname "$OUTFILE_ABS")"
# wait for processes to finish
wait
# zip
pushd "$ZIPDIR" >/dev/null
zip -q -X -r "$OUTFILE_ABS" *
popd >/dev/null
rm -rf "$ZIPDIR"
echo "Created $OUTFILE"
if $OPT_REVEAL_IN_FINDER && [ -f /usr/bin/open ]; then
/usr/bin/open --reveal "$OUTFILE"
fi

View File

@ -0,0 +1,32 @@
# Updates "?v=x" in files
import os, sys, re
from os.path import dirname, basename, abspath, relpath, join as pjoin
sys.path.append(abspath(pjoin(dirname(__file__), 'tools')))
from common import BASEDIR, getVersion
version = getVersion()
def updateCSSFile(filename):
regex = re.compile(r'(url\("[^"]+?v=)([^"]+)("\))')
with open(filename, 'r') as f:
s = f.read()
s = regex.sub(lambda m: '%s%s%s' % (m.group(1), version, m.group(3)), s)
with open(filename, 'w') as f:
f.write(s)
def updateHTMLFile(filename):
regex = re.compile(r'((?:href|src)="[^"]+?v=)([^"]+)(")')
with open(filename, 'r') as f:
s = f.read()
s = regex.sub(lambda m: '%s%s%s' % (m.group(1), version, m.group(3)), s)
with open(filename, 'w') as f:
f.write(s)
for fn in sys.argv[1:]:
if fn.endswith(".css"):
updateCSSFile(fn)
elif fn.endswith(".html"):
updateHTMLFile(fn)
else:
raise "Unexpected file type %r" % fn

View File

@ -0,0 +1,91 @@
import sys, os, os.path, re
import defcon
from multiprocessing import Pool
from fontTools.designspaceLib import DesignSpaceDocument
from datetime import datetime
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'tools')))
from common import getGitHash, getVersion
def update_version(ufo):
version = getVersion()
buildtag, buildtagErrs = getGitHash()
now = datetime.utcnow()
if buildtag == "" or len(buildtagErrs) > 0:
buildtag = "src"
print("warning: getGitHash() failed: %r" % buildtagErrs, file=sys.stderr)
versionMajor, versionMinor = [int(num) for num in version.split(".")]
ufo.info.versionMajor = versionMajor
ufo.info.versionMinor = versionMinor
ufo.info.year = now.year
ufo.info.openTypeNameVersion = "Version %d.%03d;git-%s" % (versionMajor, versionMinor, buildtag)
psFamily = re.sub(r'\s', '', ufo.info.familyName)
psStyle = re.sub(r'\s', '', ufo.info.styleName)
ufo.info.openTypeNameUniqueID = "%s-%s:%d:%s" % (psFamily, psStyle, now.year, buildtag)
ufo.info.openTypeHeadCreated = now.strftime("%Y/%m/%d %H:%M:%S")
def fix_opsz_maximum(designspace):
for a in designspace.axes:
if a.tag == "opsz":
# TODO: find maximum by looking at the source
a.maximum = 72
break
return designspace
def should_decompose_glyph(g):
# A trivial glyph is one that does not use components or where component transformation
# does not include mirroring (i.e. "flipped").
if g.components and len(g.components) > 0:
for c in g.components:
# has non-trivial transformation? (i.e. scaled)
# Example of optimally trivial transformation:
# (1, 0, 0, 1, 0, 0) no scale or offset
# Example of scaled transformation matrix:
# (-1.0, 0, 0.3311, 1, 1464.0, 0) flipped x axis, sheered and offset
xScale = c.transformation[0]
yScale = c.transformation[3]
# If glyph is reflected along x or y axes, it won't slant well.
if xScale < 0 or yScale < 0:
return True
return False
def find_glyphs_to_decompose(designspace):
source = designspace.sources[int(len(designspace.sources)/2)]
print("find_glyphs_to_decompose sourcing from %r" % source.name)
ufo = defcon.Font(source.path)
return sorted([g.name for g in ufo if should_decompose_glyph(g)])
def set_ufo_filter(ufo, **filter_dict):
filters = ufo.lib.setdefault("com.github.googlei18n.ufo2ft.filters", [])
for i in range(len(filters)):
if filters[i].get("name") == filter_dict["name"]:
filters[i] = filter_dict
return
filters.append(filter_dict)
def update_source_ufo(ufo_file, glyphs_to_decompose):
print("update %s" % os.path.basename(ufo_file))
ufo = defcon.Font(ufo_file)
update_version(ufo)
set_ufo_filter(ufo, name="decomposeComponents", include=glyphs_to_decompose)
ufo.save(ufo_file)
def update_sources(designspace):
glyphs_to_decompose = find_glyphs_to_decompose(designspace)
#print("glyphs marked to be decomposed: %s" % ', '.join(glyphs_to_decompose))
sources = [source for source in designspace.sources]
# sources = [s for s in sources if s.name == "Inter Thin"] # DEBUG
source_files = list(set([s.path for s in sources]))
with Pool(len(source_files)) as p:
p.starmap(update_source_ufo, [(file, glyphs_to_decompose) for file in source_files])
return designspace
def main(argv):
designspace_file = argv[1]
designspace = DesignSpaceDocument.fromfile(designspace_file)
designspace = fix_opsz_maximum(designspace)
designspace = update_sources(designspace)
designspace.write(designspace_file)
if __name__ == '__main__':
main(sys.argv)

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python
# #
# from gftools # from gftools
# https://github.com/googlefonts/gftools/blob/ # https://github.com/googlefonts/gftools/blob/

View File

@ -0,0 +1,115 @@
import sys, os, os.path, argparse, re
from fontTools.ttLib import TTFont
# Adoptation of fonttools/blob/master/Snippets/rename-fonts.py
WINDOWS_ENGLISH_IDS = 3, 1, 0x409
MAC_ROMAN_IDS = 1, 0, 0
LEGACY_FAMILY = 1
SUBFAMILY_NAME = 2
TRUETYPE_UNIQUE_ID = 3
FULL_NAME = 4
POSTSCRIPT_NAME = 6
PREFERRED_FAMILY = 16
TYPO_SUBFAMILY_NAME = 17
WWS_FAMILY = 21
FAMILY_RELATED_IDS = set([
LEGACY_FAMILY,
TRUETYPE_UNIQUE_ID,
FULL_NAME,
POSTSCRIPT_NAME,
PREFERRED_FAMILY,
WWS_FAMILY,
])
whitespace_re = re.compile(r'\s+')
def removeWhitespace(s):
return whitespace_re.sub("", s)
def set_full_name(font, fullName, fullNamePs):
nameTable = font["name"]
nameTable.setName(fullName, FULL_NAME, 1, 0, 0) # mac
nameTable.setName(fullName, FULL_NAME, 3, 1, 0x409) # windows
nameTable.setName(fullNamePs, POSTSCRIPT_NAME, 1, 0, 0) # mac
nameTable.setName(fullNamePs, POSTSCRIPT_NAME, 3, 1, 0x409) # windows
def get_family_name(font):
nameTable = font["name"]
r = None
for plat_id, enc_id, lang_id in (WINDOWS_ENGLISH_IDS, MAC_ROMAN_IDS):
for name_id in (PREFERRED_FAMILY, LEGACY_FAMILY):
r = nameTable.getName(nameID=name_id, platformID=plat_id, platEncID=enc_id, langID=lang_id)
if r is not None:
break
if r is not None:
break
if not r:
raise ValueError("family name not found")
return r.toUnicode()
def fix_fullname(font):
fullName = get_family_name(font)
fullNamePs = removeWhitespace(fullName)
set_full_name(font, fullName, fullNamePs)
return fullName
def clear_subfamily_name(font):
nameTable = font["name"]
rmrecs = []
for rec in nameTable.names:
if rec.nameID == SUBFAMILY_NAME or rec.nameID == TYPO_SUBFAMILY_NAME:
rmrecs.append(rec)
for rec in rmrecs:
nameTable.removeNames(rec.nameID, rec.platformID, rec.platEncID, rec.langID)
def fix_unique_id(font, fullName):
fontIdRecs = []
newId = ''
nameTable = font["name"]
for rec in nameTable.names:
if rec.nameID == TRUETYPE_UNIQUE_ID:
if newId == '':
oldId = rec.toUnicode()
newId = removeWhitespace(fullName)
p = oldId.find(':')
if p > -1:
newId += oldId[p:]
fontIdRecs.append(rec)
for rec in fontIdRecs:
nameTable.setName(newId, rec.nameID, rec.platformID, rec.platEncID, rec.langID)
def main():
argparser = argparse.ArgumentParser(description='Fix names in variable font')
a = lambda *args, **kwargs: argparser.add_argument(*args, **kwargs)
a('-o', '--output', metavar='<file>',
help='Output font file. Defaults to input file (overwrite)')
a('input', metavar='<file>',
help='Input font file')
args = argparser.parse_args()
infile = args.input
outfile = args.output or infile
font = TTFont(infile, recalcBBoxes=False, recalcTimestamp=False)
fullName = fix_fullname(font)
fix_unique_id(font, fullName)
clear_subfamily_name(font)
font.save(outfile)
font.close()
if __name__ == '__main__':
main()

171
misc/tools/rename.py Normal file
View File

@ -0,0 +1,171 @@
import sys, os, os.path, argparse, re
from fontTools.ttLib import TTFont
# Adoptation of fonttools/blob/master/Snippets/rename-fonts.py
WINDOWS_ENGLISH_IDS = 3, 1, 0x409
MAC_ROMAN_IDS = 1, 0, 0
LEGACY_FAMILY = 1
TRUETYPE_UNIQUE_ID = 3
FULL_NAME = 4
POSTSCRIPT_NAME = 6
PREFERRED_FAMILY = 16
SUBFAMILY_NAME = 17
WWS_FAMILY = 21
FAMILY_RELATED_IDS = set([
LEGACY_FAMILY,
TRUETYPE_UNIQUE_ID,
FULL_NAME,
POSTSCRIPT_NAME,
PREFERRED_FAMILY,
WWS_FAMILY,
])
whitespace_re = re.compile(r'\s+')
def removeWhitespace(s):
return whitespace_re.sub("", s)
def setFullName(font, fullName):
nameTable = font["name"]
nameTable.setName(fullName, FULL_NAME, 1, 0, 0) # mac
nameTable.setName(fullName, FULL_NAME, 3, 1, 0x409) # windows
nameTable.setName(fullName, POSTSCRIPT_NAME, 1, 0, 0) # mac
nameTable.setName(fullName, POSTSCRIPT_NAME, 3, 1, 0x409) # windows
def getFamilyName(font):
nameTable = font["name"]
r = None
for plat_id, enc_id, lang_id in (WINDOWS_ENGLISH_IDS, MAC_ROMAN_IDS):
for name_id in (PREFERRED_FAMILY, LEGACY_FAMILY):
r = nameTable.getName(nameID=name_id, platformID=plat_id, platEncID=enc_id, langID=lang_id)
if r is not None:
break
if r is not None:
break
if not r:
raise ValueError("family name not found")
return r.toUnicode()
def renameStylesGoogleFonts(font):
familyName = getFamilyName(font)
# collect subfamily (style) name IDs for variable font's named instances
vfInstanceSubfamilyNameIds = set()
if "fvar" in font:
for namedInstance in font["fvar"].instances:
vfInstanceSubfamilyNameIds.add(namedInstance.subfamilyNameID)
nameTable = font["name"]
for rec in nameTable.names:
rid = rec.nameID
if rid in (FULL_NAME, LEGACY_FAMILY):
# style part of family name
s = rec.toUnicode()
start = s.find(familyName)
if start != -1:
s = familyName + " " + removeWhitespace(s[start + len(familyName):])
else:
s = removeWhitespace(s)
if s != "Italic" and s.endswith("Italic"):
# fixup e.g. "ExtraBoldItalic" -> "ExtraBold Italic"
s = s[:len(s) - len("Italic")] + " Italic"
rec.string = s.strip()
if rid in (SUBFAMILY_NAME,) or rid in vfInstanceSubfamilyNameIds:
s = removeWhitespace(rec.toUnicode())
if s != "Italic" and s.endswith("Italic"):
# fixup e.g. "ExtraBoldItalic" -> "ExtraBold Italic"
s = s[:len(s) - len("Italic")] + " Italic"
rec.string = s.strip()
# else: ignore standard names unrelated to style
def setFamilyName(font, nextFamilyName):
prevFamilyName = getFamilyName(font)
if prevFamilyName == nextFamilyName:
return
# raise Exception("identical family name")
def renameRecord(nameRecord, prevFamilyName, nextFamilyName):
# replaces prevFamilyName with nextFamilyName in nameRecord
s = nameRecord.toUnicode()
start = s.find(prevFamilyName)
if start != -1:
end = start + len(prevFamilyName)
nextFamilyName = s[:start] + nextFamilyName + s[end:]
nameRecord.string = nextFamilyName
return s, nextFamilyName
# postcript name can't contain spaces
psPrevFamilyName = prevFamilyName.replace(" ", "")
psNextFamilyName = nextFamilyName.replace(" ", "")
for rec in font["name"].names:
name_id = rec.nameID
if name_id not in FAMILY_RELATED_IDS:
# leave uninteresting records unmodified
continue
if name_id == POSTSCRIPT_NAME:
old, new = renameRecord(rec, psPrevFamilyName, psNextFamilyName)
elif name_id == TRUETYPE_UNIQUE_ID:
# The Truetype Unique ID rec may contain either the PostScript Name or the Full Name
if psPrevFamilyName in rec.toUnicode():
# Note: This is flawed -- a font called "Foo" renamed to "Bar Lol";
# if this record is not a PS record, it will incorrectly be rename "BarLol".
# However, in practice this is not abig deal since it's just an ID.
old, new = renameRecord(rec, psPrevFamilyName, psNextFamilyName)
else:
old, new = renameRecord(rec, prevFamilyName, nextFamilyName)
else:
old, new = renameRecord(rec, prevFamilyName, nextFamilyName)
# print(" %r: '%s' -> '%s'" % (rec, old, new))
def main():
argparser = argparse.ArgumentParser(
description='Rename family and/or styles of font'
)
a = lambda *args, **kwargs: argparser.add_argument(*args, **kwargs)
a('-o', '--output', metavar='<file>',
help='Output font file. Defaults to input file (overwrite)')
a('--family', metavar='<name>',
help='Rename family to <name>')
a('--google-style', action='store_true',
help='Rename style names to Google Fonts standards')
a('input', metavar='<file>',
help='Input font file')
args = argparser.parse_args()
infile = args.input
outfile = args.output or infile
font = TTFont(infile, recalcBBoxes=False, recalcTimestamp=False)
editCount = 0
try:
if args.family:
editCount += 1
setFamilyName(font, args.family)
if args.google_style:
editCount += 1
renameStylesGoogleFonts(font)
if editCount == 0:
print("no rename options provided", file=sys.stderr)
argparser.print_help(sys.stderr)
sys.exit(1)
return
font.save(outfile)
finally:
font.close()
if __name__ == '__main__':
main()

View File

@ -0,0 +1,53 @@
#!/usr/bin/env python
import sys, os
from os.path import dirname, basename, abspath, relpath, join as pjoin
from fontTools.designspaceLib import DesignSpaceDocument
def subset_designspace(designspace, filename):
italic = filename.find('italic') != -1
rmlist = []
for a in designspace.axes:
if a.tag == "slnt" or a.tag == "ital" or a.tag == "opsz":
rmlist.append(a)
for a in rmlist:
designspace.axes.remove(a)
rmlist = []
hasDefault = not italic
for source in designspace.sources:
isitalic = source.name.find('Italic') != -1
if italic != isitalic or source.name.endswith('Display') or source.name.endswith('opsz'):
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)
print("write %s" % relpath(filename, os.getcwd()))
designspace.write(filename)
def main(argv):
src_designspace_file = argv[1]
dst_designspace_file = argv[2]
designspace = DesignSpaceDocument.fromfile(src_designspace_file)
designspace.lib.clear()
subset_designspace(designspace, dst_designspace_file)
if __name__ == '__main__':
main(sys.argv)

View File

@ -1,10 +1,10 @@
fonttools[lxml,unicode,ufo]==4.33.3 fonttools[lxml,unicode,ufo]==4.33.3
cu2qu==1.6.7.post1 cu2qu==1.6.7.post1
glyphsLib==5.3.2 glyphsLib==6.0.5
ufo2ft[pathops]==2.27.0 ufo2ft[pathops]==2.27.0
defcon[lxml]==0.8.1 defcon[lxml]==0.10.1
skia-pathops==0.7.2 skia-pathops==0.7.2
gftools==0.7.0 gftools==0.9.11
# only used for DesignSpaceDocumentReader in fontbuild # only used for DesignSpaceDocumentReader in fontbuild
MutatorMath==3.0.1 MutatorMath==3.0.1
@ -13,4 +13,6 @@ MutatorMath==3.0.1
brotli==1.0.9 brotli==1.0.9
# for QA # for QA
fontbakery==0.7.37 fontbakery==0.8.8
fontmake==3.3.0

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
3.19 4.00