-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·154 lines (107 loc) · 3.5 KB
/
build.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
set -eu
shopt -s extglob
# --------------------------------
depends=( curl resvg tar )
notfound=()
for app in "${depends[@]}"; do
if ! type "$app" > /dev/null 2>&1; then
notfound+=("$app")
fi
done
if [[ ${#notfound[@]} -ne 0 ]]; then
echo Failed to lookup dependency:
for app in "${notfound[@]}"; do
echo "- $app"
done
exit 1
fi
# --------------------------------
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
set -x
# --------------------------------
FONTS="$DIR/fonts"
TARGET="$DIR/target"
mkdir -p "$FONTS"
mkdir -p "$TARGET"
# --------------------------------
# [email protected]:googlefonts/Inconsolata.git
INCONSOLATA_COMMIT="fc1fc21081558b39a2db43bfd9b65bf9acb50701"
INCONSOLATA_PATH="$FONTS/Inconsolata-Black.ttf"
if [[ ! -e "$INCONSOLATA_PATH" ]]; then
curl -L -f -s \
--output "$INCONSOLATA_PATH" \
https://github.com/googlefonts/Inconsolata/raw/$INCONSOLATA_COMMIT/fonts/ttf/Inconsolata-Black.ttf
fi
# [email protected]:reddit/redditsans.git
REDDITSANS_COMMIT="60e19b50bde6de34b695591a8a047a6a3618a37c"
REDDITSANS_PATH="$FONTS/RedditMono-ExtraBold.ttf"
if [[ ! -e "$REDDITSANS_PATH" ]]; then
curl -L -f -s \
--output "$REDDITSANS_PATH" \
https://github.com/reddit/redditsans/raw/$REDDITSANS_COMMIT/fonts/mono/ttf/RedditMono-ExtraBold.ttf
fi
# [email protected]:NDISCOVER/Exo-2.0.git
EXO_COMMIT="182060cd38adf3cde0d22add3f8009d30bd48cde"
EXO_PATH="$FONTS/Exo2-BoldItalic.ttf"
if [[ ! -e "$EXO_PATH" ]]; then
curl -L -f -s \
--output "$EXO_PATH" \
https://github.com/NDISCOVER/Exo-2.0/raw/$EXO_COMMIT/fonts/ttf/Exo2-BoldItalic.ttf
fi
# [email protected]:googlefonts/morisawa-biz-ud-gothic
BIZUD_COMMIT="18934af56b9c003ca58c54bffbf226848cb11032"
BIZUDP_B_PATH="$FONTS/BIZUDPGothic-Bold.ttf"
BIZUDP_R_PATH="$FONTS/BIZUDPGothic-Regular.ttf"
if [[ ! -e "$BIZUDP_B_PATH" ]]; then
curl -L -f -s \
--output "$BIZUDP_B_PATH" \
https://github.com/googlefonts/morisawa-biz-ud-gothic/raw/$BIZUD_COMMIT/fonts/ttf/BIZUDPGothic-Bold.ttf
fi
if [[ ! -e "$BIZUDP_R_PATH" ]]; then
curl -L -f -s \
--output "$BIZUDP_R_PATH" \
https://github.com/googlefonts/morisawa-biz-ud-gothic/raw/$BIZUD_COMMIT/fonts/ttf/BIZUDPGothic-Regular.ttf
fi
# --------------------------------
mipmap=( 512 256 128 64 32 )
for m in "${mipmap[@]}"; do
resvg "./intensity/intensity-packed.svg" \
--skip-system-fonts --use-fonts-dir "$FONTS" \
"$TARGET/intensity-$m.png" --width "$m" --height "$m"
done
mipmap=( 128 64 32 16 )
for m in "${mipmap[@]}"; do
resvg "./epicenter-mark/epicenter-mark.svg" \
--skip-system-fonts --use-fonts-dir "$FONTS" \
"$TARGET/epicenter-mark-$m.png" --width "$m" --height "$m"
done
mipmap=( 512 256 128 64 32 )
for m in "${mipmap[@]}"; do
resvg "./intensity-circle/intensity-packed.svg" \
--skip-system-fonts --use-fonts-dir "$FONTS" \
"$TARGET/intensity-circle-$m.png" --width "$m" --height "$m"
done
mipmap=( 1024 512 256 )
for m in "${mipmap[@]}"; do
resvg "./watermark/watermark-packed.svg" \
--skip-system-fonts --use-fonts-dir "$FONTS" \
"$TARGET/watermark-$m.png" --width "$m" --height "$m"
done
# --------------------------------
simple_dirs=( branding )
for d in "${simple_dirs[@]}"; do
find "$d" -name "*.svg" | while read -r SVG; do
filename="$(basename "$SVG")"
resvg "$SVG" \
--skip-system-fonts --use-fonts-dir "$FONTS" \
"$TARGET/${filename%.*}.png"
done
done
# --------------------------------
RESOURCES="./resources"
cp -r "$TARGET" "$RESOURCES"
rm -f "$RESOURCES.tar"
tar -cvf "$RESOURCES.tar" "$RESOURCES"
rm -r "$RESOURCES"