forked from gabrielelana/awesome-terminal-fonts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·48 lines (40 loc) · 1.61 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
#!/bin/sh
cd "$(dirname "$0")"
rm -f ./build/*
mkdir -p ./.work
echo 'build all symbols fonts...'
cp ./fonts/pomicons-regular.ttf ./build
cp ./fonts/fontawesome-regular.ttf ./build
cp ./fonts/devicons-regular.ttf ./build
./scripts/fu-relocate ./fonts/octicons-regular.ttf --save-as='.work/octicons-regular-relocated.ttf' --to='0xf300' 2> /dev/null
cp ./.work/octicons-regular-relocated.ttf ./build/octicons-regular.ttf
echo 'export maps for all fonts...'
./scripts/fu-map ./build/pomicons-regular.ttf --namespace 'POMICONS' 2> /dev/null > ./build/pomicons-regular.sh
./scripts/fu-map ./build/octicons-regular.ttf --namespace 'OCTICONS' 2> /dev/null > ./build/octicons-regular.sh
./scripts/fu-map ./build/fontawesome-regular.ttf --namespace 'AWESOME' 2> /dev/null > ./build/fontawesome-regular.sh
./scripts/fu-map ./build/devicons-regular.ttf --namespace 'DEVICONS' 2> /dev/null > ./build/devicons-regular.sh
echo 'override supplied font maps...'
for file in ./fonts/*.sh; do
[ -f "$file" ] && cp $file ./build
done
echo 'check if fonts are overlapping...'
cat ./build/*.sh | \
grep 'CODEPOINT_OF' | \
sed -e "s/^.*\+='\([^']\+\)'/\1/g" | \
sort | uniq | \
while read cp; do
hits=`cat ./build/*.sh | grep $cp | wc -l`
if [ "$hits" -gt "1" ]; then
fonts=`\
cat ./build/*.sh | \
grep $cp | \
sed -e 's/^\(CODEPOINT_OF_[^_]\+\).*$/\1/' | \
sort | uniq | wc -l`
if [ "$fonts" -gt "1" ]; then
echo "more than one font defines $cp, found in: "
cat ./build/*.sh | grep $cp
fi
fi
done
echo 'you can find fonts and maps in local ./build directory :-)'
echo 'done!'