Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 73dfb96

Browse files
committed
add Makefile to set up fonts
1 parent 40873e4 commit 73dfb96

File tree

4 files changed

+60
-3
lines changed

4 files changed

+60
-3
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
fonts/*
2-
*.upa
1+
*.aux
32
*.log
43
*.out
5-
*.aux
4+
*.upa
65
figures/*.pdf
6+
fonts/**/*.[ot]tf

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,21 @@
2828
or https://github.com/adobe-fonts/source-serif-pro/tree/release/OTF
2929
* `fonts/delicious-123/*` : See https://www.exljbris.com/delicious.html
3030

31+
On Linux, with `make` installed, the fonts can be set up with the following command:
32+
```shell
33+
make -C fonts
34+
```
3135

36+
The fonts can be made discoverable by `matplotlib` (through `fontconfig`) by creating the following in `$HOME/.config/fontconfig/fonts.conf` (see [here](https://www.freedesktop.org/software/fontconfig/fontconfig-user.html)):
3237

38+
```xml
39+
<?xml version="1.0"?>
40+
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
41+
<fontconfig>
42+
<dir>/path/to/cheatsheets/fonts/</dir>
43+
...
44+
</fontconfig>
45+
```
3346

3447

3548
2. You need to generate all the figures:

fonts/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.uuid

fonts/Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FONT_DIRS := delicious-123 roboto roboto-mono roboto-slab source-code-pro source-sans-pro source-serif-pro
2+
3+
DELICIOUS_ZIP := http://www.exljbris.com/dl/DELICIOUS_21_OTF.zip
4+
ROBOTO_ZIP := https://github.com/googlefonts/roboto/releases/download/v2.138/roboto-unhinted.zip
5+
ROBOTO_MONO_ZIP := https://github.com/googlefonts/RobotoMono/archive/8f651634e746da6df6c2c0be73255721d24f2372.zip
6+
ROBOTO_SLAB_ZIP := https://github.com/googlefonts/robotoslab/archive/a65e6d00d8e3e7ee2fabef844e58fa12690384d2.zip
7+
SOURCE_CODE_PRO_ZIP := https://github.com/adobe-fonts/source-code-pro/releases/download/2.038R-ro%2F1.058R-it%2F1.018R-VAR/OTF-source-code-pro-2.038R-ro-1.058R-it.zip
8+
SOURCE_SANS_PRO_ZIP := https://github.com/adobe-fonts/source-sans/releases/download/2.045R-ro%2F1.095R-it/source-sans-pro-2.045R-ro-1.095R-it.zip
9+
SOURCE_SERIF_PRO_ZIP := https://github.com/adobe-fonts/source-serif/releases/download/3.001R/source-serif-pro-3.001R.zip
10+
11+
UNZIP_FLAGS := -x "__MACOSX/*"
12+
13+
14+
.PHONY: default
15+
default: all
16+
17+
.PHONY: all
18+
all: sources
19+
mkdir -p $(FONT_DIRS)
20+
cd delicious-123 && unzip -j /tmp/delicious.zip "DELICIOUS_21_OTF/*.otf" $(UNZIP_FLAGS)
21+
cd delicious-123 && ln -sf Delicious_R_2021.otf Delicious-Roman.otf
22+
cd delicious-123 && ln -sf Delicious_SC_2021.otf Delicious-SmallCaps.otf
23+
cd roboto && unzip -j /tmp/roboto.zip "*.ttf" $(UNZIP_FLAGS)
24+
cd roboto-mono && unzip -j /tmp/roboto-mono.zip "RobotoMono-8f651634e746da6df6c2c0be73255721d24f2372/fonts/ttf/*.ttf" $(UNZIP_FLAGS)
25+
cd roboto-slab && unzip -j /tmp/roboto-slab.zip "robotoslab-a65e6d00d8e3e7ee2fabef844e58fa12690384d2/fonts/static/*.ttf" $(UNZIP_FLAGS)
26+
cd source-code-pro && unzip -j /tmp/source-code-pro.zip "*.otf" $(UNZIP_FLAGS)
27+
cd source-sans-pro && unzip -j /tmp/source-sans-pro.zip "source-sans-pro-2.045R-ro-1.095R-it/OTF/*.otf" $(UNZIP_FLAGS)
28+
cd source-serif-pro && unzip -j /tmp/source-serif-pro.zip "source-serif-pro-3.001R/OTF/*.otf" $(UNZIP_FLAGS)
29+
30+
.PHONY: sources
31+
sources:
32+
wget $(DELICIOUS_ZIP) -O /tmp/delicious.zip
33+
wget $(ROBOTO_ZIP) -O /tmp/roboto.zip
34+
wget $(ROBOTO_MONO_ZIP) -O /tmp/roboto-mono.zip
35+
wget $(ROBOTO_SLAB_ZIP) -O /tmp/roboto-slab.zip
36+
wget $(SOURCE_CODE_PRO_ZIP) -O /tmp/source-code-pro.zip
37+
wget $(SOURCE_SANS_PRO_ZIP) -O /tmp/source-sans-pro.zip
38+
wget $(SOURCE_SERIF_PRO_ZIP) -O /tmp/source-serif-pro.zip
39+
40+
.PHONY: clean
41+
clean:
42+
- rm $(HOME)/.cache/matplotlib/fontlist*
43+
- rm -rf $(FONT_DIRS)

0 commit comments

Comments
 (0)