summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 42c26fdfcbe285e5dec19e24f0bcb98b7478562e (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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# Maintainer: tinywrkb <tinywrkb@gmail.com>
# Contributor: Antonio Rojas <arojas@archlinux.org>

pkgbase=noto-fonts-cjk-vf
pkgname=(noto-fonts-{cjk,{cjk-,}{hk,jp,kr,sc,tc}}-vf)
pkgver=20210430
pkgrel=1
pkgdesc='Google Noto CJK variable fonts'
url='https://www.google.com/get/noto/'
license=(custom:SIL)
arch=(any)
_commit=cee7438f5f8e66397090d483c15275d1af3d87c7
source=("${pkgbase}-${pkgver}.tar.gz::https://github.com/googlefonts/noto-cjk/archive/${_commit}.tar.gz"
        70-noto-{cjk,hk,jp,kr,sc,tc}.conf)
sha256sums=('e0b2b7d6eca2a336cd66d2a63e7145a961fd442601341075115dbe299fa3ddb5'
            'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')
conflicts=(noto-fonts-cjk)
provides=(noto-fonts-cjk)

_faces=(Black
        Bold
        ExtraLight 
        Light 
        Medium
        Regular
        SemiBold)

_langs=(hk jp kr sc tc)

package_noto-fonts-cjk-vf(){
  cd noto-cjk-*/
  for f in NotoSans{,Mono}CJK-VF.otf.ttc; do
    install -Dm644 \
      Sans/Variable/OTC/${f} \
      "$pkgdir"/usr/share/fonts/noto-cjk/${f//-VF.otf}
  done

  for face in "${_faces[@]}"; do
    install -Dm644 \
      -t "$pkgdir"/usr/share/fonts/noto-cjk/ \
      Serif/NotoSerifCJK-${face}.ttc
  done

  install -Dm644 -t "$pkgdir"/usr/share/fontconfig/conf.avail/ \
    ../70-noto-cjk.conf 
  install -dm755 "$pkgdir"/usr/share/fontconfig/conf.default
  ln -s  -t "$pkgdir"/usr/share/fontconfig/conf.default/ \
    ../conf.avail/70-noto-cjk.conf 

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/${pkgname}/
}

_package_locl(){
  conflicts+=(noto-fonts-cjk-vf)
  provides+=(noto-fonts-cjk-vf)

  cd noto-cjk-${_commit}

  install -Dm644 \
    Sans/Variable/OTF/NotoSansCJK${_lang}-VF.otf \
    "$pkgdir"/usr/share/fonts/noto-cjk/NotoSansCJK.otf

  install -Dm644 \
    Sans/Variable/OTF/Mono/NotoSansMonoCJK${_lang}-VF.otf \
    "$pkgdir"/usr/share/fonts/noto-cjk/NotoSansMonoCJK.otf

  # no serif for hk so install the tc instead as the packages conflict
  [ $_lang = hk ] && _lang=tc
  for face in "${_faces[@]}"; do
    install -Dm644 \
      Serif/NotoSerifCJK${_lang}-${face}.otf \
      "$pkgdir"/usr/share/fonts/noto-cjk/NotoSerifCJK-${face}.otf
  done

  install -Dm644 -t "$pkgdir"/usr/share/fontconfig/conf.avail/ \
    ../70-noto-cjk.conf 
  install -dm755 "$pkgdir"/usr/share/fontconfig/conf.default
  ln -s  -t "$pkgdir"/usr/share/fontconfig/conf.default/ \
    ../conf.avail/70-noto-cjk.conf 

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/${pkgname}/
}

_package_subset(){
  cd noto-cjk-${_commit}

  # install sans font
  install -Dm644 \
    Sans/Variable/OTF/Subset/NotoSans${_lang^^}-VF.otf \
    "$pkgdir"/usr/share/fonts/noto-cjk/NotoSans${_lang^^}.otf

  # install mono font
  # there are no subset mono fonts, so install the multi-lingual with default locl, and then conflict
  for i in ${_langs[@]}; do
    [ $i = $_lang ] && continue
    conflicts+=(noto-fonts-cjk-${i}-vf)
  done
  install -Dm644 \
    Sans/Variable/OTF/Mono/NotoSansMonoCJK${_lang}-VF.otf \
    "$pkgdir"/usr/share/fonts/noto-cjk/NotoSansMonoCJK.otf

  # install serif font
  if [ ${_lang} != 'hk' ]; then
    for face in "${_faces[@]}"; do
      install -Dm644 \
        -t "$pkgdir"/usr/share/fonts/noto-cjk/ \
        Serif/NotoSerif${_lang^^}-${face}.otf
    done
  fi

  install -Dm644 -t "$pkgdir"/usr/share/fontconfig/conf.avail/ \
    ../70-noto-${_lang}.conf 
  install -dm755 "$pkgdir"/usr/share/fontconfig/conf.default
  ln -s  -t "$pkgdir"/usr/share/fontconfig/conf.default/ \
    ../conf.avail/70-noto-${_lang}.conf 

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/${pkgname}/
}

package_noto-fonts-cjk-hk-vf(){
  pkgdesc+=' - Traditional Chinese HK as default language (OpenType locl)'

  _lang=hk
  _package_locl
}

package_noto-fonts-cjk-jp-vf(){
  pkgdesc+=' - Japanese as default language (OpenType locl)'

  _lang=jp
  _package_locl
}

package_noto-fonts-cjk-kr-vf(){
  pkgdesc+=' - Korean as default language (OpenType locl)'

  _lang=kr
  _package_locl
}

package_noto-fonts-cjk-sc-vf(){
  pkgdesc+=' - Simplified Chinese as default language (OpenType locl)'

  _lang=sc
  _package_locl
}

package_noto-fonts-cjk-tc-vf(){
  pkgdesc+=' - Traditional Chinese as default language (OpenType locl)'

  _lang=tc
  _package_locl
}

package_noto-fonts-hk-vf(){
  pkgdesc='Google Noto Traditional Chinese HK variable fonts'

  _lang=hk
  _package_subset
}

package_noto-fonts-jp-vf(){
  pkgdesc='Google Noto Japanese variable fonts'

  _lang=jp
  _package_subset
}

package_noto-fonts-kr-vf(){
  pkgdesc='Google Noto Korean variable fonts'

  _lang=kr
  _package_subset
}

package_noto-fonts-sc-vf(){
  pkgdesc='Google Noto Simplified Chinese variable fonts'

  _lang=sc
  _package_subset
}

package_noto-fonts-tc-vf(){
  pkgdesc='Google Noto Traditional Chinese variable fonts'

  _lang=tc
  _package_subset
}