-
Notifications
You must be signed in to change notification settings - Fork 1
/
get-fonts.sh
executable file
·50 lines (39 loc) · 1.67 KB
/
get-fonts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
# script credits to: https://github.com/LanceMcDermott
set -e
FONTDIR="./fonts"
mkdir -p "${FONTDIR}"
# download filename url
download() {
## Download if newer, and if curl fails, clean up and exit
curl --fail --compressed -A "get-fonts.sh/osm-carto" -o "$1" -z "$1" -L "$2" || { echo "Failed to download $1 $2"; rm -f "$1"; exit 1; }
}
# TTF Hinted Noto Fonts
# Fonts available in regular, bold, and italic
REGULAR_BOLD_ITALIC="NotoSans"
# Fonts available in regular and bold
REGULAR_BOLD="NotoSansUI"
# Fonts only available in regular
REGULAR="NotoSans"
# Download the fonts in the lists above
for font in $REGULAR_BOLD_ITALIC; do
regular="$font-Regular.ttf"
bold="$font-Bold.ttf"
italic="$font-Italic.ttf"
download "${FONTDIR}/${regular}" "https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/${font}/${regular}"
download "${FONTDIR}/${bold}" "https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/${font}/${bold}"
download "${FONTDIR}/${italic}" "https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/${font}/${italic}"
done
for font in $REGULAR_BOLD; do
regular="$font-Regular.ttf"
bold="$font-Bold.ttf"
download "${FONTDIR}/${regular}" "https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/${font}/${regular}"
download "${FONTDIR}/${bold}" "https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/${font}/${bold}"
done
for font in $REGULAR; do
regular="$font-Regular.ttf"
download "${FONTDIR}/${regular}" "https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/${font}/${regular}"
done
# Fonts in zipfiles need a temporary directory
TMPDIR=$(mktemp -d -t get-fonts.XXXXXXXXX)
trap "rm -rf ${TMPDIR} ${FONTDIR}/static" EXIT