From bc8b267b01d4652334e6f4a5452e77fbf79b329d Mon Sep 17 00:00:00 2001 From: Rasmus Andersson Date: Tue, 22 Oct 2019 07:55:36 -0700 Subject: [PATCH] Generate OTF (quads, not cff) for VF, rename upright to roman and add googlefonts makefile target --- Makefile | 47 ++++++++++++++---- docs/_includes/preload-font-files.html | 2 +- ...er-upright.var.ttf => Inter-roman.var.ttf} | Bin ...pright.var.woff2 => Inter-roman.var.woff2} | Bin docs/inter-ui.css | 2 +- docs/inter.css | 4 +- docs/var-test.html | 6 +-- init.sh | 14 ++++++ misc/dist/inter.css | 2 +- misc/dist/variable.txt | 6 +-- 10 files changed, 63 insertions(+), 20 deletions(-) rename docs/font-files/{Inter-upright.var.ttf => Inter-roman.var.ttf} (100%) rename docs/font-files/{Inter-upright.var.woff2 => Inter-roman.var.woff2} (100%) diff --git a/Makefile b/Makefile index b85ad7640..274416796 100644 --- a/Makefile +++ b/Makefile @@ -47,14 +47,16 @@ all_const: all_otf all_ttf all_web all_const_hinted: all_ttf_hinted all_web_hinted var: \ $(FONTDIR)/var/Inter.var.woff2 \ - $(FONTDIR)/var/Inter.var.ttf + $(FONTDIR)/var/Inter.var.otf all_var: \ + $(FONTDIR)/var/Inter.var.otf \ $(FONTDIR)/var/Inter.var.woff2 \ - $(FONTDIR)/var/Inter.var.ttf \ - $(FONTDIR)/var/Inter-upright.var.woff2 \ - $(FONTDIR)/var/Inter-italic.var.woff2 \ - $(FONTDIR)/var/Inter-upright.var.ttf \ - $(FONTDIR)/var/Inter-italic.var.ttf + $(FONTDIR)/var/Inter-V.var.otf \ + $(FONTDIR)/var/Inter-V.var.woff2 \ + $(FONTDIR)/var/Inter-roman.var.otf \ + $(FONTDIR)/var/Inter-roman.var.woff2 \ + $(FONTDIR)/var/Inter-italic.var.otf \ + $(FONTDIR)/var/Inter-italic.var.woff2 all_ufo_masters = $(Thin_ufo_d) \ $(ThinItalic_ufo_d) \ @@ -77,6 +79,8 @@ include build/etc/generated.make # TTF -> WOFF2 +build/%.var.woff2: build/%.var.otf + woff2_compress "$<" build/%.woff2: build/%.ttf woff2_compress "$<" @@ -90,13 +94,17 @@ build/%.woff: build/%.ttf # Master UFOs -> variable TTF -$(FONTDIR)/var/Inter.var.ttf: src/Inter.designspace $(all_ufo_masters) version.txt +$(FONTDIR)/var/Inter.var.otf: src/Inter.designspace $(all_ufo_masters) version.txt misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $< -$(FONTDIR)/var/Inter-%.var.ttf: src/Inter-%.designspace $(all_ufo_masters) version.txt +$(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 misc/fontbuild compile-var -o $@ $(FONTBUILD_FLAGS) $< misc/tools/fix-vf-meta.py $@ + # Instance UFO -> OTF, TTF (note: masters' rules in generated.make) $(FONTDIR)/const/Inter-%.otf: build/ufo/Inter-%.ufo version.txt misc/fontbuild compile -o $@ $(FONTBUILD_FLAGS) $< @@ -106,7 +114,7 @@ $(FONTDIR)/const/Inter-%.ttf: build/ufo/Inter-%.ufo version.txt # designspace <- glyphs file -src/Inter-upright.designspace: src/Inter.designspace +src/Inter-roman.designspace: src/Inter.designspace src/Inter-italic.designspace: src/Inter.designspace src/Inter.designspace: src/Inter.glyphs misc/fontbuild glyphsync $< @@ -309,6 +317,27 @@ 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 + + + +build/googlefonts/%: $(FONTDIR)/% + misc/fontbuild rename --compact-style -o $@ "$<" +# build/googlefonts/const/%.otf: $(FONTDIR)/const/%.otf +# build/googlefonts/var/%.woff2: $(FONTDIR)/var/%.woff2 +# build/googlefonts/var/%.otf: $(FONTDIR)/var/%.otf + +# Google fonts +googlefonts: googlefonts_pre googlefonts_all + +googlefonts_pre: + @rm -rf build/googlefonts + @mkdir -p build/googlefonts/const build/googlefonts/var + +.PHONY: googlefonts googlefonts_pre + + + + # install targets install_ttf: all_ttf_const @echo "Installing TTF files locally at ~/Library/Fonts/Inter" diff --git a/docs/_includes/preload-font-files.html b/docs/_includes/preload-font-files.html index a3bc69ad4..69a94be73 100644 --- a/docs/_includes/preload-font-files.html +++ b/docs/_includes/preload-font-files.html @@ -5,5 +5,5 @@ assign url_root = "/" %}{% else %}{% assign url_root = "/inter/" %}{% endif %}{% assign font_v = site.data.fontinfo[0].version -%} +%} \ No newline at end of file diff --git a/docs/font-files/Inter-upright.var.ttf b/docs/font-files/Inter-roman.var.ttf similarity index 100% rename from docs/font-files/Inter-upright.var.ttf rename to docs/font-files/Inter-roman.var.ttf diff --git a/docs/font-files/Inter-upright.var.woff2 b/docs/font-files/Inter-roman.var.woff2 similarity index 100% rename from docs/font-files/Inter-upright.var.woff2 rename to docs/font-files/Inter-roman.var.woff2 diff --git a/docs/inter-ui.css b/docs/inter-ui.css index b3b7c5549..9aac5f998 100644 --- a/docs/inter-ui.css +++ b/docs/inter-ui.css @@ -189,7 +189,7 @@ BUGS: font-weight: 100 900; font-style: normal; font-named-instance: 'Regular'; - src: url("font-files/Inter-upright.var.woff2?v={{font_v}}") format("woff2"); + src: url("font-files/Inter-roman.var.woff2?v={{font_v}}") format("woff2"); } @font-face { font-family: 'Inter UI var alt'; diff --git a/docs/inter.css b/docs/inter.css index 41190284b..6d14d03ab 100644 --- a/docs/inter.css +++ b/docs/inter.css @@ -170,7 +170,7 @@ Usage: font-style: normal; font-named-instance: 'Regular'; font-display: swap; - src: url("font-files/Inter-upright.var.woff2?v={{font_v}}") format("woff2"); + src: url("font-files/Inter-roman.var.woff2?v={{font_v}}") format("woff2"); } @font-face { font-family: 'Inter var'; @@ -188,7 +188,7 @@ Usage: font-style: normal; font-named-instance: 'Regular'; font-display: swap; - src: url("font-files/Inter-upright.var.woff2?v={{font_v}}") format("woff2"); + src: url("font-files/Inter-roman.var.woff2?v={{font_v}}") format("woff2"); } @font-face { font-family: 'Inter var alt'; diff --git a/docs/var-test.html b/docs/var-test.html index 384af2964..c0eff9116 100644 --- a/docs/var-test.html +++ b/docs/var-test.html @@ -54,8 +54,8 @@ Note on font file URLs: font-weight: 100 900; font-style: normal; font-named-instance: 'Regular'; - src: url("font-files/Inter-upright.var.woff2?t=woff2-variations&v={{inter_var_woff2_v}}") format("woff2-variations"), - url("font-files/Inter-upright.var.woff2?t=woff2&v={{inter_var_woff2_v}}") format("woff2"); + src: url("font-files/Inter-roman.var.woff2?t=woff2-variations&v={{inter_var_woff2_v}}") format("woff2-variations"), + url("font-files/Inter-roman.var.woff2?t=woff2&v={{inter_var_woff2_v}}") format("woff2"); } @font-face { font-family: 'Inter var single-axis'; @@ -287,7 +287,7 @@ if (
  • Mapping of ital axis to font-style:italic is not supported, nor is Mapping of slnt axis to font-style:oblique. - Note: We use separate italic and upright font files for Edge in this + Note: We use separate italic and roman font files for Edge in this test, which is why intermediate oblique degrees are displayed as either fully slanted or not slanted at all when viewing this in Edge. (Last confirmed version: Edge 42) diff --git a/init.sh b/init.sh index fc1baaaef..3683a74b6 100755 --- a/init.sh +++ b/init.sh @@ -522,6 +522,20 @@ else # done # echo "" >> "$GEN_MAKE_FILE" + # googlefonts_all target + echo -n "googlefonts_all:" >> "$GEN_MAKE_FILE" + echo -n " build/googlefonts/var/Inter.var.otf" >> "$GEN_MAKE_FILE" + echo -n " build/googlefonts/var/Inter.var.woff2" >> "$GEN_MAKE_FILE" + echo -n " build/googlefonts/var/Inter-roman.var.otf" >> "$GEN_MAKE_FILE" + echo -n " build/googlefonts/var/Inter-roman.var.woff2" >> "$GEN_MAKE_FILE" + echo -n " build/googlefonts/var/Inter-italic.var.otf" >> "$GEN_MAKE_FILE" + echo -n " build/googlefonts/var/Inter-italic.var.woff2" >> "$GEN_MAKE_FILE" + for style in "${all_styles[@]}"; do + echo -n " build/googlefonts/const/Inter-${style}.otf" >> "$GEN_MAKE_FILE" + echo -n " build/googlefonts/const/Inter-${style}.woff2" >> "$GEN_MAKE_FILE" + done + echo "" >> "$GEN_MAKE_FILE" + echo -n ".PHONY: all_otf all_ttf_hinted all_ttf all_web all_web_hinted all_ufo all_check_const" >> "$GEN_MAKE_FILE" for style in "${all_styles[@]}"; do diff --git a/misc/dist/inter.css b/misc/dist/inter.css index 4f1ef60d9..5b66579ff 100644 --- a/misc/dist/inter.css +++ b/misc/dist/inter.css @@ -166,7 +166,7 @@ Usage: font-display: swap; font-style: normal; font-named-instance: 'Regular'; - src: url("Inter-upright.var.woff2") format("woff2"); + src: url("Inter-roman.var.woff2") format("woff2"); } @font-face { font-family: 'Inter var'; diff --git a/misc/dist/variable.txt b/misc/dist/variable.txt index 566b2ef28..fc294a9e4 100644 --- a/misc/dist/variable.txt +++ b/misc/dist/variable.txt @@ -3,9 +3,9 @@ Variable fonts is a new technology still undergoing development. The directory named "Inter (TTF variable)" contains three files: -- Inter.var.ttf -- Multi-axis complete family -- Inter-italic.var.ttf -- Single-axis italic style with variable weight axis. -- Inter-upright.var.ttf -- Single-axis upright/roman style with variable weight axis. +- Inter.var.otf -- Multi-axis complete family +- Inter-italic.var.otf -- Single-axis italic style with variable weight axis. +- Inter-roman.var.otf -- Single-axis roman style with variable weight axis. The "Inter (web)" directory contains WOFF2 versions of these same font files.