aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: 19d31750c2215e3da6542fddb13439f68af73dde (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
41
42
43
44
45
46
#! /usr/bin/env bash

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

ttf_filter() {
    # 1 - source file
    # 2 - destination file
    BNP=${BNP:="./BitsNPicas.jar"}
    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
}

export_plugins() {
    cp -r ligature_plugins build/scientifica/ligature_plugins
}

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

    echo "[~] Exporting ligature plugins ..."
    export_plugins

    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