File: build.sh

package info (click to toggle)
fonts-b612 1.008-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 29,812 kB
  • sloc: sh: 47; xml: 29; makefile: 11
file content (70 lines) | stat: -rwxr-xr-x 1,675 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

# "-e" stop on the first failure
# "-u" prevent using an undefined variable
# "-o pipefail" force pipelines to fail on the first non-zero status code
set -euo pipefail

readonly ARGS=$*
FONT_TTFS=()
FONT_VFBS=()

for style in "Regular" "Italic" "Bold" "BoldItalic"
do
   FONT_TTFS+=("../fonts/ttf/B612-$style.ttf")
   FONT_TTFS+=("../fonts/ttf/B612Mono-$style.ttf")
   FONT_VFBS+=("../sources/vfb/B612-$style.vfb")
   FONT_VFBS+=("../sources/vfb/B612Mono-$style.vfb")
done

# -----------------------------------------------------------------------------
# ---- UTILS ------------------------------------------------------------------
# -----------------------------------------------------------------------------
log() {
  message=$1; shift
  color=$1; shift
  nc="\033[0m\n"
  printf "${color}[DEPLOY] $message$nc";
}

info() {
  message=$1; shift
  green="\033[0;32m"
  log "$message" "$green"
}

warn() {
  message=$1; shift
  red="\033[0;31m"
  log "$message" "$red"
}

# -----------------------------------------------------------------------------
# ---- MAIN -------------------------------------------------------------------
# -----------------------------------------------------------------------------

main() {
  info "Fix font digital signature (DSIG) / Fix font GASP and PREP table"
  
  for ttf in ${FONT_TTFS[*]}
  do
    echo $ttf
    gftools fix-dsig --autofix $ttf
    gftools fix-nonhinting $ttf $ttf
  done

  info "Export vfb as UFO and normalize UFO"

  for vfb in ${FONT_VFBS[*]}
  do
    ufo=${vfb//vfb/ufo}
    echo $ufo
    vfb2ufo -fo $vfb $ufo
    psfnormalize $ufo
  done
 
  info "Finished building B612 font"
  exit 0;
}

main