summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9ab1fdff479dbd5182a67eb4172934c78d1da700 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Maintainer: Andrew Crerar <crerar@archlinux.org>
# Contributor: Mohammadreza Abdollahzadeh <morealaz at gmail dot com>
# Contributor: FadeMind <fademind@gmail.com>
# Contributor: Vlad M. <vlad@archlinux.net>
# Contributor: Sebastian Stammler <stammler.s@gmail.com>
# Contributor: Sarkasper <echo a2FzcGVyLm1lbnRlbkBnbXguY29tCg== | base64 -d>
# Contributor: Daniel Micay <danielmicay@gmail.com>
# Contributor: Michalis Georgiou <mechmg93@gmail.comr>
# Contributor: Alexander De Sousa <archaur.xandy21@spamgourmet.com>

pkgname=ttf-google-fonts-git
pkgver=r8380.47f307584
pkgrel=1
epoch=1
pkgdesc="TrueType fonts from the Google Fonts project (git version)"
arch=('any')
url="https://github.com/google/fonts"
license=('custom:SIL Open Font License' 'custom:Ubuntu Font License v1.0')

depends=('adobe-source-code-pro-fonts'
         'adobe-source-sans-fonts'
         'adobe-source-serif-fonts'
         'cantarell-fonts'
         'noto-fonts'
         'noto-fonts-extra'
         'ttf-anonymous-pro'
         'ttf-caladea'
         'ttf-croscore'
         'ttf-fira-sans'
         'ttf-fira-mono'
         'ttf-inconsolata'
         'ttf-lato'
         'ttf-merriweather'
         'ttf-merriweather-sans'
         'ttf-opensans'
         'ttf-oswald'
         'ttf-quintessential'
         'ttf-roboto'
         'ttf-roboto-mono'
         'ttf-signika'
         'ttf-ubuntu-font-family')
makedepends=('git' 'fontconfig')
conflicts=('jsmath-fonts'
           'lohit-fonts'
           'ttf-andika'
           'ttf-arabeyes-fonts'
           'ttf-cardo'
           'ttf-comfortaa'
           'ttf-google-fonts-typewolf'
           'ttf-lora-cyrillic'
           'ttf-lekton'
           'ttf-medievalsharp'
           'ttf-nova'
           'ttf-oxygen'
           'ttf-oxygen-git'
           'ttf-pt-fonts'
           'ttf-source-code-pro-ibx'
           'ttf-source-sans-pro-ibx'
           'ttf-vollkorn-ibx')
provides=('jsmath-fonts'
          'lohit-fonts'
          'ttf-andika'
          'ttf-cardo'
          'ttf-carlito'
          'ttf-comfortaa'
          'ttf-lora-cyrillic'
          'ttf-lekton'
          'ttf-medievalsharp'
          'ttf-nova'
          'ttf-oxygen'
          'ttf-oxygen-git'
          'ttf-pt-fonts'
          'ttf-source-code-pro-ibx'
          'ttf-source-sans-pro-ibx'
          'ttf-vollkorn-ibx')
source=(git+"${url}".git)
sha512sums=('SKIP')

pkgver() {
  cd fonts

  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd fonts

  # NOTE: Adobe Blank is not meant to be installed.
  # See: https://github.com/google/fonts/issues/2106#issuecomment-520067314
  rm --recursive "${srcdir}/fonts/ofl/adobeblank"
}

package() {
  # NOTE: These are the font families that already exist in the [extra] repo.
  declare -A omitted_font_families=([anonymous-pro]=1
                                    [arimo]=1
                                    [caladea]=1
                                    [cantarell]=1
                                    [cousine]=1
                                    [fira-sans]=1
                                    [fira-mono]=1
                                    [inconsolata]=1
                                    [merriweather]=1
                                    [merriweather-sans]=1
                                    [noto-sans]=1
                                    [noto-serif]=1
                                    [noto-sans-tamil]=1
                                    [open-sans]=1
                                    [oswald]=1
                                    [quintessential]=1
                                    [roboto]=1
                                    [roboto-condensed]=1
                                    [roboto-mono]=1
                                    [source-sans-3]=1
                                    [source-sans-pro]=1
                                    [source-serif-4]=1
                                    [source-serif-pro]=1
                                    [tinos]=1
                                    [ubuntu]=1
                                    [ubuntu-mono]=1
				    [noto-color-emoji]=1)


  while IFS= read -rd '' file; do
    font_family=$(fc-query -f '%{family[0]|downcase|translate( ,-)}\n' "$file" | sed -n '1p')

    # NOTE: Skip the rest of the loop if we're not supposed to be touching this family
    ((omitted_font_families["$font_family"])) && continue

    pkg_font_path="$pkgdir"/usr/share/fonts/"$font_family"
    install -Dm644 "$file" -t "$pkg_font_path"  # TODO: Check and make sure $font_family is being created

    # NOTE: If the font's license already exists, we don't need to copy the license again.
    src_license_path="${file%/*}"/OFL.txt
    pkg_font_license="$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE."$font_family"
    if [[ -f "$src_license_path" && ! -f "$pkg_font_license" ]]; then
      install -Dm644 "$src_license_path" "$pkg_font_license"
    fi
  done < <(find "$srcdir" -type f -iname \*.ttf -print0)

  # NOTE: Since the zcool xiaowei chinese font has special characters. We need to change
  # the folder name to prevent errors during package compression.
  mv "$pkgdir"/usr/share/fonts/站酷小薇体 "$pkgdir"/usr/share/fonts/zcool-xiaowei-regular
  mv "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.站酷小薇体 "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.zcool-xiaowei-regular
}