# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Philacorns <opuspace@gmail.com>

pkgname=wqy-microhei
pkgver=0.2.0_beta
pkgrel=12
pkgdesc="A Sans-Serif style high quality CJK outline font"
arch=('any')
license=('GPL3' 'APACHE' 'custom:"font embedding exception"')
url="https://wenq.org"
source=("https://downloads.sourceforge.net/project/wqy/$pkgname/${pkgver//_/-}/$pkgname-${pkgver//_/-}.tar.gz"
        '44-wqy-microhei.conf')
sha512sums=('c1e09c83f6427f637b3c93c7f89e427bde7fb22cedcfbb806fb036f13a553551f28d985516c7ab4c2602b4159502de36b52e6cc9b41c9b6d6e36778a6de74037'
            'e443a5289b24ab1c405b3f1b5548f18bf1a63c54796e2e072c996680326de333ce2fb8d97aa41dbd5ac2cab99af1105e6c1a0f19313f832aa43ec4d6939f8b9e')

build() {
  cd $pkgname
  tail README.txt --lines=16|head --lines=-3>| FONTEXCEPTION
}

package() {
  install -d "$pkgdir"/usr/share/fontconfig/conf.default
  install -Dm644 "$srcdir"/44-wqy-microhei.conf "$pkgdir"/usr/share/fontconfig/conf.avail/44-wqy-microhei.conf
  install -Dm644 "$srcdir"/$pkgname/wqy-microhei.ttc "$pkgdir"/usr/share/fonts/wenquanyi/$pkgname/wqy-microhei.ttc
  install -Dm644 "$srcdir"/$pkgname/FONTEXCEPTION "$pkgdir"/usr/share/licenses/$pkgname/FONTEXCEPTION
  ln -s ../conf.avail/44-wqy-microhei.conf "$pkgdir"/usr/share/fontconfig/conf.default/44-wqy-microhei.conf
}
