summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 02307596f825868ca71a5c9b1c74e89f54e3207b (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
# Maintainer: Franck Lucien Duriez <franck.lucien.duriez@gmail.com>

pkgname=ttf-google
pkgver=1.0.0
pkgrel=1
epoch=
pkgdesc="Some of the best fonts from google"
arch=('any')
url="https://fonts.google.com/"
license=('custom:Creative Commons')
makedepends=(curl wget)
source=('fonts.txt')
md5sums=('SKIP')

build() {
  cd "$srcdir"
  mkdir -p fonts
  cat fonts.txt | while read LINE
  do
    if ! test -r "fonts/$LINE.ttf" && test -n "$LINE"
    then
      echo "Downloading $LINE"
      REQUEST="https://fonts.googleapis.com/css?family=$(echo "$LINE" | sed 's# #+#g')"
      HINT="$(curl "$REQUEST" 2> /dev/null | grep 'https://fonts.gstatic.com')"
      URL="$(echo "$HINT" | sed 's#^.*url(\([^)]*\)).*$#\1#')"
      wget -q "$URL" -O "fonts/$LINE.ttf"
    fi
  done
}

package() {
  install -dm 755 "$pkgdir/usr/share/fonts/TTF"
  install -Dm 644 "$srcdir/fonts/"*.ttf "$pkgdir/usr/share/fonts/TTF"
}