mirror of
https://github.com/rsms/inter.git
synced 2024-11-28 22:13:40 +03:00
toolchain: drop old Makefile and init.sh script along with git hooks and slim down Python requirements.txt to just what we need
This commit is contained in:
parent
b0a23fb682
commit
585f56cee5
@ -19,32 +19,17 @@ By contributing work to the Inter font project you agree to have all work contri
|
||||
[GitHub pull requests](https://github.com/rsms/inter/pulls)
|
||||
or comments in the issue.
|
||||
|
||||
- Improvements to the Display subfamily...
|
||||
- Improvements to the Display "opsz" designs...
|
||||
|
||||
### Improvements to the Display subfamily
|
||||
|
||||
Source file: ([`src/InterDisplay.glyphs`](https://github.com/rsms/inter/blob/master/src/InterDisplay.glyphs))
|
||||
### Improvements to the Display "opsz" designs
|
||||
|
||||
The Display subfamily was derived from the text family ("Inter") and scaled to a different UPM (2048). It also had all of its kerning reduced.
|
||||
The Display (`opsz=32`) designs was derived from the text family ("Inter") and scaled to a different UPM (2048). It also had all of its kerning reduced.
|
||||
|
||||
Inter Display has a lower x-height compared to the text subfamily — this is the biggest difference in terms of work needed.
|
||||
Inter Display has a lower x-height compared to the text (`opsz=16`) designs — this is the biggest difference in terms of work needed.
|
||||
|
||||
![](misc/readme/display-x-height-cmp.png)
|
||||
|
||||
The contributions wanted for Inter Display are as follows:
|
||||
|
||||
- Diacritic glyph improvements. In most cases you should import the corresponding glyph from Inter (text) and scale it to 2048 UPM as Inter (text) has seen a lot of improvements to diacritic designs since it was forked into Inter Display.
|
||||
|
||||
- Diacritic anchor placement
|
||||
|
||||
- Glyph design. Keep the following in mind:
|
||||
- Raise/fix x-height for "low" glyghs.
|
||||
- If fixing up an existing glyph, reduce optical tricks for small scale like tapered diagonal stems and ink traps/bridges.
|
||||
- If makin a glyph from scratch, use a minimum (or no) optical tricks like tapered diagonal stems and ink traps/bridges.
|
||||
- Stems should all have 90° or 0° terminals (Inter text has variable angles.) Compare /a of Inter (text) and Inter Display for an example of what this means.
|
||||
- [Kerning](#Kerning) (use kerning groups!)
|
||||
|
||||
|
||||
> Please do not email Rasmus with issues and contributions but use GitHub 🙏
|
||||
|
||||
|
||||
@ -69,37 +54,34 @@ The Inter toolchain is a collection of programs setup to build everything
|
||||
in a high-quality and reliable way. It can be fully automated and requires no
|
||||
paid software.
|
||||
|
||||
TL;DR: to make & test everything:
|
||||
To build everything:
|
||||
|
||||
```
|
||||
make -j test
|
||||
make -j all
|
||||
```
|
||||
|
||||
Run QA tests:
|
||||
|
||||
```
|
||||
make test
|
||||
```
|
||||
|
||||
Currently the toolchain has only been tested on macOS and Linux. All you need to have preinstalled is [Python 3](https://www.python.org/downloads/).
|
||||
|
||||
The first step is to initialize the toolchain itself:
|
||||
|
||||
```
|
||||
./init.sh
|
||||
```
|
||||
### Recommended development workflow
|
||||
|
||||
This will fetch, setup and configure everything needed to build and test Inter.
|
||||
Open two terminals: in one, run a local web server with `./docs/lab/serve.py`. In the other run `make`:
|
||||
|
||||
> When running in a git repository, `init.sh` installs git hooks to automate running itself when you pull in new changes or switch branches.
|
||||
1. Edit in Glyphs.app
|
||||
2. Run `make var_web`
|
||||
3. Reload the lab at `http://localhost:3003/`
|
||||
4. Repeat
|
||||
|
||||
We can now run `make` to build all font files:
|
||||
Before submitting a Pull Request or otherwise contribute your changes:
|
||||
|
||||
```
|
||||
$ make -j Regular SemiBoldItalic
|
||||
```
|
||||
|
||||
This may take a long time (a few minutes) the first time as it generates "font instances" (i.e. all styles that are derived through interpolation from the master styles) in addition to compiling the actual font files (OTF, TTF, etc.)
|
||||
|
||||
The toolchain comes with a few other useful actions, one of them is `test` which runs some checks on the compiled font files to make sure they behave as intended:
|
||||
|
||||
```
|
||||
$ make -j test
|
||||
```
|
||||
1. `make clean && make -j all` then thoroughly inspect your changes in a variety of different settings using the lab and in any relevant software.
|
||||
2. Run QA tests using `make -j test`
|
||||
|
||||
|
||||
### Try & sample as you go
|
||||
@ -108,7 +90,7 @@ When making changes to the typeface and its source files, it's a good idea to sa
|
||||
|
||||
There are two things in particular that will help you with this:
|
||||
|
||||
- `make -j STYLE_FORMAT` to quickly compile only a particular style
|
||||
- `make -j build/fonts/FILENAME` to quickly compile only a particular font file
|
||||
- Interactive "Lab"
|
||||
|
||||
You can invoke `make` with either names of styles, names of styles and file formats, or even specific filenames. Here are a few examples:
|
||||
@ -125,28 +107,18 @@ All resulting font files are written to the `build` directory with `Inter-` as t
|
||||
[**The interactive Lab**](#interactive-lab) is a great tool for quickly exploring your font files. It's a web-based tool which you start in a terminal by running:
|
||||
|
||||
```
|
||||
python docs/lab/serve.py
|
||||
./docs/lab/serve.py
|
||||
```
|
||||
|
||||
Open up the URL printed on the screen and you can now explore your font files. Simply `make -j STYLE_web` (or `make -j all_web` for all styles) and reload the web page to try a new build.
|
||||
Open up the URL printed on the screen and you can now explore your font files.
|
||||
|
||||
See [Interactive Lab](#interactive-lab) for more details.
|
||||
|
||||
|
||||
### Editing source files
|
||||
|
||||
This font is stored and authored primarily in a unified [Glyphs](https://glyphsapp.com/) `.glyphs` file. However, if you prefer to use a different font editor, the master styles are also maintained as [UFO (Unified Font Object)](http://unifiedfontobject.org/) files and can be edited by lots of font software, like the free and open-source [FontForge](https://fontforge.github.io/) or commercial apps like [RoboFont](http://robofont.com/).
|
||||
|
||||
> **—Important—** The UFO source files are generated from the Glyphs source file. Editing the Glyphs file will cause the UFO files to be over-written. You have to commit to editing _either_ the .glyphs file _or_ the .ufo files.
|
||||
|
||||
To make life easier for you, configure your editor as follows:
|
||||
|
||||
- Set the grid to 128 units. This means that each grid square equals one pixel at 2x scale.
|
||||
- Set "Snap points to" to a reasonably high number that's a power-of-two, like 8.
|
||||
- Set "SHIFT increment" to 16
|
||||
- Set "CMD SHIFT increment" to 128
|
||||
|
||||
Note: If you're using Glyphs, this will already be the case as this information is stored in the .glyphs file.
|
||||
This font is stored and authored primarily in the [Glyphs](https://glyphsapp.com/)
|
||||
`Inter.glyphspackage` directory (a macOS "bundle.")
|
||||
|
||||
|
||||
### Interactive Lab
|
||||
@ -170,10 +142,10 @@ This project comes with a simple web-based application for debugging and preview
|
||||
To start the lab, simply run this in a terminal (and keep the terminal running.)
|
||||
|
||||
```
|
||||
python docs/lab/serve.py
|
||||
./docs/lab/serve.py
|
||||
```
|
||||
|
||||
You can now visit the URL printed on the screen to use the lab. Simply `make -j STYLE_web` (or `make -j all_web` for all styles) and reload the web page to try a new build.
|
||||
You can now visit the URL printed on the screen to use the lab. Simply `make -j web` for all styles or `make var_web` for quickly building only the variable font. Then reload the web page to try the new build.
|
||||
|
||||
An online version of the lab is available at <https://rsms.me/inter/lab/> with the most recent official release of the Inter font files.
|
||||
|
||||
@ -255,7 +227,7 @@ misc/tools/fontinfo.py -h
|
||||
|
||||
## FAQ
|
||||
|
||||
> Do I need Glyphs or RoboFont to build font files?
|
||||
> Do I need Glyphs to build font files?
|
||||
|
||||
No, you don't. To build font files, all you need is Python. To edit the font files, you need something that can edit .glyphs or UFO files.
|
||||
|
||||
@ -263,5 +235,5 @@ No, you don't. To build font files, all you need is Python. To edit the font fil
|
||||
|
||||
> I'm getting errors when running `make` in my terminal
|
||||
|
||||
This probably means that you need to run `./init.sh`
|
||||
Try `make reset`
|
||||
|
||||
|
155
Makefile
155
Makefile
@ -3,6 +3,7 @@ SRCDIR := $(abspath $(lastword $(MAKEFILE_LIST))/..)
|
||||
FONTDIR := build/fonts
|
||||
UFODIR := build/ufo
|
||||
BIN := $(SRCDIR)/build/venv/bin
|
||||
VENV := build/venv/bin/activate
|
||||
VERSION := $(shell cat version.txt)
|
||||
MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
@ -13,8 +14,8 @@ default: all
|
||||
# ---------------------------------------------------------------------------------
|
||||
# intermediate sources
|
||||
|
||||
$(UFODIR)/%.glyphs: src/%.glyphspackage | $(UFODIR)
|
||||
$(BIN)/python3 build/venv/bin/glyphspkg -o $(dir $@) $^
|
||||
$(UFODIR)/%.glyphs: src/%.glyphspackage | $(UFODIR) venv
|
||||
. $(VENV) ; build/venv/bin/glyphspkg -o $(dir $@) $^
|
||||
|
||||
# features
|
||||
src/features: $(wildcard src/features/*)
|
||||
@ -26,14 +27,14 @@ $(UFODIR)/features: src/features
|
||||
@ln -s ../../src/features $(UFODIR)/features
|
||||
|
||||
# designspace
|
||||
$(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: $(UFODIR)/%.glyphs $(UFODIR)/features
|
||||
$(BIN)/fontmake -o ufo -g $< --designspace-path $@ \
|
||||
$(UFODIR)/Inter-roman.designspace: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; python misc/tools/subset-designspace.py $^ $@
|
||||
$(UFODIR)/Inter-italic.designspace: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; python misc/tools/subset-designspace.py $^ $@
|
||||
$(UFODIR)/%.designspace: $(UFODIR)/%.glyphs $(UFODIR)/features | venv
|
||||
. $(VENV) ; fontmake -o ufo -g $< --designspace-path $@ \
|
||||
--master-dir $(UFODIR) --instance-dir $(UFODIR)
|
||||
$(BIN)/python3 misc/tools/postprocess-designspace.py $@
|
||||
. $(VENV) ; python misc/tools/postprocess-designspace.py $@
|
||||
|
||||
# master UFOs are byproducts of building Inter.designspace
|
||||
$(UFODIR)/Inter-Black.ufo: $(UFODIR)/Inter.designspace
|
||||
@ -50,32 +51,32 @@ $(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"
|
||||
$(UFODIR)/Inter-Light.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Light"
|
||||
$(UFODIR)/Inter-LightItalic.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Light Italic"
|
||||
$(UFODIR)/Inter-ExtraLight.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Extra Light"
|
||||
$(UFODIR)/Inter-ExtraLightItalic.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Extra Light Italic"
|
||||
$(UFODIR)/Inter-Medium.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Medium"
|
||||
$(UFODIR)/Inter-MediumItalic.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Medium Italic"
|
||||
$(UFODIR)/Inter-SemiBold.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Semi Bold"
|
||||
$(UFODIR)/Inter-SemiBoldItalic.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Semi Bold Italic"
|
||||
$(UFODIR)/Inter-Bold.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Bold"
|
||||
$(UFODIR)/Inter-BoldItalic.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Bold Italic"
|
||||
$(UFODIR)/Inter-ExtraBold.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Extra Bold"
|
||||
$(UFODIR)/Inter-ExtraBoldItalic.ufo: $(UFODIR)/Inter.designspace | venv
|
||||
. $(VENV) ; fontmake -o ufo -m $< --output-path $@ -i "Inter Extra Bold Italic"
|
||||
|
||||
# make sure intermediate files are not gc'd by make
|
||||
# make sure intermediate files are not rm'd by make
|
||||
.PRECIOUS: \
|
||||
$(UFODIR)/Inter-Black.ufo \
|
||||
$(UFODIR)/Inter-BlackItalic.ufo \
|
||||
@ -95,6 +96,7 @@ $(UFODIR)/Inter-ExtraBoldItalic.ufo: $(UFODIR)/Inter.designspace
|
||||
$(UFODIR)/Inter-BoldItalic.ufo \
|
||||
$(UFODIR)/Inter-ExtraBold.ufo \
|
||||
$(UFODIR)/Inter-ExtraBoldItalic.ufo \
|
||||
$(UFODIR)/Inter.glyphs \
|
||||
$(UFODIR)/Inter.designspace \
|
||||
$(UFODIR)/Inter-roman.designspace \
|
||||
$(UFODIR)/Inter-italic.designspace
|
||||
@ -102,39 +104,33 @@ $(UFODIR)/Inter-ExtraBoldItalic.ufo: $(UFODIR)/Inter.designspace
|
||||
# ---------------------------------------------------------------------------------
|
||||
# products
|
||||
|
||||
$(FONTDIR)/static/%.otf: $(UFODIR)/%.ufo | $(FONTDIR)/static
|
||||
$(BIN)/fontmake -u $< -o otf --output-path $@ \
|
||||
--overlaps-backend pathops --production-names
|
||||
$(FONTDIR)/static/%.otf: $(UFODIR)/%.ufo | $(FONTDIR)/static venv
|
||||
. $(VENV) ; 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/%.ttf: $(UFODIR)/%.ufo | $(FONTDIR)/static venv
|
||||
. $(VENV) ; 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 \
|
||||
$(FONTDIR)/static-hinted/%.ttf: $(FONTDIR)/static/%.ttf | $(FONTDIR)/static-hinted venv
|
||||
. $(VENV) ; python $(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/Inter-V.var.ttf: $(FONTDIR)/var/Inter.var.ttf venv
|
||||
. $(VENV) ; python misc/tools/rename.py --family "Inter V" -o $@ $<
|
||||
|
||||
$(FONTDIR)/var/%.var.ttf: $(UFODIR)/%.designspace | $(FONTDIR)/var
|
||||
$(BIN)/fontmake -o variable -m $< --output-path $@ \
|
||||
$(FONTDIR)/var/%.var.ttf: $(UFODIR)/%.designspace | $(FONTDIR)/var venv
|
||||
. $(VENV) ; 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 $@
|
||||
. $(VENV) ; python misc/tools/postprocess-vf.py $@
|
||||
. $(VENV) ; gftools fix-unwanted-tables -t MVAR $@
|
||||
|
||||
$(FONTDIR)/var/%.var.otf: $(UFODIR)/%.designspace | $(FONTDIR)/var
|
||||
$(BIN)/fontmake -o variable-cff2 -m $< --output-path $@ \
|
||||
$(FONTDIR)/var/%.var.otf: $(UFODIR)/%.designspace | $(FONTDIR)/var venv
|
||||
. $(VENV) ; fontmake -o variable-cff2 -m $< --output-path $@ \
|
||||
--overlaps-backend pathops --production-names
|
||||
|
||||
# $(FONTDIR)/var-hinted/%.ttf: $(FONTDIR)/var/%.ttf
|
||||
# mkdir -p "$(dir $@)"
|
||||
# $(BIN)/python3 $(PWD)/build/venv/lib/python/site-packages/ttfautohint \
|
||||
# --no-info "$<" "$@"
|
||||
|
||||
|
||||
%.woff2: %.ttf
|
||||
$(BIN)/woff2_compress "$<"
|
||||
%.woff2: %.ttf | venv
|
||||
. $(VENV) ; misc/tools/woff2 compress -o "$@" "$<"
|
||||
|
||||
$(FONTDIR)/static:
|
||||
mkdir -p $@
|
||||
@ -249,22 +245,25 @@ var: \
|
||||
$(FONTDIR)/var/Inter.var.ttf \
|
||||
$(FONTDIR)/var/Inter-V.var.ttf
|
||||
|
||||
var_no_slnt_axis: \
|
||||
var_no_slnt_axis: | venv \
|
||||
$(FONTDIR)/var/Inter-roman.var.ttf \
|
||||
$(FONTDIR)/var/Inter-italic.var.ttf
|
||||
$(BIN)/python3 misc/tools/postprocess-single-axis-vfs.py $^
|
||||
. $(VENV) ; python misc/tools/postprocess-single-axis-vfs.py $^
|
||||
|
||||
var_web: \
|
||||
$(FONTDIR)/var/Inter.var.woff2 \
|
||||
var_web: $(FONTDIR)/var/Inter.var.woff2
|
||||
|
||||
var_web_all: var_web \
|
||||
$(FONTDIR)/var/Inter-V.var.woff2 \
|
||||
$(FONTDIR)/var/Inter-roman.var.woff2 \
|
||||
$(FONTDIR)/var/Inter-italic.var.woff2
|
||||
|
||||
web: var_web_all static_web
|
||||
|
||||
all: static_otf static_ttf static_ttf_hinted static_web static_web_hinted \
|
||||
var var_web var_no_slnt_axis
|
||||
var var_web_all 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
|
||||
var var_web var_web_all var_no_slnt_axis web
|
||||
|
||||
# ---------------------------------------------------------------------------------
|
||||
# testing
|
||||
@ -282,16 +281,16 @@ FBAKE_ARGS := check-universal \
|
||||
-j \
|
||||
-x com.google.fonts/check/family/win_ascent_and_descent
|
||||
|
||||
build/fontbakery-report-var.txt: $(FONTDIR)/var/Inter.var.ttf
|
||||
build/fontbakery-report-var.txt: $(FONTDIR)/var/Inter.var.ttf | venv
|
||||
@echo "fontbakery Inter.var.ttf > $(@) ..."
|
||||
@$(BIN)/fontbakery \
|
||||
@. $(VENV) ; fontbakery \
|
||||
$(FBAKE_ARGS) -x com.google.fonts/check/STAT_strings \
|
||||
$^ > $@ \
|
||||
|| (cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
|
||||
|
||||
build/fontbakery-report-static.txt: $(wildcard $(FONTDIR)/static/Inter-*.otf)
|
||||
build/fontbakery-report-static.txt: $(wildcard $(FONTDIR)/static/Inter-*.otf) | venv
|
||||
@echo "fontbakery static/Inter-*.otf > $(@) ..."
|
||||
@$(BIN)/fontbakery \
|
||||
@. $(VENV) ; fontbakery \
|
||||
$(FBAKE_ARGS) -x com.google.fonts/check/family/underline_thickness \
|
||||
$^ > $@ \
|
||||
|| (cat $@; echo "report at $@"; touch -m -t 199001010000 $@; exit 1)
|
||||
@ -349,8 +348,8 @@ dist_step1: clean
|
||||
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
|
||||
dist_zip: | venv
|
||||
. $(VENV) ; python misc/tools/patch-version.py misc/dist/inter.css
|
||||
bash misc/makezip2.sh -reveal-in-finder "$(DIST_ZIP)"
|
||||
|
||||
dist_docs:
|
||||
@ -446,3 +445,19 @@ list:
|
||||
| egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
|
||||
|
||||
.PHONY: list
|
||||
|
||||
# ---------------------------------------------------------------------------------
|
||||
# initialize toolchain
|
||||
|
||||
venv: build/venv/config.stamp
|
||||
|
||||
build/venv/config.stamp: requirements.txt
|
||||
@mkdir -p build
|
||||
test -d build/venv || python3 -m venv build/venv
|
||||
. $(VENV) ; pip install -Ur requirements.txt
|
||||
touch $@
|
||||
|
||||
reset: clean
|
||||
rm -rf build/venv
|
||||
|
||||
.PHONY: venv reset
|
||||
|
547
Makefile_v1.make
547
Makefile_v1.make
@ -1,547 +0,0 @@
|
||||
# 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
|
679
init.sh
679
init.sh
@ -1,679 +0,0 @@
|
||||
#!/bin/bash
|
||||
SCRIPT_FILE=${BASH_SOURCE[0]}
|
||||
[ -n "$SCRIPT_FILE" ] || SCRIPT_FILE=${(%):-%N} # zsh
|
||||
SRCDIR=$(dirname "$(realpath "$SCRIPT_FILE")")
|
||||
|
||||
BUILD_DIR=${BUILD_DIR:-$SRCDIR/build}
|
||||
|
||||
if [[ "${BUILD_DIR:0:2}" == "./" ]]; then
|
||||
BUILD_DIR=${BUILD_DIR:2}
|
||||
fi
|
||||
|
||||
# DIST_DIR=$BUILD_DIR/fonts/
|
||||
DIST_DIR_TOK='$(FONTDIR)/'
|
||||
BUILD_TMP_DIR=$BUILD_DIR/tmp
|
||||
VENV_DIR=$BUILD_DIR/venv
|
||||
|
||||
if [[ "$SCRIPT_FILE" != "${0}" ]]; then
|
||||
# sourced
|
||||
if [[ -z $VIRTUAL_ENV ]] && [[ ! -f "$VENV_DIR/bin/activate" ]]; then
|
||||
echo "Project not configured." >&2
|
||||
echo "Execute this script instead of sourcing it to perform setup." >&2
|
||||
else
|
||||
source "$VENV_DIR/bin/activate"
|
||||
pushd "$SRCDIR" >/dev/null
|
||||
SRCDIR_ABS=$(pwd)
|
||||
popd >/dev/null 2>&1
|
||||
export PYTHONPATH=$SRCDIR_ABS/misc/tools
|
||||
fi
|
||||
unset SRCDIR
|
||||
unset BUILD_DIR
|
||||
unset SCRIPT_FILE
|
||||
unset DIST_DIR_TOK
|
||||
unset BUILD_TMP_DIR
|
||||
unset VENV_DIR
|
||||
else
|
||||
# Subshell
|
||||
set -e
|
||||
cd "$SRCDIR"
|
||||
|
||||
if [[ "$1" == "-h" ]] || [[ "$1" == "-help" ]] || [[ "$1" == "--help" ]]; then
|
||||
echo "usage: $0 [options]" >&2
|
||||
echo "options:" >&2
|
||||
echo " -clean Start from scratch" >&2
|
||||
echo " -h, -help Show help and exit" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clean=false
|
||||
if [[ "$1" == "-clean" ]]; then
|
||||
clean=true
|
||||
shift
|
||||
fi
|
||||
|
||||
platform=osx
|
||||
UNAME=$(uname)
|
||||
if [[ "$UNAME" == *"inux"* ]]; then
|
||||
platform=linux
|
||||
elif [[ "$UNAME" != *"arwin"* ]]; then
|
||||
echo "Unsupported platform $UNAME (only macOS and Linux are supported)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# ——————————————————————————————————————————————————————————————————
|
||||
# git hooks
|
||||
if [ -d .git ] && [ -d misc/git-hooks ]; then
|
||||
mkdir -p .git/hooks
|
||||
pushd .git/hooks >/dev/null
|
||||
for f in ../../misc/git-hooks/*.sh; do
|
||||
HOOKFILE=$(basename "$f" .sh)
|
||||
if ! [ -f "$HOOKFILE" ]; then
|
||||
ln -vfs "$f" "$HOOKFILE"
|
||||
fi
|
||||
done
|
||||
popd >/dev/null
|
||||
fi
|
||||
|
||||
|
||||
# ——————————————————————————————————————————————————————————————————
|
||||
# virtualenv
|
||||
|
||||
mkdir -p "$VENV_DIR"
|
||||
|
||||
pushd "$(dirname "$VENV_DIR")" >/dev/null
|
||||
VENV_DIR_ABS=$(pwd)/$(basename "$VENV_DIR")
|
||||
popd >/dev/null
|
||||
|
||||
# must check and set VENV_ACTIVE before polluting local env
|
||||
VENV_ACTIVE=false
|
||||
if [[ "$VIRTUAL_ENV" == "$VENV_DIR_ABS" ]] && [[ "$1" != "-force" ]]; then
|
||||
VENV_ACTIVE=true
|
||||
fi
|
||||
|
||||
require_virtualenv() {
|
||||
# find pip3 (Python 3)
|
||||
export pip=$(which pip3)
|
||||
if [ "$pip" = "" ]; then
|
||||
export pip=$(which pip)
|
||||
if [ "$pip" = "" ]; then
|
||||
echo "pip not found in PATH -- please install Python 3" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo "using $("$pip" --version)"
|
||||
if [ "$pip" = "" ]; then
|
||||
echo "Pip for Python 3 not found (tried pip and pip3 in PATH)" >&2
|
||||
exit 1
|
||||
elif ! ($pip --version 2>&1 | grep -q 'ython 3'); then
|
||||
echo "Pip for Python 3 not found (found pip for different python version)" >&2
|
||||
exit 1
|
||||
fi
|
||||
# find virtualenv
|
||||
if ! ($pip show virtualenv >/dev/null); then
|
||||
echo "$0: Can't find virtualenv -- install through '$pip install --user virtualenv'" >&2
|
||||
exit 1
|
||||
fi
|
||||
virtualenv_pkgdir=$($pip show virtualenv | grep Location | cut -d ' ' -f 2)
|
||||
export virtualenv="$(dirname "$(dirname "$(dirname "$virtualenv_pkgdir")")")/bin/virtualenv"
|
||||
echo "using virtualenv: $virtualenv"
|
||||
}
|
||||
|
||||
# TODO: allow setting a flag to recreate venv
|
||||
if $clean; then
|
||||
rm -rf "$VENV_DIR"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$VENV_DIR/bin" ]]; then
|
||||
require_virtualenv
|
||||
echo "Setting up virtualenv in '$VENV_DIR'"
|
||||
rm -f "$VENV_DIR/lib/python"
|
||||
$virtualenv "$VENV_DIR"
|
||||
elif [[ ! -z $VIRTUAL_ENV ]] && [[ "$VIRTUAL_ENV" != "$VENV_DIR_ABS" ]]; then
|
||||
echo "Looks like the repository has moved location -- updating virtualenv"
|
||||
rm -f "$VENV_DIR/lib/python"
|
||||
require_virtualenv
|
||||
$virtualenv "$VENV_DIR"
|
||||
fi
|
||||
|
||||
# symlink lib/python -> lib/python<version>
|
||||
if [[ ! -d "$VENV_DIR/lib/python" ]]; then
|
||||
for f in "$VENV_DIR/lib/"python*; do
|
||||
if [[ -d "$f" ]]; then
|
||||
ln -svf $(basename "$f") "$VENV_DIR/lib/python"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# ——————————————————————————————————————————————————————————————————
|
||||
# python dependencies
|
||||
|
||||
# install if deps changed
|
||||
REQUIREMENTS_FILE=$SRCDIR/requirements.txt
|
||||
UPDATE_TIMESTAMP_FILE="$VENV_DIR/last-pip-run.mark"
|
||||
if [ "$REQUIREMENTS_FILE" -nt "$UPDATE_TIMESTAMP_FILE" ]; then
|
||||
echo "$VENV_DIR/bin/pip install -r $REQUIREMENTS_FILE"
|
||||
"$VENV_DIR/bin/pip" install -r "$REQUIREMENTS_FILE"
|
||||
date '+%s' > "$UPDATE_TIMESTAMP_FILE"
|
||||
fi
|
||||
|
||||
|
||||
# ——————————————————————————————————————————————————————————————————
|
||||
# activate env (for rest of this script)
|
||||
source "$VENV_DIR/bin/activate"
|
||||
|
||||
|
||||
# ——————————————————————————————————————————————————————————————————
|
||||
# other toolchain dependencies
|
||||
|
||||
DEPS_DIR=$BUILD_DIR/deps
|
||||
PATCH_DIR=$(pwd)/misc/patches
|
||||
mkdir -p "$DEPS_DIR"
|
||||
|
||||
|
||||
function fetch() {
|
||||
URL=$1
|
||||
DSTFILE=$2
|
||||
echo "Fetching $URL"
|
||||
curl '-#' -o "$DSTFILE" -L "$URL"
|
||||
}
|
||||
|
||||
function check_dep() {
|
||||
NAME=$1
|
||||
REPO_URL=$2
|
||||
BRANCH=$3
|
||||
TREE_REF=$4
|
||||
set -e
|
||||
REPODIR=$DEPS_DIR/$NAME
|
||||
CHANGED=false
|
||||
if [[ ! -d "$REPODIR/.git" ]]; then
|
||||
rm -rf "$REPODIR"
|
||||
echo "Fetching $NAME from $REPO_URL"
|
||||
if ! (git clone --recursive --single-branch -b $BRANCH -- "$REPO_URL" "$REPODIR"); then
|
||||
exit 1
|
||||
fi
|
||||
CHANGED=true
|
||||
elif [[ "$(git -C "$REPODIR" rev-parse HEAD)" != "$TREE_REF" ]]; then
|
||||
CHANGED=true
|
||||
git -C "$REPODIR" fetch origin
|
||||
fi
|
||||
if $CHANGED; then
|
||||
if [[ ! -z $TREE_REF ]]; then
|
||||
git -C "$REPODIR" checkout "$TREE_REF"
|
||||
git -C "$REPODIR" submodule update
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# woff2
|
||||
LINK=false
|
||||
if ! (check_dep woff2 \
|
||||
https://github.com/google/woff2.git master \
|
||||
a0d0ed7da27b708c0a4e96ad7a998bddc933c06e )
|
||||
then
|
||||
echo "Building woff2"
|
||||
make -C "$DEPS_DIR/woff2" -j8 clean
|
||||
if !(make -C "$DEPS_DIR/woff2" -j8 all); then
|
||||
rm -rf "$DEPS_DIR/woff2"
|
||||
exit 1
|
||||
fi
|
||||
LINK=true
|
||||
elif [[ ! -f "$VENV_DIR/bin/woff2_compress" ]]; then
|
||||
LINK=true
|
||||
fi
|
||||
if $LINK; then
|
||||
ln -vfs ../../deps/woff2/woff2_compress "$VENV_DIR/bin/woff2_compress"
|
||||
fi
|
||||
|
||||
|
||||
# # EOT (disabled)
|
||||
# if ! (check_dep \
|
||||
# ttf2eot https://github.com/rsms/ttf2eot.git master )
|
||||
# then
|
||||
# echo "Building ttf2eot"
|
||||
# make -C "$DEPS_DIR/ttf2eot" clean all
|
||||
# fi
|
||||
# if [[ ! -f "$VENV_DIR/bin/ttf2eot" ]]; then
|
||||
# ln -vfs ../../deps/ttf2eot/ttf2eot "$VENV_DIR/bin"
|
||||
# fi
|
||||
|
||||
|
||||
# # meson (internal requirement of ots)
|
||||
# MESON_VERSION=0.47.2
|
||||
# pushd "$DEPS_DIR" >/dev/null
|
||||
# MESON_BIN=$PWD/meson-${MESON_VERSION}/meson.py
|
||||
# popd >/dev/null
|
||||
# if [[ ! -f "$MESON_BIN" ]]; then
|
||||
# fetch \
|
||||
# https://github.com/mesonbuild/meson/releases/download/${MESON_VERSION}/meson-${MESON_VERSION}.tar.gz \
|
||||
# "$DEPS_DIR/meson.tar.gz"
|
||||
# tar -C "$DEPS_DIR" -xzf "$DEPS_DIR/meson.tar.gz"
|
||||
# rm "$DEPS_DIR/meson.tar.gz"
|
||||
# fi
|
||||
|
||||
|
||||
# # ninja
|
||||
# NINJA_VERSION=1.8.2
|
||||
# pushd "$DEPS_DIR" >/dev/null
|
||||
# NINJA_BIN=$PWD/ninja-${NINJA_VERSION}
|
||||
# if [[ ! -f "$NINJA_BIN" ]]; then
|
||||
# fetch \
|
||||
# https://github.com/ninja-build/ninja/releases/download/v${NINJA_VERSION}/ninja-mac.zip \
|
||||
# ninja.zip
|
||||
# rm -f ninja
|
||||
# unzip -q -o ninja.zip
|
||||
# rm ninja.zip
|
||||
# mv ninja "$NINJA_BIN"
|
||||
# fi
|
||||
# popd >/dev/null
|
||||
|
||||
|
||||
# # ots (from source)
|
||||
# LINK=false
|
||||
# if ! (check_dep ots \
|
||||
# https://github.com/khaledhosny/ots.git master \
|
||||
# cad0b4f9405d03ddf801f977f2f65892192ad047 )
|
||||
# then
|
||||
# echo "Building ots"
|
||||
# pushd "$DEPS_DIR/ots" >/dev/null
|
||||
# "$MESON_BIN" build
|
||||
# "$NINJA_BIN" -C build
|
||||
# popd >/dev/null
|
||||
# fi
|
||||
|
||||
|
||||
# ots (from dist)
|
||||
OTS_VERSION=7.1.7
|
||||
OTS_DIR=$DEPS_DIR/ots-${OTS_VERSION}
|
||||
LINK=false
|
||||
if [[ ! -f "$OTS_DIR/ots-sanitize" ]]; then
|
||||
mkdir -p "$OTS_DIR"
|
||||
fetch \
|
||||
https://github.com/khaledhosny/ots/releases/download/v${OTS_VERSION}/ots-${OTS_VERSION}-${platform}.zip \
|
||||
"$OTS_DIR/ots.zip"
|
||||
pushd "$OTS_DIR" >/dev/null
|
||||
unzip ots.zip
|
||||
rm ots.zip
|
||||
mv ots-* xx-ots
|
||||
mv xx-ots/* .
|
||||
rm -rf xx-ots
|
||||
popd >/dev/null
|
||||
LINK=true
|
||||
fi
|
||||
if $LINK || [[ ! -f "$VENV_DIR/bin/ots-sanitize" ]]; then
|
||||
pushd "$OTS_DIR" >/dev/null
|
||||
for f in ots-*; do
|
||||
popd >/dev/null
|
||||
ln -vfs ../../deps/ots-${OTS_VERSION}/$f "$VENV_DIR/bin/$f"
|
||||
pushd "$OTS_DIR" >/dev/null
|
||||
done
|
||||
popd >/dev/null
|
||||
fi
|
||||
|
||||
|
||||
# note: ttfautohint is no longer used by the new Makefile
|
||||
AUTOHINT_VERSION=1.8.2
|
||||
AUTOHINT_SRC_VERSION=1.8.2.8
|
||||
LINK=false
|
||||
if [[ ! -f "$DEPS_DIR/ttfautohint-${AUTOHINT_VERSION}" ]]; then
|
||||
if [[ "$platform" == "osx" ]]; then
|
||||
fetch \
|
||||
https://download.savannah.gnu.org/releases/freetype/ttfautohint-${AUTOHINT_VERSION}-tty-osx.tar.gz \
|
||||
"$DEPS_DIR/ttfautohint.tar.gz"
|
||||
tar -C "$DEPS_DIR" -xzf "$DEPS_DIR/ttfautohint.tar.gz"
|
||||
rm "$DEPS_DIR/ttfautohint.tar.gz"
|
||||
mv -f "$DEPS_DIR/ttfautohint" "$DEPS_DIR/ttfautohint-${AUTOHINT_VERSION}"
|
||||
else
|
||||
fetch \
|
||||
https://github.com/source-foundry/ttfautohint-build/archive/v${AUTOHINT_SRC_VERSION}.tar.gz \
|
||||
"$DEPS_DIR/ttfautohint-build.tar.gz"
|
||||
pushd "$DEPS_DIR" >/dev/null
|
||||
tar -xzf ttfautohint-build.tar.gz
|
||||
rm ttfautohint-build.tar.gz
|
||||
rm -rf ttfautohint-build
|
||||
mv -f ttfautohint*/ ./ttfautohint-build
|
||||
pushd ttfautohint-build >/dev/null
|
||||
./ttfautohint-build.sh
|
||||
popd >/dev/null
|
||||
mv -f \
|
||||
"$HOME"/ttfautohint-build/ttfautohint*/frontend/ttfautohint \
|
||||
"ttfautohint-${AUTOHINT_VERSION}"
|
||||
rm -rf "$HOME"/ttfautohint-build ttfautohint-build
|
||||
popd >/dev/null
|
||||
fi
|
||||
LINK=true
|
||||
elif [[ ! -f "$VENV_DIR/bin/ttfautohint" ]]; then
|
||||
LINK=true
|
||||
fi
|
||||
if $LINK; then
|
||||
ln -vfs ../../deps/ttfautohint-${AUTOHINT_VERSION} "$VENV_DIR/bin/ttfautohint"
|
||||
fi
|
||||
|
||||
if [[ ! -f "$VENV_DIR/bin/ttf2woff" ]] || [[ ! -f "$SRCDIR/misc/ttf2woff/ttf2woff" ]]; then
|
||||
echo "Building ttf2woff"
|
||||
make -C "$SRCDIR/misc/ttf2woff" -j8
|
||||
fi
|
||||
if [[ ! -f "$VENV_DIR/bin/ttf2woff" ]]; then
|
||||
ln -vfs ../../../misc/ttf2woff/ttf2woff "$VENV_DIR/bin"
|
||||
fi
|
||||
|
||||
has_newer() {
|
||||
DIR=$1
|
||||
REF_FILE=$2
|
||||
for f in $(find "$DIR" -type f -newer "$REF_FILE" -print -quit); do
|
||||
return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# ————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
# $BUILD_DIR/etc/generated.make
|
||||
|
||||
GEN_MAKE_FILE=$BUILD_DIR/etc/generated.make
|
||||
INIT_FILE_HASH= ; if [ -d .git ]; then INIT_FILE_HASH=$(git hash-object -w init.sh); fi
|
||||
GENERATE_MAKE_FILE=false
|
||||
if $clean || [[ ! -f "$GEN_MAKE_FILE" ]]; then
|
||||
GENERATE_MAKE_FILE=true
|
||||
else
|
||||
# check to see if stored hash of init.sh is the same as the current init.sh
|
||||
GEN_MAKE_FILE_LINE1=$(head -n 1 "$GEN_MAKE_FILE")
|
||||
if [[ "$GEN_MAKE_FILE_LINE1" != "#$INIT_FILE_HASH" ]]; then
|
||||
# the makefile was generated by a different version of init.sh
|
||||
GENERATE_MAKE_FILE=true
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate BUILD_DIR/etc/generated.make
|
||||
if $GENERATE_MAKE_FILE; then
|
||||
|
||||
# Warning about UFOs moving from src to build/ufo
|
||||
for f in src/Inter-*.ufo; do
|
||||
if [ -f "$f" ]; then
|
||||
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
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
echo "Generating '$GEN_MAKE_FILE'"
|
||||
mkdir -p "$(dirname "$GEN_MAKE_FILE")"
|
||||
echo "#$INIT_FILE_HASH" > "$GEN_MAKE_FILE"
|
||||
echo "# Generated by init.sh -- do not modify manually" >> "$GEN_MAKE_FILE"
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
master_styles=( \
|
||||
Thin \
|
||||
ThinItalic \
|
||||
Regular \
|
||||
Italic \
|
||||
Black \
|
||||
BlackItalic \
|
||||
)
|
||||
derived_styles=( \
|
||||
"Light : Thin Regular" \
|
||||
"LightItalic : ThinItalic Italic" \
|
||||
"ExtraLight : Thin Regular" \
|
||||
"ExtraLightItalic : ThinItalic Italic" \
|
||||
"Medium : Regular Black" \
|
||||
"MediumItalic : Italic BlackItalic" \
|
||||
"SemiBold : Regular Black" \
|
||||
"SemiBoldItalic : Italic BlackItalic" \
|
||||
"Bold : Regular Black" \
|
||||
"BoldItalic : Italic BlackItalic" \
|
||||
"ExtraBold : Regular Black" \
|
||||
"ExtraBoldItalic : Italic BlackItalic" \
|
||||
)
|
||||
web_formats=( woff woff2 )
|
||||
|
||||
mkdir -p "$BUILD_DIR/etc"
|
||||
|
||||
all_styles=()
|
||||
instance_styles=()
|
||||
|
||||
# add master styles to style array
|
||||
for style in "${master_styles[@]}"; do
|
||||
all_styles+=( $style )
|
||||
done
|
||||
|
||||
# master UFO targets
|
||||
echo "# master UFOs" >> "$GEN_MAKE_FILE"
|
||||
echo "# Note: build/ufo/Inter.designspace depends on src/Inter.glyphs" >> "$GEN_MAKE_FILE"
|
||||
echo "# Note: build/ufo/InterDisplay.designspace depends on src/InterDisplay.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.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 ")" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\t@touch \"\$@\"" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo -n "build/ufo/InterDisplay-${style}.ufo:" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/InterDisplay.designspace" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/features" >> "$GEN_MAKE_FILE"
|
||||
echo -n " \$(wildcard" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/InterDisplay-${style}.ufo/*.plist" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/InterDisplay-${style}.ufo/*.fea" >> "$GEN_MAKE_FILE"
|
||||
echo -n " build/ufo/InterDisplay-${style}.ufo/glyphs/*.plist" >> "$GEN_MAKE_FILE"
|
||||
echo ")" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\t@touch \"\$@\"" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo -n "all_ufo_masters_text :=" >> "$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 -n "all_ufo_masters_display :=" >> "$GEN_MAKE_FILE"
|
||||
for style in "${master_styles[@]}"; do
|
||||
echo -n " build/ufo/InterDisplay-${style}.ufo" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
|
||||
# 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"
|
||||
|
||||
echo -n "build/ufo/InterDisplay-${style}.ufo:" >> "$GEN_MAKE_FILE"
|
||||
for depstyle in $dependent_styles; do
|
||||
echo -n " build/ufo/InterDisplay-${depstyle}.ufo" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\tmisc/fontbuild instancegen build/ufo/InterDisplay.designspace ${style}" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
|
||||
# STYLE and STYLE_ttf targets
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo "${style}: ${style}_otf ${style}_ttf ${style}_ttf_hinted ${style}_web ${style}_web_hinted" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo "${style}_ttf_hinted: ${DIST_DIR_TOK}const-hinted/Inter-${style}.ttf" >> "$GEN_MAKE_FILE"
|
||||
echo "${style}_ttf: ${DIST_DIR_TOK}const/Inter-${style}.ttf" >> "$GEN_MAKE_FILE"
|
||||
echo "${style}_otf: ${DIST_DIR_TOK}const/Inter-${style}.otf" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo -n "${style}_web:" >> "$GEN_MAKE_FILE"
|
||||
for format in "${web_formats[@]}"; do
|
||||
echo -n " ${DIST_DIR_TOK}const/Inter-${style}.${format}" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo -n "${style}_web_hinted:" >> "$GEN_MAKE_FILE"
|
||||
for format in "${web_formats[@]}"; do
|
||||
echo -n " ${DIST_DIR_TOK}const-hinted/Inter-${style}.${format}" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo "${style}_check: ${DIST_DIR_TOK}const/Inter-${style}.otf ${DIST_DIR_TOK}const/Inter-${style}.ttf" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\tmisc/fontbuild checkfont $^" >> "$GEN_MAKE_FILE"
|
||||
|
||||
|
||||
echo "display_${style}: display_${style}_otf display_${style}_ttf display_${style}_ttf_hinted display_${style}_web display_${style}_web_hinted" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo "display_${style}_ttf_hinted: ${DIST_DIR_TOK}const-hinted/InterDisplay-${style}.ttf" >> "$GEN_MAKE_FILE"
|
||||
echo "display_${style}_ttf: ${DIST_DIR_TOK}const/InterDisplay-${style}.ttf" >> "$GEN_MAKE_FILE"
|
||||
echo "display_${style}_otf: ${DIST_DIR_TOK}const/InterDisplay-${style}.otf" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo -n "display_${style}_web:" >> "$GEN_MAKE_FILE"
|
||||
for format in "${web_formats[@]}"; do
|
||||
echo -n " ${DIST_DIR_TOK}const/InterDisplay-${style}.${format}" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo -n "display_${style}_web_hinted:" >> "$GEN_MAKE_FILE"
|
||||
for format in "${web_formats[@]}"; do
|
||||
echo -n " ${DIST_DIR_TOK}const-hinted/InterDisplay-${style}.${format}" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
echo "display_${style}_check: ${DIST_DIR_TOK}const/InterDisplay-${style}.otf ${DIST_DIR_TOK}const/InterDisplay-${style}.ttf" >> "$GEN_MAKE_FILE"
|
||||
echo -e "\tmisc/fontbuild checkfont $^" >> "$GEN_MAKE_FILE"
|
||||
|
||||
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
|
||||
# all_otf_* target
|
||||
echo -n "all_otf_text:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " ${style}_otf" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo -n "all_otf_display:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " display_${style}_otf" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# all_ttf_* target
|
||||
echo -n "all_ttf_text:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " ${style}_ttf" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo -n "all_ttf_display:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " display_${style}_ttf" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# all_ttf_*_hinted target
|
||||
echo -n "all_ttf_text_hinted:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " ${style}_ttf_hinted" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo -n "all_ttf_display_hinted:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " display_${style}_ttf_hinted" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# all_web_* target
|
||||
echo -n "all_web_text:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " ${style}_web" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo -n "all_web_display:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " display_${style}_web" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# all_web_*_hinted target
|
||||
echo -n "all_web_hinted_text:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " ${style}_web_hinted" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo -n "all_web_hinted_display:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " display_${style}_web_hinted" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# check_all_* target
|
||||
echo -n "check_all_text:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " ${style}_check" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
echo -n "check_all_display:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " display_${style}_check" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# all_samples_pdf target
|
||||
echo -n "all_samples_pdf:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " \$(FONTDIR)/samples/Inter-${style}.pdf" >> "$GEN_MAKE_FILE"
|
||||
echo -n " \$(FONTDIR)/samples/InterDisplay-${style}.pdf" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
# all_samples_png target
|
||||
echo -n "all_samples_png:" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " \$(FONTDIR)/samples/Inter-${style}.png" >> "$GEN_MAKE_FILE"
|
||||
echo -n " \$(FONTDIR)/samples/InterDisplay-${style}.png" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
|
||||
|
||||
echo -n ".PHONY:" >> "$GEN_MAKE_FILE"
|
||||
echo -n " all_otf_text all_otf_display" >> "$GEN_MAKE_FILE"
|
||||
echo -n " all_ttf_text all_ttf_display all_ttf_hinted_text all_ttf_hinted_display" >> "$GEN_MAKE_FILE"
|
||||
echo -n " all_web_text all_web_display all_web_hinted_text all_web_hinted_display" >> "$GEN_MAKE_FILE"
|
||||
echo -n " check_all_text check_all_display" >> "$GEN_MAKE_FILE"
|
||||
echo -n " all_samples_pdf all_samples_png" >> "$GEN_MAKE_FILE"
|
||||
for style in "${all_styles[@]}"; do
|
||||
echo -n " ${style} ${style}_ttf ${style}_ttf_hinted ${style}_otf ${style}_check" >> "$GEN_MAKE_FILE"
|
||||
echo -n " display_${style} display_${style}_ttf display_${style}_ttf_hinted display_${style}_otf display_${style}_check" >> "$GEN_MAKE_FILE"
|
||||
done
|
||||
echo "" >> "$GEN_MAKE_FILE"
|
||||
fi
|
||||
|
||||
# # ————————————————————————————————————————————————————————————————
|
||||
# # summary
|
||||
# if ! $VENV_ACTIVE; then
|
||||
# echo -n "You can activate virtualenv by running "
|
||||
# if [ "$0" == "./init.sh" ]; then
|
||||
# # pretty format for common case
|
||||
# echo '`source init.sh`'
|
||||
# else
|
||||
# echo "\`source \"$0\"\`"
|
||||
# fi
|
||||
# fi
|
||||
fi
|
@ -1,2 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
bash init.sh
|
||||
#!/bin/sh
|
||||
# Uninstall git hook used by old toolchain
|
||||
case "$0" in
|
||||
*/.git/hooks/*) rm "$0";;
|
||||
*) echo "Inter git hooks are no longer used"
|
||||
esac
|
||||
|
@ -1,2 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
bash init.sh
|
||||
#!/bin/sh
|
||||
# Uninstall git hook used by old toolchain
|
||||
case "$0" in
|
||||
*/.git/hooks/*) rm "$0";;
|
||||
*) echo "Inter git hooks are no longer used"
|
||||
esac
|
||||
|
6
misc/tools/woff2
Executable file
6
misc/tools/woff2
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
import sys
|
||||
from fontTools.ttLib.woff2 import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
@ -1,19 +1,6 @@
|
||||
fonttools[lxml,unicode,ufo]==4.33.3
|
||||
cu2qu==1.6.7.post1
|
||||
glyphsLib==6.0.5
|
||||
ufo2ft[pathops]==2.27.0
|
||||
defcon[lxml]==0.10.1
|
||||
skia-pathops==0.7.2
|
||||
gftools==0.9.11
|
||||
|
||||
# only used for DesignSpaceDocumentReader in fontbuild
|
||||
MutatorMath==3.0.1
|
||||
|
||||
# for woff2
|
||||
brotli==1.0.9
|
||||
|
||||
# for QA
|
||||
fontbakery==0.8.8
|
||||
|
||||
fontmake==3.3.0
|
||||
fontmake==3.3.*
|
||||
fontbakery==0.8.*
|
||||
skia-pathops==0.7.*
|
||||
gftools==0.9.*
|
||||
glyphspkg==0.1.4
|
||||
brotli==1.0.*
|
||||
|
Loading…
Reference in New Issue
Block a user