aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: 581681995c029fdf6a91b3dc84c4f4b2bca070df (plain)
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
#! /usr/bin/env bash

export BNP="BitsNPicas.jar"

ff_filter() {
    fontforge -c 'open(argv[1]).generate(argv[2])' "$1" "$2"
}

ttf_filter() {
    # 1 - source file
    # 2 - destination file
    java -jar "$BNP" convertbitmap -f ttf -o "$2" "$1"
}

export_fonts() {
    for i in src/*; do
        local file_name
        file_name=$(basename "${i%.*}")
        ttf_filter "$i" "build/scientifica/ttf/$file_name.ttf"
        ff_filter "$i" "build/scientifica/otb/$file_name.otb"
        ff_filter "$i" "build/scientifica/bdf/$file_name.bdf"
    done
}

main() {
    rm -rf build
    mkdir -p build/scientifica/{otb,ttf,bdf}

    echo "[~] Exporting fonts ..."
    export_fonts

    echo "[~] Entering build directory ..."
    cd build || echo "[!] Failed to enter build directory!"
    tar c --file scientifica.tar scientifica
    echo "[~] Leaving build directory ..."

    echo "[!] Done!"
}

main