Skip to content

Commit

Permalink
Major overhaul, moving from UFO2 to Glyphs and UFO3, plus a brand new…
Browse files Browse the repository at this point in the history
… and much simpler fontbuild
  • Loading branch information
rsms committed Sep 3, 2018
1 parent 8c1a4c1 commit c833e25
Show file tree
Hide file tree
Showing 5,246 changed files with 346,944 additions and 163,490 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
_*.ignore
*~
.DS_Store
*.sparseimage
nohup.out

build
Expand Down
117 changes: 67 additions & 50 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,71 +10,88 @@
# install Build all (web, ttf and otf) and install. Mac-only for now.
# dist Create a new release distribution. Does everything.
#
all: all_ttf all_otf
$(MAKE) all_web -j
all: all_fonts
all_unhinted: all_ttf all_otf all_web
all_hinted: all_ttf_hinted all_web_hinted

all_hinted: all_ttf all_ttf_hinted all_otf
$(MAKE) all_web_hinted -j
VERSION := $(shell cat version.txt)

VERSION := $(shell misc/version.py)
export PATH := $(PWD)/build/venv/bin:$(PATH)

# generated.make is automatically generated by init.sh and defines depenencies for
# all styles and alias targets
include build/etc/generated.make

res_files := src/fontbuild.cfg src/diacritics.txt src/glyphlist.txt \
src/features.fea src/glyphorder.txt

# UFO -> TTF & OTF (note that UFO deps are defined by generated.make)
build/tmp/InterUITTF/InterUI-%.ttf: $(res_files)
misc/ufocompile --otf $*
# TTF -> WOFF2
build/%.woff2: build/%.ttf
woff2_compress "$<"

# TTF -> WOFF
build/%.woff: build/%.ttf
ttf2woff -O -t woff "$<" "$@"

# TTF -> EOT (disabled)
# build/%.eot: build/%.ttf
# ttf2eot "$<" > "$@"


# UFO -> OTF, TTF
build/unhinted/Inter-UI-Regular.%: master_ufo_regular
misc/fontbuild compile -o $@ src/Inter-UI-Regular.ufo

build/unhinted/Inter-UI-Black.%: master_ufo_black
misc/fontbuild compile -o $@ src/Inter-UI-Black.ufo

build/unhinted/Inter-UI-%.otf: build/ufo/Inter-UI-%.ufo
misc/fontbuild compile -o $@ $<

build/tmp/InterUIOTF/InterUI-%.otf: build/tmp/InterUITTF/InterUI-%.ttf $(res_files)
@true
build/unhinted/Inter-UI-%.ttf: build/ufo/Inter-UI-%.ufo
misc/fontbuild compile -o $@ $<

# tmp/ttf -> dist
build/dist-unhinted/Inter-UI-%.ttf: build/tmp/InterUITTF/InterUI-%.ttf
@mkdir -p build/dist-unhinted
cp -a "$<" "$@"

# tmp/otf -> dist
build/dist-unhinted/Inter-UI-%.otf: build/tmp/InterUIOTF/InterUI-%.otf
@mkdir -p build/dist-unhinted
cp -a "$<" "$@"
# designspace <- glyphs file
src/Inter-UI.designspace: src/Inter-UI.glyphs
misc/fontbuild glyphsync $<

# autohint
build/dist-hinted/Inter-UI-%.ttf: build/dist-unhinted/Inter-UI-%.ttf
@mkdir -p build/dist-hinted
ttfautohint \
# instance UFOs <- master UFOs
build/ufo/Inter-UI-%.ufo: master_ufo_regular master_ufo_black
misc/fontbuild instancegen src/Inter-UI.designspace $*

# master UFOs <- designspace
master_ufo_regular: src/Inter-UI.designspace $(Regular_ufo_d)
master_ufo_black: src/Inter-UI.designspace $(Black_ufo_d)

# Note: The seemingly convoluted dependency graph above is required to
# make sure that glyphsync and instancegen are not run in parallel.

.PHONY: master_ufo_regular master_ufo_black


# hinted TTF files via autohint
build/hinted/%.ttf: build/unhinted/%.ttf
@mkdir -p build/hinted
@echo ttfautohint "$<" "$@"
@ttfautohint \
--hinting-limit=256 \
--hinting-range-min=8 \
--hinting-range-max=64 \
--fallback-stem-width=256 \
--strong-stem-width=D \
--no-info \
--verbose \
"$<" "$@"

# TTF -> WOFF2
build/%.woff2: build/%.ttf
woff2_compress "$<"

# TTF -> WOFF
build/%.woff: build/%.ttf
ttf2woff -O -t woff "$<" "$@"

# TTF -> EOT (disabled)
# build/%.eot: build/%.ttf
# ttf2eot "$<" > "$@"
# test runs all tests
# Note: all_check is generated by init.sh and runs "fontbuild checkfont"
# on all otf and ttf files.
test: all_check

test: all_otf
@misc/check-font.py build/dist-unhinted/*.otf

ZIP_FILE_DIST := build/release/Inter-UI-${VERSION}.zip
ZIP_FILE_DEV := build/release/Inter-UI-${VERSION}-$(shell git rev-parse --short=10 HEAD).zip

# zip intermediate
build/.zip.zip: all_otf
build/.zip.zip: all_otf all_ttf
$(MAKE) all_web all_web_hinted -j
@rm -rf build/.zip
@rm -f build/.zip.zip
Expand All @@ -84,15 +101,15 @@ build/.zip.zip: all_otf
"build/.zip/Inter UI (TTF)" \
"build/.zip/Inter UI (TTF hinted)" \
"build/.zip/Inter UI (OTF)"
@cp -a build/dist-unhinted/*.woff build/dist-unhinted/*.woff2 \
@cp -a build/unhinted/*.woff build/unhinted/*.woff2 \
"build/.zip/Inter UI (web)/"
@cp -a misc/doc/inter-ui.css "build/.zip/Inter UI (web)/"
@cp -a build/dist-hinted/*.woff build/dist-hinted/*.woff2 \
@cp -a build/hinted/*.woff build/hinted/*.woff2 \
"build/.zip/Inter UI (web hinted)/"
@cp -a misc/doc/inter-ui.css "build/.zip/Inter UI (web hinted)/"
@cp -a build/dist-unhinted/*.ttf "build/.zip/Inter UI (TTF)/"
@cp -a build/dist-hinted/*.ttf "build/.zip/Inter UI (TTF hinted)/"
@cp -a build/dist-unhinted/*.otf "build/.zip/Inter UI (OTF)/"
@cp -a build/unhinted/*.ttf "build/.zip/Inter UI (TTF)/"
@cp -a build/hinted/*.ttf "build/.zip/Inter UI (TTF hinted)/"
@cp -a build/unhinted/*.otf "build/.zip/Inter UI (OTF)/"
@cp -a misc/doc/*.txt "build/.zip/"
@cp -a LICENSE.txt "build/.zip/"
cd build/.zip && zip -v -X -r "../../build/.zip.zip" * >/dev/null && cd ../..
Expand Down Expand Up @@ -133,28 +150,28 @@ dist: zip_dist
copy_docs_fonts:
rm -rf docs/font-files
mkdir docs/font-files
cp -a build/dist-unhinted/*.woff build/dist-unhinted/*.woff2 build/dist-unhinted/*.otf docs/font-files/
cp -a build/unhinted/*.woff build/unhinted/*.woff2 build/unhinted/*.otf docs/font-files/

install_ttf: all_ttf_unhinted
$(MAKE) all_web -j
@echo "Installing TTF files locally at ~/Library/Fonts/Inter UI"
rm -rf ~/'Library/Fonts/Inter UI'
mkdir -p ~/'Library/Fonts/Inter UI'
cp -va build/dist-unhinted/*.ttf ~/'Library/Fonts/Inter UI'
cp -va build/unhinted/*.ttf ~/'Library/Fonts/Inter UI'

install_ttf_hinted: all_ttf
$(MAKE) all_web -j
@echo "Installing autohinted TTF files locally at ~/Library/Fonts/Inter UI"
rm -rf ~/'Library/Fonts/Inter UI'
mkdir -p ~/'Library/Fonts/Inter UI'
cp -va build/dist-hinted/*.ttf ~/'Library/Fonts/Inter UI'
cp -va build/hinted/*.ttf ~/'Library/Fonts/Inter UI'

install_otf: all_otf
$(MAKE) all_web -j
@echo "Installing OTF files locally at ~/Library/Fonts/Inter UI"
rm -rf ~/'Library/Fonts/Inter UI'
mkdir -p ~/'Library/Fonts/Inter UI'
cp -va build/dist-unhinted/*.otf ~/'Library/Fonts/Inter UI'
cp -va build/unhinted/*.otf ~/'Library/Fonts/Inter UI'

install: install_otf

Expand Down Expand Up @@ -182,6 +199,6 @@ _local/UnicodeData.txt:
http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt

clean:
rm -rf build/tmp/* build/dist-hinted build/dist-unhinted
rm -rvf build/tmp build/hinted build/unhinted

.PHONY: all web clean install install_otf install_ttf deploy zip zip_dist pre_dist dist geninfo copy_docs_fonts all_hinted test
.PHONY: all web clean install install_otf install_ttf deploy zip zip_dist pre_dist dist geninfo copy_docs_fonts all_hinted test glyphsync
Loading

0 comments on commit c833e25

Please sign in to comment.