mirror of
https://github.com/rsms/inter.git
synced 2024-09-11 02:45:42 +03:00
makefile: UFO files move to build/ufo
This commit is contained in:
parent
e6b25408d9
commit
55d38ccee8
93
Makefile
93
Makefile
@ -19,7 +19,7 @@
|
||||
# all_var_hinted Build all variable font files with hints into
|
||||
# FONTDIR/var-hinted
|
||||
#
|
||||
# designspace Build src/Inter.designspace from src/Inter.glyphs
|
||||
# designspace Build build/ufo/Inter.designspace from src/Inter.glyphs
|
||||
#
|
||||
# Style-specific targets:
|
||||
# STYLE_otf Build OTF file for STYLE into FONTDIR/const
|
||||
@ -42,6 +42,7 @@ FONTDIR = build/fonts
|
||||
|
||||
all: all_const all_const_hinted all_var
|
||||
web: all_web
|
||||
.PHONY: all web
|
||||
|
||||
all_const: all_otf all_ttf all_web
|
||||
all_const_hinted: all_ttf_hinted all_web_hinted
|
||||
@ -58,13 +59,6 @@ all_var: \
|
||||
$(FONTDIR)/var/Inter-italic.var.otf \
|
||||
$(FONTDIR)/var/Inter-italic.var.woff2
|
||||
|
||||
all_ufo_masters = $(Thin_ufo_d) \
|
||||
$(ThinItalic_ufo_d) \
|
||||
$(Regular_ufo_d) \
|
||||
$(Italic_ufo_d) \
|
||||
$(Black_ufo_d) \
|
||||
$(BlackItalic_ufo_d)
|
||||
|
||||
# Hinted variable font disabled. See https://github.com/rsms/inter/issues/75
|
||||
# all_var_hinted: $(FONTDIR)/var-hinted/Inter.var.otf $(FONTDIR)/var-hinted/Inter.var.woff2
|
||||
# .PHONY: all_var_hinted
|
||||
@ -78,62 +72,63 @@ export PATH := $(PWD)/build/venv/bin:$(PATH)
|
||||
include build/etc/generated.make
|
||||
|
||||
|
||||
# TTF -> WOFF2
|
||||
# WOFF2 from OTF
|
||||
build/%.var.woff2: build/%.var.otf
|
||||
woff2_compress "$<"
|
||||
|
||||
# WOFF2 from TTF
|
||||
build/%.woff2: build/%.ttf
|
||||
woff2_compress "$<"
|
||||
|
||||
# TTF -> WOFF
|
||||
# WOFF from TTF
|
||||
build/%.woff: build/%.ttf
|
||||
ttf2woff -O -t woff "$<" "$@"
|
||||
|
||||
# make sure intermediate TTFs are not gc'd by make
|
||||
.PRECIOUS: build/%.ttf build/%.var.otf
|
||||
|
||||
|
||||
|
||||
# Master UFOs -> variable TTF
|
||||
$(FONTDIR)/var/Inter.var.otf: src/Inter.designspace $(all_ufo_masters) version.txt
|
||||
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
|
||||
# VF OTF from UFO
|
||||
$(FONTDIR)/var/Inter.var.otf: $(all_ufo_masters) version.txt
|
||||
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter.designspace
|
||||
|
||||
$(FONTDIR)/var/Inter-V.var.otf: $(FONTDIR)/var/Inter.var.otf
|
||||
misc/fontbuild rename --family "Inter V" -o $@ $<
|
||||
|
||||
$(FONTDIR)/var/Inter-%.var.otf: src/Inter-%.designspace $(all_ufo_masters) version.txt
|
||||
$(FONTDIR)/var/Inter-%.var.otf: build/ufo/Inter-%.designspace $(all_ufo_masters) version.txt
|
||||
misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $<
|
||||
misc/tools/fix-vf-meta.py $@
|
||||
|
||||
|
||||
# Instance UFO -> OTF, TTF (note: masters' rules in generated.make)
|
||||
# OTF/TTF from UFO
|
||||
$(FONTDIR)/const/Inter-%.otf: build/ufo/Inter-%.ufo version.txt
|
||||
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) $<
|
||||
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter-$*.ufo
|
||||
|
||||
$(FONTDIR)/const/Inter-%.ttf: build/ufo/Inter-%.ufo version.txt
|
||||
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) $<
|
||||
misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) build/ufo/Inter-$*.ufo
|
||||
|
||||
|
||||
# designspace <- glyphs file
|
||||
src/Inter-roman.designspace: src/Inter.designspace
|
||||
src/Inter-italic.designspace: src/Inter.designspace
|
||||
src/Inter.designspace: src/Inter.glyphs
|
||||
misc/fontbuild glyphsync $<
|
||||
# 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
|
||||
misc/fontbuild glyphsync -o build/ufo src/Inter.glyphs
|
||||
|
||||
# make sure intermediate files are not gc'd by make
|
||||
.PRECIOUS: src/Inter-*.designspace
|
||||
|
||||
designspace: src/Inter.designspace
|
||||
.PHONY: designspace
|
||||
|
||||
# short-circuit Make for performance
|
||||
src/Inter.glyphs:
|
||||
@true
|
||||
|
||||
# instance UFOs <- master UFOs
|
||||
build/ufo/Inter-%.ufo: build/ufo/features src/Inter.designspace $(all_ufo_masters)
|
||||
misc/fontbuild instancegen src/Inter.designspace $*
|
||||
# make sure intermediate files are not gc'd by make
|
||||
.PRECIOUS: build/ufo/Inter-*.designspace
|
||||
|
||||
build/ufo/features:
|
||||
designspace: build/ufo/Inter.designspace
|
||||
.PHONY: designspace
|
||||
|
||||
|
||||
# features
|
||||
src/features: $(wildcard src/features/*)
|
||||
touch "$@"
|
||||
@true
|
||||
build/ufo/features: src/features
|
||||
mkdir -p build/ufo
|
||||
ln -s ../../src/features build/ufo/features
|
||||
|
||||
@ -156,7 +151,10 @@ $(FONTDIR)/const-hinted/%.ttf: $(FONTDIR)/const/%.ttf
|
||||
# ttfautohint --fallback-stem-width=256 --no-info "$<" "$@"
|
||||
|
||||
# make sure intermediate TTFs are not gc'd by make
|
||||
.PRECIOUS: $(FONTDIR)/const/%.ttf $(FONTDIR)/const-hinted/%.ttf $(FONTDIR)/var/%.var.otf
|
||||
.PRECIOUS: $(FONTDIR)/const/%.ttf
|
||||
.PRECIOUS: $(FONTDIR)/const/%.otf
|
||||
.PRECIOUS: $(FONTDIR)/const-hinted/%.ttf
|
||||
.PRECIOUS: $(FONTDIR)/var/%.var.otf
|
||||
|
||||
|
||||
|
||||
@ -321,17 +319,18 @@ docs_fonts:
|
||||
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: build/UnicodeData.txt misc/tools/gen-glyphinfo.py $(Regular_ufo_d)
|
||||
misc/tools/gen-glyphinfo.py -ucd $< src/Inter-Regular.ufo > $@
|
||||
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: $(Regular_ufo_d) misc/tools/gen-metrics-and-svgs.py
|
||||
misc/tools/gen-metrics-and-svgs.py src/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
|
||||
|
||||
# Download latest Unicode data
|
||||
build/UnicodeData.txt:
|
||||
@echo fetch http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
|
||||
@curl '-#' -o "$@" http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
# Google fonts
|
||||
@ -370,8 +369,12 @@ install_otf: all_otf
|
||||
|
||||
install: install_otf
|
||||
|
||||
.PHONY: install install_otf install_ttf
|
||||
|
||||
|
||||
|
||||
# clean removes generated and built fonts in the build directory
|
||||
clean:
|
||||
rm -rvf build/tmp build/fonts
|
||||
rm -rvf build/tmp build/fonts build/ufo build/googlefonts
|
||||
|
||||
.PHONY: all web clean install install_otf install_ttf
|
||||
.PHONY: clean
|
||||
|
83
init.sh
83
init.sh
@ -374,6 +374,24 @@ else
|
||||
mkdir -p "$BUILD_DIR/etc"
|
||||
GEN_MAKE_FILE=$BUILD_DIR/etc/generated.make
|
||||
|
||||
# Warning about UFOs moving from src to build/ufo
|
||||
for f in src/Inter-*.ufo; do
|
||||
echo "" >&2
|
||||
echo "--------------------------- WARNING ----------------------------" >&2
|
||||
echo "" >&2
|
||||
echo " UFO files have moved from ./src to ./build/ufo" >&2
|
||||
echo "" >&2
|
||||
echo "If you are working with a UFO workflow, please manually move" >&2
|
||||
echo "your UFO source files from ./src to ./build/ufo." >&2
|
||||
echo "" >&2
|
||||
echo "If you are working in a Glyphps workflow, then simply remove" >&2
|
||||
echo "the UFO files in ./src to silence this warning." >&2
|
||||
echo "" >&2
|
||||
echo "----------------------------------------------------------------" >&2
|
||||
echo "" >&2
|
||||
break
|
||||
done
|
||||
|
||||
# Only generate if there are changes to the font sources or init.sh
|
||||
NEED_GENERATE=false
|
||||
if $clean || [[ ! -f "$GEN_MAKE_FILE" ]] || [[ "$0" -nt "$GEN_MAKE_FILE" ]]; then
|
||||
@ -383,7 +401,9 @@ else
|
||||
if $NEED_GENERATE; then
|
||||
break
|
||||
fi
|
||||
if has_newer "src/Inter-${style}.ufo" "$GEN_MAKE_FILE"; then
|
||||
if [[ ! -d "build/ufo/Inter-${style}.ufo" ]] || \
|
||||
has_newer "build/ufo/Inter-${style}.ufo" "$GEN_MAKE_FILE"
|
||||
then
|
||||
NEED_GENERATE=true
|
||||
fi
|
||||
done
|
||||
@ -392,46 +412,59 @@ else
|
||||
if $NEED_GENERATE; then
|
||||
echo "Generating '$GEN_MAKE_FILE'"
|
||||
echo "# Generated by init.sh -- do not modify manually" > "$GEN_MAKE_FILE"
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
all_styles=()
|
||||
instance_styles=()
|
||||
|
||||
# add master styles to style array
|
||||
for style in "${master_styles[@]}"; do
|
||||
all_styles+=( $style )
|
||||
echo -n "${style}_ufo_d := \$(wildcard" >> "$GEN_MAKE_FILE"
|
||||
echo -n " src/Inter-${style}.ufo/*.plist" >> "$GEN_MAKE_FILE"
|
||||
echo -n " src/Inter-${style}.ufo/*.fea" >> "$GEN_MAKE_FILE"
|
||||
echo -n " src/Inter-${style}.ufo/glyphs/*.plist" >> "$GEN_MAKE_FILE"
|
||||
echo -n " src/features/*" >> "$GEN_MAKE_FILE"
|
||||
# echo -n " src/Inter-${style}.ufo/glyphs/*.glif" >> "$GEN_MAKE_FILE"
|
||||
echo -n ")" >> "$GEN_MAKE_FILE"
|
||||
echo " src/Inter.designspace" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
|
||||
# master UFO targets
|
||||
echo "# master UFOs" >> "$GEN_MAKE_FILE"
|
||||
echo "# Note: build/ufo/Inter.designspace depends on src/Inter.glyphs" >> "$GEN_MAKE_FILE"
|
||||
for style in "${master_styles[@]}"; do
|
||||
echo -n "build/ufo/Inter-${style}.ufo:" >> "$GEN_MAKE_FILE"
|
||||
# echo -n " build/ufo/Inter-${style}.ufo" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/Inter.designspace" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/features" >> "$GEN_MAKE_FILE"
|
||||
echo -n " \$(wildcard" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/Inter-${style}.ufo/*.plist" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/Inter-${style}.ufo/*.fea" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/Inter-${style}.ufo/glyphs/*.plist" >> "$GEN_MAKE_FILE"
|
||||
# echo -n " build/ufo/Inter-${style}.ufo/glyphs/*.glif" >> "$GEN_MAKE_FILE"
|
||||
# echo -n " src/features/*" >> "$GEN_MAKE_FILE"
|
||||
echo ")" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\ttouch \"\$@\"" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo -n "all_ufo_masters :=" >> "$GEN_MAKE_FILE"
|
||||
for style in "${master_styles[@]}"; do
|
||||
echo -n " build/ufo/Inter-${style}.ufo" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# master OTF and TTF rules
|
||||
for style in "${master_styles[@]}"; do
|
||||
echo "${DIST_DIR_TOK}const/Inter-${style}.otf: \$(${style}_ufo_d) version.txt" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\tmisc/fontbuild compile -o \$@ \$(FONTBUILD_FLAGS) src/Inter-${style}.ufo" >> "$GEN_MAKE_FILE"
|
||||
echo "${DIST_DIR_TOK}const/Inter-${style}.ttf: \$(${style}_ufo_d) version.txt" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\tmisc/fontbuild compile -o \$@ \$(FONTBUILD_FLAGS) src/Inter-${style}.ufo" >> "$GEN_MAKE_FILE"
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
|
||||
# generate all_ufo: <master_ufos>
|
||||
# echo -n "all_ufo:" >> "$GEN_MAKE_FILE"
|
||||
# for style in "${master_styles[@]}"; do
|
||||
# echo -n " \$(${style}_ufo_d)" >> "$GEN_MAKE_FILE"
|
||||
# done
|
||||
# echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# add derived styles to style array
|
||||
# add derived styles to `style` array
|
||||
echo "# instance UFOs" >> "$GEN_MAKE_FILE"
|
||||
for e in "${derived_styles[@]}"; do
|
||||
style=$(echo "${e%%:*}" | xargs)
|
||||
dependent_styles=$(echo "${e#*:}" | xargs)
|
||||
all_styles+=( $style )
|
||||
instance_styles+=( $style )
|
||||
|
||||
echo -n "build/ufo/Inter-${style}.ufo:" >> "$GEN_MAKE_FILE"
|
||||
for depstyle in $dependent_styles; do
|
||||
echo -n " build/ufo/Inter-${depstyle}.ufo" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\tmisc/fontbuild instancegen build/ufo/Inter.designspace ${style}" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
|
||||
# STYLE and STYLE_ttf targets
|
||||
for style in "${all_styles[@]}"; do
|
||||
|
32842
misc/UnicodeData.txt
Normal file
32842
misc/UnicodeData.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user