Generate OTF (quads, not cff) for VF, rename upright to roman and add googlefonts makefile target

This commit is contained in:
Rasmus Andersson 2019-10-22 07:55:36 -07:00
parent 4ca248c6c8
commit bc8b267b01
10 changed files with 63 additions and 20 deletions

View file

@ -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"

View file

@ -5,5 +5,5 @@ assign url_root = "/" %}{% else %}{%
assign url_root = "/inter/" %}{% endif %}{%
assign font_v = site.data.fontinfo[0].version
%}<link rel="preload" href="{{url_root}}font-files/Inter-upright.var.woff2?v=3.10" as="font" type="font/woff2" crossorigin="anonymous">
%}<link rel="preload" href="{{url_root}}font-files/Inter-roman.var.woff2?v=3.10" as="font" type="font/woff2" crossorigin="anonymous">
<link rel="preload" href="{{url_root}}font-files/Inter-italic.var.woff2?v=3.10" as="font" type="font/woff2" crossorigin="anonymous">

View file

@ -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';

View file

@ -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';

View file

@ -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 (
<li>
Mapping of <tt>ital</tt> axis to <tt>font-style:italic</tt>
is not supported, nor is Mapping of <tt>slnt</tt> axis to <tt>font-style:oblique</tt>.
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)

14
init.sh
View file

@ -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

2
misc/dist/inter.css vendored
View file

@ -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';

View file

@ -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.